문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top