Jumping Platform Characters

Non-platform specific questions.

Jumping Platform Characters

Postby jazz_e_bob » Thu May 27, 2004 7:53 am

What is the easiest way to test if an actor is standing on a platform?

The actor should only be able to jump if he is standing on the platform - not already in the air.

jazz
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Thu May 27, 2004 10:04 am

Hi, how are you ?

On your Platform actor (On KeyDown > Script), write :

    if(yvelocity == 0)
    {
    Jump;
    }


Heh, mate, we're still on the Move :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Thu May 27, 2004 10:58 am

Hi Ingrid.

I am well.

Had a major system crash recently though. Lost a few hours work on microfooty and a few days to rebuild my computer. Working better than ever now though. :)

Glad to hear you are keeping busy. You guys do such amazing work.

The only problem with what you said is that ( yvelocity == 0 ) at the peak of a jump too. :(

Image
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Thu May 27, 2004 11:12 am

:? How come there is a yvelocity = 0 at peak of jump ? Do you have gravity on Draw Actor ? Did you put yvelocity = 0 at jump peak so that you obtain gravity ? If that is the case, I have probably a better way of doing that ...

Anyway, for your problem, you can use a variable.
On Collision with Platform, jump = 0;
On CollisionFinish with Platform, jump = 1;
So, onKeyDown, if ( jump == 0 ), Jump Action;
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ingsan » Thu May 27, 2004 11:26 am

Here's what i do for a platform character :

You have two actors : Batman and Ground

Batman
Add Event KeyDown[UP]
Add Script and write :
    yvelocity = -9;

Add Event DrawActor
Add Script and write :
    yvelocity = yvelocity + 1;
Add Event onCollision with TopSide of Ground ( Repeat YES )
Add Script and write :
    yvelocity = 0;


You get a Smooth and gradual jump and gravity :P
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Thu May 27, 2004 11:46 am

Cool.

Thanks for the tip. :)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Thu May 27, 2004 5:36 pm

you're welcome 8)
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Snowfly » Sun Sep 11, 2005 1:04 pm

hi ingsan, i tried your solution. it works fine, except that there is still a very small chance that the player can double-jump (when at the peak of a jump). this is what jazz-e-bob was mentioning.

is there a more elegant solution?
Snowfly
 
Posts: 14
Joined: Sat Sep 10, 2005 3:47 am
Score: 0 Give a positive score

Postby jazz_e_bob » Sun Sep 11, 2005 1:12 pm

http://www.game-editor.com/forum/viewto ... atform+guy

This uses a second actor to detect the platform.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Snowfly » Mon Sep 12, 2005 2:04 am

hi jazz-e-bob, platform guy is pretty cool. i'm digging into your code now. :)

the solution i tried was to set a global variable 'int onGround = 0' (my character starts in the air) and setting it to 'onGround = 1' whenever the player touches the ground. When the player presses the jump button, onGround is set to 0.

This pretty much kills the double-jump, but the character is still able to jump when you simply walk off a platform. I tried adding a collision finish script to set onGround to 0 when the character walks off a platform, but it didn't do anything. :(

another bug i'm working around is preventing the character from 'sticking' when you push against a wall mid-jump.
Snowfly
 
Posts: 14
Joined: Sat Sep 10, 2005 3:47 am
Score: 0 Give a positive score

Postby jazz_e_bob » Mon Sep 12, 2005 5:48 am

Good luck! :)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Snowfly » Mon Sep 12, 2005 1:13 pm

here's my solution for platform guy:

on collision with platform, set parent of event actor to collide object. set parent to 'no parent' on finish collision with collide object. voila!

next i will try to inherit some momentum from the platform.
Snowfly
 
Posts: 14
Joined: Sat Sep 10, 2005 3:47 am
Score: 0 Give a positive score

Postby jazz_e_bob » Tue Sep 13, 2005 2:39 am

Well done.

I have added this to my demo and will release it with next GE update.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Mon Sep 19, 2005 8:32 pm

Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby DilloDude » Fri Jan 27, 2006 7:00 am

You can also see my solution to the double-jump bug.
http://game-editor.com/forum/viewtopic.php?p=7564&highlight=#7564
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest