Question

Eventually I will implement the following using touch technology. For the time being however I am only after the mouse solution. If a player clicks and holds the mouse on a particular part of the screen, or on a particular sprite/ menuitem (an image of a left arrow for e.g.) then the main game sprite (say a car for e.g.)continues moving to the left until the player releases the mouse button. If a player clicks and holds another part of the screen/sprite/menu item (an image of a right arrow) then the car continues moving to the right until the player releases the mouse button. Note that the mouse does not have to move while the button is being held down.

Was it helpful?

Solution

solved via a combination of mousedown, mouseup and scheduleupdate. So i have two arrows on my screen. A left and right arrow. If the player clicks and holds on the left arrow then the car sprite keeps moving to the left across the screen and vice versa for the right arrow moving the car right. The car only stops moving when the player releases the mouse (mouseup) from the respective arrow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top