Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

sprite controll help

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey, im trying to make something in my game so that when a user clicks a sprite it becomes in a state of 'activity' and only 1 sprite can be in it at a time. now when a sprite is in 'activity' i want it so when the mouse gets a certaint amount of distance away from the sprite it will send the sprite off in that direction.

now what ive done so far is made a collision detection for when the mouse is over the sprite & clicked which triggers a method in one of the sprites if they collide. this method checks to see if left click was released then send it off in direction of mouse. my problem is that this doesnt seem to be working, i think whats happening is that it all works untill the if left click is released, inwhich my mouse is no longer over the sprite and the sprite just sits there then when i move my mouse back over it, it flys off in the direction it should have.

anyone have an ideas? maybe i should be going about this in a tottally diffrent manner. thanks in advance.
 
Evan Pierce
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
noone?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patience, young grasshopper.

I am not sure what the problem is. Perhaps it will help if you can post some code snippets to illustrate what you are doing. The verbal explanation helps us understand what you mean to do, but the code will show us what you are actually doing.

Layne
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic