Hi all,
I've just started getting into Lua and LOVE. I've never used Lua before but I'm a big fan of JavaScript and Python - Lua reminds me of a combination of those two languages. Plus LOVE is really neat as well, especially the built-in physics. I've previously used PyGame and I think having physics provided is a big boon.
Anyway, speaking of physics, I thought a good first step to learning Lua and LOVE would be to program some platforming movement. I've setup 'the world' and created the body, attached the shape, got the ground as another shape to collide with. There's gravity, walking left, walking right and jumping. However, I'm confused as to why when ever I apply movement: walking or jumping, I find the new movement seemingly overrides the existing forces or velocity of the body. I'm not sure if the forces I'm applying are too strong? Or if I'm meant to be taking the existing speed into account when I apply new forces. I expected the physics engine to take care of that for me.
I've attached the existing code, sorry if the Lua code is hacky - I'm new to this!
Can anyone suggest why the movement is so jerky? [left and right arrow keys to move, space to jump]
PS: What's with the "obey" in everyone's avatars? Is it a requisite for using the forum? *edit:* ah, I just read the post urging members to do this... bizarre!
Platforming Physics
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Platforming Physics
- Attachments
-
- moon.love
- Simple attempt at platform movement
- (12.47 KiB) Downloaded 307 times
- Dr. Magnusson
- Prole
- Posts: 22
- Joined: Sun Jul 20, 2008 6:10 pm
Re: Platforming Physics
Fairly sure there's a function for getting the velocity of an object, is it not as simple as adding the two together?
Re: Platforming Physics
(I have looked into this, and I also find it peculiar. You made me realize that I've never really used impulses/forces that much during testing, I've generally just been using gravity. I always look at the source to check for obvious bugs when people are having problems, but I couldn't find any this time. Yes, I found it necessary to parenthesize my entire post).
Re: Platforming Physics
well um, hehrude wrote: I just thought it would be funny if all the avatars on every page said "OBEY" (OBEY, OBEY, OBEY). New users will be all liek "ZOMFG, why do all the avatars say `OBEY`lol". It will be funny. Some day ...
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 4 guests