2D movement - Vectors to Cartesian and display speed #1467
-
Hey all. I'm working on a project that involves motion in a plane using momentum and gravity. I want to represent these quantities as vectors then translate to Cartesian coordinates to move the sprites. The problem I'm running into has to do with the speed of motion. If I move the sprites 1 pixel at a time, this only allows for movement in 8 directions. I'd like to have things be more fluid but making the pixel moves larger results in sprites that move too quickly given the speed at which the TIC() function is called. This seems like the sort of thing that would have been covered many times before but I haven't been able to find it. I've done some programming, but my background is in math so go easy on me. :-D |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi In order to slow down the process I use a timer/counter and the modulo operator in an if statement checking for remainder of 0 i.e
end Brian ... |
Beta Was this translation helpful? Give feedback.
-
Lua works with doubles, meaning you can have something drawn at 10.5,5.8. It will of course paint it at 10,5, but the math still allows you to move things with doubles. |
Beta Was this translation helpful? Give feedback.
Hi
In order to slow down the process I use a timer/counter and the modulo operator in an if statement checking for remainder of 0 i.e
timer = 0
function TIC()
end
Brian ...