Help! Jump problem!

Non-platform specific questions.

Help! Jump problem!

Postby crazypotato » Tue Jan 29, 2008 1:24 pm

We're having trouble with one of our characters. He will keep jumping if you want him to and practically fly! Plz help!!!!!!!!!!!!!!!!!! :( :( :( :( :( :( :( T Y SO MUCH.
Crazy Potato and Friends :-D

Website coming soon!!! videos, comics, games(of course), and our charecter CRAZY POTATO!!!!!!!!

Hopefully at "thecrazypotato.com"
crazypotato
 
Posts: 6
Joined: Sat Oct 06, 2007 2:25 pm
Score: 0 Give a positive score

Re: Help! Jump problem!

Postby Kalladdolf » Tue Jan 29, 2008 3:39 pm

help!!!!!!!!!!!!!! panic!!!!!!!!!!!!!!! kidding :wink:
so he will just jump from the air?
ok, first disable the repeat event when you press the button (if you haven't done so yet)
then use if-conditions. it's easy:
character -> collision on top side of platform -> script editor
Code: Select all
canjump = 1; //canjump is a variable that you'll make yourself

and then when you press the "jump" button:
Code: Select all
if(canjump == 1)
{*your jump action*;
canjump = 0;}


so this basically means: he will jump if he has stood on the ground before and when he's jumped, he will disable that.
if he touches the ground again, he'll again be able to jump.
hope that helped...
:D
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Help! Jump problem!

Postby Bee-Ant » Tue Feb 12, 2008 9:13 am

To make double jump
Player>Collision>Top side of platform
Code: Select all
canjump=2;

Player>Keydown>JumpKey
Code: Select all
if(canjump>0)
{
    yvelocity-=10;
    canjump--;
}
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Help! Jump problem!

Postby edh » Tue Feb 12, 2008 10:07 am

There is a really weird effect from code like that, Bee-Ant.

When you land on a platform, and then fall off of it, you can jump twice in mid air.

Does anyone have a work around for that?
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Help! Jump problem!

Postby Bee-Ant » Tue Feb 12, 2008 10:22 am

Ah...so simple...
Player>CollisionFinish>Platform
Code: Select all
canjump=0;

Now...the "weird effect" fixed :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Help! Jump problem!

Postby edh » Tue Feb 12, 2008 10:48 am

But doesn't that create a race condition with the two events on the platform? You have a collision with the platform so you can jump, when that event is over, you can't jump. So while you are on the platform, you will notice that sometimes the jump button doesn't work.

So, if you have
  • collision, top of platform, repeated where jump = yes
  • collision finish, top of platform, not repeated where jump = no

you will get something like the behavior in this example... (Bee-Ant you may recognize it :) )

When I run this, if I'm on a platform and I press space bar to jump, it intermittently works. Do you see the same thing?
Attachments
OneActor.zip
platform with one actor
(4.83 KiB) Downloaded 122 times
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Help! Jump problem!

Postby DilloDude » Tue Feb 12, 2008 11:22 am

The reason for this is that physical response stops the collision. So you're just next to the platform, not actually colliding (intersecting) with it. So the collisionFinish event is triggered, making canjump flicker between 1 and 0. One good method I have for solving this is to use a variable counter (for this example we'll call it time). On your collision with the top of platform, set time to 0. Rather than using a collisionFinish event, put this in drawActor somewhere around the gravity section:
Code: Select all
time ++;
if (time > 2)//adjust this variable to suit
{
    canjump = 0;
}

You need to adjust the variable relative to your gravity amount. The lower it is, the sooner you can't jump after leaving the platform, but the greater the chance of not being able to jump even on the platform sometimes. Play around with this and adjust to suit.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Help! Jump problem!

Postby Bee-Ant » Tue Feb 12, 2008 11:26 am

Let me see :roll:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Help! Jump problem!

Postby edh » Fri Feb 15, 2008 10:45 am

...
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Help! Jump problem!

Postby Bee-Ant » Sat Feb 16, 2008 1:50 am

Whoa...this not what I want...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Help! Jump problem!

Postby Kalladdolf » Thu Feb 21, 2008 1:58 pm

the code DilloDude gave is really cool! It solves something I've been having loadsa trouble about. Thanks. :)
Also, just crossed my mind... you could make a child actor (invisible) relative to the player and make it have a position a little below the player.
It won't have the physical response with the plattform, but it will decide whether to enable or disable canjump (even including the collision finish event!!!)

now, did you get that? should I post a demo? :roll:
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Help! Jump problem!

Postby Bee-Ant » Thu Feb 21, 2008 2:20 pm

Whatever you do...I'm still confused anyway :P
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Help! Jump problem!

Postby Kalladdolf » Thu Feb 21, 2008 5:39 pm

lulz, actually it's quite simple, but I sometimes get con-fuzzled just as well :lol:
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron