moving actor
chelgeson
Member Posts: 17
how do i make it when i touch the left side of the screen the actor goes left and when i touch the right side the actor goes right.
Comments
Here is one way to do it, (there are other ways)
in your actor
if mouse button is down , and game.mouse.position.x is > game.screen.size.width/2
Move direction 0(right) and speed value
if mouse button is down , and game.mouse.position.x is < game.screen.size.width/2
Move direction 180(left) and speed value
if you dont want to use move you can use change attribute , change velocity , constrain attribute , move , what ever you want
thanks!
@chelgeson have you thought about what will happen if the character is at the far left of the screen and they press on the left side of the screen but at the right side of the character? Would you not want the character to move right? I think being a player I'd expect it to move right not further left.
very true, how would i program it to do that then?
When mouse button is down
--When mouse X is larger than self X
----Move Right
--Otherwise:
----Move Left
Deleted this post , thought it was something else