touch move
hello guys.. i need a help with my new project ..
how can make the main actor(player) to move only Y positions with 150 speed with touch.
i make the follow way with mouse button
rule
actor receives event with mouse button is down
attribute self.motion.linear velocity Y = 0
change atribute self positions Y to Mouse positions Y
this code make the actor to follow the mouse position like jump,teleport what ever his look.. (i dont need this but im close) :P
i need the actor to follow the touch screen with speed and not jumping on position .. if my finger touch on screen Y-0 and the actor is Y - 250 i want the actor to start move with speed 150 at Y- 0...
i hope to understand what i mean.
ty
how can make the main actor(player) to move only Y positions with 150 speed with touch.
i make the follow way with mouse button
rule
actor receives event with mouse button is down
attribute self.motion.linear velocity Y = 0
change atribute self positions Y to Mouse positions Y
this code make the actor to follow the mouse position like jump,teleport what ever his look.. (i dont need this but im close) :P
i need the actor to follow the touch screen with speed and not jumping on position .. if my finger touch on screen Y-0 and the actor is Y - 250 i want the actor to start move with speed 150 at Y- 0...
i hope to understand what i mean.
Best Answers
-
HC_DK Posts: 92
Make a GLOBAL Real Attribute, call it Mouse Pos Y
In your ACTOR, make a rule:
When ALL conditions are
1. Mouse Button is DOWN
2. self.Motion.Linear.Velocity.Y = 0 (this is to make sure that you can only change to a new Y position when the actor is NOT moving)
- Change Attribute: game.Mouse Pos Y to game.Mouse.Position.Y
- Move To: self.Position.X and game.Mouse Pos Y, relative to Scene, Speed: 150 and select Run to completion (otherwise it will only move when mouse button is down)
Hope this was what you were looking for.
BR,
Henrik -
The_Gamesalad_Guru Posts: 9,922
You have to be more clear when you ask for help. you said you wanted it to move to touch. When you touch the screen that is the same as mouse down. Are you making this as a Mac Game or A mobile Game. use the interpolate like I showed you but put it in a rule that says when attribute device.touches.count = 1
interpolate to what I showed you. Now when you touch the screen it will move to that spot. when you remove your finger it will stop. you could also use a moveto command and leave the X at 0 and just tell it to go to the touch Y then set your speed.
Answers
Self.position Y to game.mouse.position Y. You adjust speed with this behavior by changing the time variable and also by changing from linear to say ease in out it ramps then slows. This is one of many ways of doing what you want.