Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Problems with jumping.

Author
Message
Shasla117
13
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 25th Feb 2011 17:34 Edited at: 25th Feb 2011 21:35
I have made some steps and added it into my game. However, when i jump onto those steps, I can no longer jump. I can jump fine when I am on the floor but as soon as I am on the steps, I can no longer jump.


I have attached a part of the code that I think might be causing the problem.

This is the rest of the code if the snippet I provided is not sufficient.

EDIT: I can't seem to post the code, as it says my post contains bad language.

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Feb 2011 13:07 Edited at: 26th Feb 2011 13:09
Perhaps you need a different translator regarding the 'bad language' issue. You really need to figure it out, as most people will be hesitant to download a file from a new person as the possibility is there that it could contain a virus.

You check for collision with object 1 against objects 6 - 12, but objects 7 - 12 do not exist. I re-numbered the objects you had listed and added object 12 based upon the placement of the other objects.

If you were to use the command, SHOW OBJECT BOUNDS ObjectNumber, on each of these stair objects, you would see that the area it sees for collision is too large in height. When you go to jump, it would still register a collision for several iterations. You should adjust the collision box appropriately. See the pic:


You are using the variable, MyAcceleration#, to control whether or not you are jumping in addition to being the amount you want to jump. IMO, it would be better to use a variable like JUMP to control whether you are jumping (i.e. JUMP = 0, not jumping, JUMP = 1 if player is jumping upward, JUMP = 2 if player is jumping downward) and use MyAcceleration# for the jump amount.

Attachments

Login to view attachments
Shasla117
13
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 28th Feb 2011 21:40
Thanks alot. I actually used some basic code I found as a foundation for my game and edited it to my liking.



This is what was originally in the code. This is why it checks objects 6-12, I didn't realize it at the time, but I realized it when you pointed it out. So i just edited that and changed the positions to fit my needs.

Login to post a reply

Server time is: 2024-11-16 19:12:18
Your offset time is: 2024-11-16 19:12:18