### Any help with geometry?

Posted:

**Wed Mar 25, 2009 8:53 pm**Hi there!

I'm playing around with Löve now for a couple of days and there are some obstacles I can't solve myself (at this moment) or I have no idea where to look for answers. So, my first problem was that I had a point, an angle and the speed of an object. To get the new coordinates I tried to use 2 triangles to find out the height difference between the new and the old point. This is how I tried it:

Downsides:

- Needs a big IF loop to determine how big our angle is because we need to change the parameters a bit. Means one if we're going straight Up (just y - speed) or between 1 and 89 degrees and so on.

- Doesn't really work with small speeds like 2 pixels

Now I use physics to move stuff around but I'm still not happy about that fact as I won't use physics for everything. Then I ran into my next problem which I can't solve with the built in physics afaik. My objects have to change their course on occasion so they can move in a circle or similar. Which brings me to the point:

I could just use a line for everything that moves into one direction or a circle to move stuff in a circle. Or (if you help me with the first two first) follow a polygon line. The only game making experience was with Game Maker on windows more then 4 years ago and I didn't need to do stuff like this because I could define a path objects followed.

So, hit me with the math or some links. I'm not new to programming, but I do mostly desktop applications so I'm not that good with geometry stuff (yet). And for the first post here I have to say: Keep up the good work with Löve, it's really easy to use and Lua is quick to learn. It really feels like programming in Game Maker again, except without the helpers on your side there (which help you with basic stuff like creating graphics/objects, move them, making levels). And Löves big plus is that it's platform independent and free

PS: Sorry for any mistakes, you can keep them if you like English is only my second language.

I'm playing around with Löve now for a couple of days and there are some obstacles I can't solve myself (at this moment) or I have no idea where to look for answers. So, my first problem was that I had a point, an angle and the speed of an object. To get the new coordinates I tried to use 2 triangles to find out the height difference between the new and the old point. This is how I tried it:

Downsides:

- Needs a big IF loop to determine how big our angle is because we need to change the parameters a bit. Means one if we're going straight Up (just y - speed) or between 1 and 89 degrees and so on.

- Doesn't really work with small speeds like 2 pixels

Now I use physics to move stuff around but I'm still not happy about that fact as I won't use physics for everything. Then I ran into my next problem which I can't solve with the built in physics afaik. My objects have to change their course on occasion so they can move in a circle or similar. Which brings me to the point:

**How can I find out the coordinates on a given path to move my objects/sprites along it?**I could just use a line for everything that moves into one direction or a circle to move stuff in a circle. Or (if you help me with the first two first) follow a polygon line. The only game making experience was with Game Maker on windows more then 4 years ago and I didn't need to do stuff like this because I could define a path objects followed.

So, hit me with the math or some links. I'm not new to programming, but I do mostly desktop applications so I'm not that good with geometry stuff (yet). And for the first post here I have to say: Keep up the good work with Löve, it's really easy to use and Lua is quick to learn. It really feels like programming in Game Maker again, except without the helpers on your side there (which help you with basic stuff like creating graphics/objects, move them, making levels). And Löves big plus is that it's platform independent and free

PS: Sorry for any mistakes, you can keep them if you like English is only my second language.