It's Just A Jump To The Left....

Game Editor comments and discussion.

It's Just A Jump To The Left....

Postby Pete Holland Jr. » Sun Oct 08, 2006 2:40 am

Hey, everybody!

I'm working on making my character jump. I'm doing okay, studying the demo and all. But my character, when I start to jump, just keeps right on going up like a rocket. I sort of see what I'm doing wrong, and I have no doubt I'll get it. But seeing how the demo does it (and some of the things I've been doing) has prompted a few questions.

1) Am I correct on this: all the events are tied to the actor, not what particular animation the actor is showing at that moment. For example, I don't have to re-enter a "left key means walk left" for when the character is standing still facing left, standing still facing right, and walking right, correct? Just once gets the job done?

2) I tried to make the character jump by drawing a path and making it follow that. But when I hit the jump key, the actor was stuck in an endless loop. Is there a way to either control the actor so that, once the path is finished, it stops? Or should I extend the path a little lower than the platform and just code it so, when the actor collides with the platform, its movement stops?

3) Can an actor be repositioned back where they were after they complete the path?

4) From the looks of the demo, the key to controlling jumps with scripting involves using "Draw Actor". Forgive me for asking, but how is "Draw Actor" different from "Change Animation"?

I think that's all that's been running through my mind today. Any ideas?

Sincerely,
Pete Holland Jr.
Pete Holland Jr.
 
Posts: 19
Joined: Thu Aug 17, 2006 2:15 am
Score: 0 Give a positive score

Re: It's Just A Jump To The Left....

Postby Fuzzy » Mon Oct 09, 2006 5:37 am

Pete Holland Jr. wrote:Hey, everybody!

1) Am I correct on this: all the events are tied to the actor, not what particular animation the actor is showing at that moment. For example, I don't have to re-enter a "left key means walk left" for when the character is standing still facing left, standing still facing right, and walking right, correct? Just once gets the job done?


This is correct! Its tied to the actor rather than animation.

2) I tried to make the character jump by drawing a path and making it follow that. But when I hit the jump key, the actor was stuck in an endless loop. Is there a way to either control the actor so that, once the path is finished, it stops? Or should I extend the path a little lower than the platform and just code it so, when the actor collides with the platform, its movement stops?


Not sure. I dont use paths! I assume you can set the path to null.

3) Can an actor be repositioned back where they were after they complete the path?


Sure. When you begin the path, store the actors location in two extra variables, then when the path finishes, set the character back by assigning those.

4) From the looks of the demo, the key to controlling jumps with scripting involves using "Draw Actor". Forgive me for asking, but how is "Draw Actor" different from "Change Animation"?


Draw actor is a function that draws the aspects of the actor. It is probably called by the draw function for the view(which is also an actor). So the view gets a message "draw yourself" and it passes that down to each actor within its limits, and those actors draw themselves. they then pass back the message to the view that they are done. Once view has heard back from all its actors, it begins again.

Change Animation is a function that tells an actor to set its graphic pointer to another set of pictures. Its like changing the paint on a car.

Hope that clears it all up.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: It's Just A Jump To The Left....

Postby makslane » Mon Oct 09, 2006 12:33 pm

Pete Holland Jr. wrote:Is there a way to either control the actor so that, once the path is finished, it stops?


Use the 'Path Finish' event to remove the path
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Another Question, If I May.....

Postby Pete Holland Jr. » Sat Oct 14, 2006 2:11 am

Hey, everybody!

I've been doing some more playing around, and I'm having another problem with jumps. I get the feeling I'm overlooking something really simple.

Okay, side view platformer (I'll worry about scrolling later, I don't want to overload myself just yet). Got a croc walking right and left. Have gravity added, and have figured out how to make him stop falling through everything. Pressing the space bar is supposed to make him jump.

The part that I'm missing is the start of the jump. I've watched the tutorial and studied the commands, but I can't make Biff The Croc jump correctly.

I have tried a few different combinations. If I set the key down to "disable", Biff only goes up a tiny bit before floating back down. If I set it to enable, Biff keeps on going up and doesn't stop until the space bar is released. If I use the script editor and put in "yvelocity = yvelocity - 10;", he goes up at a steady rate as long as the space bar is pressed. If I type "y = y - 10;", Biff shoots up like a rocket, instantly taking his position instead of moving up (and heaven forbid I set the repeat enable option).

I looked at the demo for the caveman game, and I don't see what it does differently to keep the caveman from jumping like Superman. How do I do the jump correctly and make them jumps instead of flight?

Dobre utka,
Pete Holland Jr.
Pete Holland Jr.
 
Posts: 19
Joined: Thu Aug 17, 2006 2:15 am
Score: 0 Give a positive score

Postby Fuzzy » Sat Oct 14, 2006 3:45 am

Hi again. what you have to do is simulate gravity. the simplest way of doing this is to use the actors draw event and apply fractional positive Yvelocity, which builds IF the actor is in mid jump.

Make a var called IsJumping or something like that, and when you hit the jump button, make IsJumping = 1. Set the Yvelocity to whatever negative value suits you.

Now, make another var and call it delta or something. This will be the rate of fall. It will speed up until you collide with the ground.
In the actors draw event, put this script

if (IsJumping)
{
delta = delta + 0.05;
yvelocity = yvelocity + delta;
}

the end effect of this will be to have the character jump and as it reaches its hieght, the jump slows and becomes a fall.

the next step is to have a collision event between the actor and the ground. in that, you put a script...

IsJumping= 0;
yvelocity = 0;
delta = 0;


be wary of my errors.. I am on my way to bed!
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Game A Gogo » Sat Oct 14, 2006 10:11 pm

or...
on draw actor
Code: Select all
yvelocity+=0.04;
if(yvelocity>1)yvelocity=1;


on the key to make him jump
Code: Select all
if(CanJump==1)
{
yvelocity-=2.4;
CanJump=0;
}


on colision to the ground do a physical respond with the value (1, 1, 0, 0)

and now, do a colision whit the face up of the ground
Code: Select all
CanJump=1;
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron