Swipe-release movement
BoyGeniusStudios
Member Posts: 92
I am working on a rocket-man styled game and I am currently working on the movement. In the game you tap the actor and swipe backwards for him to move forward (So direction=opposite direction of swipe, power=distance of swipe from actor). However I am running into a problem, but I do not know what it is and I need help fixing it.
My Setup Is:
[Movement Angle]
Rule:
When touch is pressed:
Constrain Attribute: Self.Angle to: VectorToAngle(Self.Position.X-Game.mouse.position.x, Self.Position.Y-Game.mouse.position.Y)
That statement works, but the actual movement is what is messing me up
[Movement]
Rule:
When touch is released:
Accelerate in Angle: Self.Angle
So my problem is that when I release the touch, the actor does not move. What am I doing wrong? How do I fix it?
Link to game file if you would like to see it: http://ge.tt/9KCJdWd/v/0?c
My Setup Is:
[Movement Angle]
Rule:
When touch is pressed:
Constrain Attribute: Self.Angle to: VectorToAngle(Self.Position.X-Game.mouse.position.x, Self.Position.Y-Game.mouse.position.Y)
That statement works, but the actual movement is what is messing me up
[Movement]
Rule:
When touch is released:
Accelerate in Angle: Self.Angle
So my problem is that when I release the touch, the actor does not move. What am I doing wrong? How do I fix it?
Link to game file if you would like to see it: http://ge.tt/9KCJdWd/v/0?c
Comments
Or are you using gamesalad for windows?
Instead of using the accelerate behavior, try using the change velocity behavior.
When Touch is released
--Change Velocity
---- Direction: vectorToAngle(Self.Position.X-Game.mouse.position.x, Self.Position.Y-Game.mouse.position.Y)
---- Speed: magnitude(Self.Position.X-Game.mouse.position.x, Self.Position.Y-Game.mouse.position.Y)
Edit:It only works if I release the touch still touching the actor, if the mouse is not touching the actor, nothing happens
So here is the zip file: http://ge.tt/9KCJdWd/v/0?c
Once again, here is the link to the updated game file if you would like to examen it yourself: http://ge.tt/8QA8EXd/v/0?c
Edit: The end of 480px is before the third platform, so when you try to jump from the third platform he only jumps horizontally
vectorToAngle( self.Position.X - game.Mouse.Position.X - scene.Camera.Origin.X , self.Position.Y - game.Mouse.Position.Y - scene.Camera.Origin.Y )
magnitude( self.Position.X - game.Mouse.Position.X - scene.Camera.Origin.X , self.Position.Y - game.Mouse.Position.Y - scene.Camera.Origin.Y )
Yes, I made sure to do that. The one I uploaded only has basic characters without pictures, so nobody would be able to steal them.