Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- player.angle = 30
- player.speed = 20
- player.acceleration = 2
- print(player.angle)
- local scale_x = math.cos(player.angle)
- local scale_y = math.sin(player.angle)
- local function acceleratePlayer (event)
- if(event.phase=="began") then
- player.speed = player.speed + player.acceleration
- player.velocity_x = player.speed * scale_x
- player.velocity_y = player.speed * scale_y
- player.x = player.x + player.velocity_x
- player.y = player.y + player.velocity_y
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement