Hello.
I've been trying to get the basics down of creating a simple player movement engine for a 2d platformer, following a tutorial: http://www.explodingrabbit.com/forum/en ... al-01.669/
My box CAN move left and right along the floor BUT HE WON'T JUMP and after almost and hour of just checking the code and seeing what could be wrong I can't figure this out. I'm at my wits end. Everything seems right but he won't friggin' jump.
Please, if anyone with a keener mind could take a look and see if something is wrong, I would appreciate it greatly!
the mechanics are stored in player.lua but maybe something (somehow?!) is not agreeing elsewhere in the other .luas!?
go left = a
go right = d
jump = SUPPOSED TO BE j
Failure to Jump
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- aliceandsven
- Prole
- Posts: 13
- Joined: Thu Mar 29, 2012 3:15 pm
Failure to Jump
- Attachments
-
- platforming.love
- (2.2 KiB) Downloaded 112 times
Projects: 1) shape story xiv: fabula nova questalis [mouse-avoid game]
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Failure to Jump
You check to see if they have landed immediately after you check if they pushed the jump button. Hence, they are landing before they get off the ground.
To fix it, add "self.y = self.y - 1" between lines 39 and 40. This way they get off the ground before being told Velocity = 0
To fix it, add "self.y = self.y - 1" between lines 39 and 40. This way they get off the ground before being told Velocity = 0
Kurosuke needs beta testers
- aliceandsven
- Prole
- Posts: 13
- Joined: Thu Mar 29, 2012 3:15 pm
Re: Failure to Jump
Trying this now
EDIT: Thanks it worked!!
EDIT: Thanks it worked!!
Projects: 1) shape story xiv: fabula nova questalis [mouse-avoid game]
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Failure to Jump
Personally, I would test for the direction of movement, and only register as landed when there's downward motion.
Who is online
Users browsing this forum: Google [Bot] and 2 guests