Baby Steps

Game Editor comments and discussion.

Baby Steps

Postby CatT » Sat Mar 25, 2006 11:38 pm

How do you code your actor to walk across from left to right and yet be able to jump if you like?
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby duracel92 » Sat Mar 25, 2006 11:41 pm

well left and right is -
on key down button
x = x - or + 5 or whatever number

Up is -

y = y - whatever number... I think, try changing the - to a + if it doesn't work.
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby CatT » Sat Mar 25, 2006 11:46 pm

duracel92 wrote:well left and right is -
on key down button
x = x - or + 5 or whatever number

Up is -

y = y - whatever number... I think, try changing the - to a + if it doesn't work.


Thanks. How do you get to the key down button?
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby duracel92 » Sat Mar 25, 2006 11:51 pm

get the menu up on the actor, then click add on the events section
Click on "key down"
press the key you want. so if you want "a" to be left press a.
then click on script editor.
type the code. *note* always end the line on a semi-colon ";"
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby duracel92 » Sat Mar 25, 2006 11:55 pm

Oh and also, go back on the events bit key down etc, and click on change animation, so your actor will look like it is actually moving.

then go back on the events thing and make a key up event, (use same key as the key down event) and click change animation to one where it looks like it is stopped.

if you can understand this one i'll be surprised im tired thats all so I speak lots of nonsense...
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby CatT » Sun Mar 26, 2006 1:48 am

duracel92 wrote:Oh and also, go back on the events bit key down etc, and click on change animation, so your actor will look like it is actually moving.

then go back on the events thing and make a key up event, (use same key as the key down event) and click change animation to one where it looks like it is stopped.

if you can understand this one i'll be surprised im tired thats all so I speak lots of nonsense...


Hey, Duracel, I think I got it. Thanks! Thanks for answering my baby questions. That takes patience. Thanks again. My little guy is moving!
He goes right, left, up and down, but he doesn't jump. How can I add jump up to the right or jump up to the left?
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Jumping

Postby CatT » Sun Mar 26, 2006 1:37 pm

I searched the forum to find information on how to jump. This is what I found: Event Draw Actor Action Script Edit yvelocity=5; add Event Collision (with Ground with repeat enabled). Add Action Script Edit and write yvelocity=0; Add Event Keydown (Up), w/ repeat disabled Add Action Script Editor and write if (yvelocity==0)
{
y=y-30;
}

This loses me after Action Script Edit yvelocity=5;--I can do that fine--but then where do I find "add Event Collision (with Ground with repeat enabled)"?

Can anyone break this down into simple steps for me? It might also be helpful to others. Thanks. My little guy is walking up, down and left and right--I don't want to interfere with that, but want to add jumping ability.
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby duracel92 » Mon Mar 27, 2006 3:30 pm

[/quote] He goes right, left, up and down, but he doesn't jump. How can I add jump up to the right or jump up to the left?

To jump use the key down event, and the key you want to jump. in the script editor type *I think* y = y +10; *make sure you have gravity, this will make the actor fall back down. Pressing the jump button and a directional key should make him jump left etc...

I searched the forum to find information on how to jump. This is what I found: Event Draw Actor Action Script Edit yvelocity=5; add Event Collision (with Ground with repeat enabled). Add Action Script Edit and write yvelocity=0; Add Event Keydown (Up), w/ repeat disabled Add Action Script Editor and write if (yvelocity==0)
{
y=y-30;
}
}

This loses me after Action Script Edit yvelocity=5;--I can do that fine--but then where do I find "add Event Collision (with Ground with repeat enabled)"? [quote]

I think this is to make the actor jump, but only jump once... I don't recomend using this if your a beginner like me also...
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby CatT » Tue Mar 28, 2006 2:26 am

duracel92 wrote:
He goes right, left, up and down, but he doesn't jump. How can I add jump up to the right or jump up to the left?

To jump use the key down event, and the key you want to jump. in the script editor type *I think* y = y +10; *make sure you have gravity, this will make the actor fall back down. Pressing the jump button and a directional key should make him jump left etc...

I searched the forum to find information on how to jump. This is what I found: Event Draw Actor Action Script Edit yvelocity=5; add Event Collision (with Ground with repeat enabled). Add Action Script Edit and write yvelocity=0; Add Event Keydown (Up), w/ repeat disabled Add Action Script Editor and write if (yvelocity==0)
{
y=y-30;
}
}

This loses me after Action Script Edit yvelocity=5;--I can do that fine--but then where do I find "add Event Collision (with Ground with repeat enabled)"?

I think this is to make the actor jump, but only jump once... I don't recomend using this if your a beginner like me also...


I think you're right---I've abandoned trying to figure that out and am copying the caveman scripting for the caveman in that demo.

At least I think I'm going in the right direction. :D

Thanks.
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby Fuzzy » Tue Mar 28, 2006 7:58 am

Jumping requires that you impart an upward motion, which you have succeeded in doing. The next stage is to cause the environment to push back down on your jumper.

What most people do is use the arrows to strt the jump, and use a tiny piece of code in the actors draw event, so that each frame, it falls a little faster.

It helps to think that when you are jumping, you are also falling, its just that the jump is going faster, but it slows down. At the same time, your fall starts slow(0) and increases until it is faster thant he jump. at this point, you are heading downwards.

select the jumpers draw actor event. then select script editor, and put this.

yvelocity = yvelocity + 0.05;

Modify the 0.05 until you get a nice jump effect.

now, select the actors collison event, and select "any side" of actor "ground" or whatever you called it. from there, select action, then physical response. You will see four 1.0 numbers. leave the first two alone, and set the second two to 0.0

that should be all you need. close all the menus and test.
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 CatT » Tue Mar 28, 2006 2:22 pm

ThreeFingerPete wrote:Jumping requires that you impart an upward motion, which you have succeeded in doing. The next stage is to cause the environment to push back down on your jumper. . . .

then physical response. You will see four 1.0 numbers. leave the first two alone, and set the second two to 0.0 that should be all you need. close all the menus and test.


Thanks. I think that will work -- last night I was trying to understand and copy all the scripting that is in the caveman ged and I got as far as physical response (I mean I found it) and then didn't know what to do with the numbers.

Your help is very clear and detailed. Thanks particularly for that. Being a newbie means you don't always know where you're off when you're off and you could be off by just one tiny script error. I got my figure to jump last night, but the poor guy plummeted down. I'm pretty sure this will work for me but I can't try it until later. Thanks again.
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby CatT » Tue Mar 28, 2006 11:56 pm

Thanks so much -- I'm very excited -- my figure is walking left, right, up, down and jumping nicely--it's a smooth, natural jump. :D :D

I'm curious about one thing though. My script for key down (up key) is
y-=5;

And my script for key down (down key) is
y+=5;

I would have thought it would be the other way around.
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby Fuzzy » Wed Mar 29, 2006 4:07 am

I guess its because on earth, we measure higher altitudes with larger numbers.

Think of it like gravity. negative gravity will make you rise y-5. Positive gravity pushes you down y+5

I cant wait to see what you have made!
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 CatT » Wed Mar 29, 2006 3:05 pm

ThreeFingerPete wrote:I guess its because on earth, we measure higher altitudes with larger numbers.

Think of it like gravity. negative gravity will make you rise y-5. Positive gravity pushes you down y+5

I cant wait to see what you have made!


Thanks. I made my own sprite--a girl with a long braid and a knife. I still have a way to go before my game is much but I'm progressing with all the help. :D

She is only a 2d Right facing sprite right now. I'm going back to the caveman demo to look at all the actors, but if I add her facing left, stop right and stop left, I would code each one the same and add change animation?

I see, by the way, that 2d side scrolling games are becoming very popular again which is encouraging. I missed its prime but still like playing this kind of game. This doesn't lessen my desire to make an rpg eventually, but I notice that Nintendo Power gave Castlevania for DS, a 2d sidescroller its award for its handdrawn art and in general best game (I think) over other 3d games.
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Postby CatT » Mon Apr 03, 2006 3:01 am

I've learned quite a bit since I've started.

But now I want to move my actor to a new level. I know I can do it with a move command and listing the new x,y coordinates where the new level starts. But I'm a little perplexed how to do this -- precisely what script do I enter where.

Also, if I've made my player the parent of view so that the view follows my player across a level, do I have to do anything further to make the view follow the actor to the new level?
User avatar
CatT
 
Posts: 75
Joined: Mon Mar 13, 2006 6:57 pm
Score: 0 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest