Character crouch, jump, walk... for the corect side. Help!

Talk about making games.

Character crouch, jump, walk... for the corect side. Help!

Postby Chapolin » Fri Jul 15, 2005 8:00 pm

Hi guys! I try to make a game with GE based on Ninja Gaiden style, and have a doubt with KeyDown and KeyUp events.

Well, I have a character with all animations and sprites, and either he is able to walk, jump and crouch. With exception of walk, the rest of the movements is activated depending of the last direction of the animation (in other words, depend of the last sprite/animation of the character on the screen). So, if he look at the left, when I press the down arrow he crouch with the animation/sprite to left. Understand me? How make this? Something like this:

if (char_stopright)
{
ChangeAnimation ("player_char", "crouch_left", FORWARD);
}

??? Not work (not in my hands...)! :(

Puleeeez, help me! :cry:

I think this explanation is very important for everybody making platform games. Thaks for some help. And sorry, my english is terrible... :roll:
Image
Não contavam com minha astúcia! But my english is terrible...
Chapolin
 
Posts: 8
Joined: Fri Jul 15, 2005 7:58 pm
Location: Niterói - RJ (Brasil)
Score: 0 Give a positive score

Sorry

Postby Chapolin » Fri Jul 15, 2005 8:05 pm

Sorry, I wanted to say "if (char_stopleft)..." Oh, it is just an example. :oops:
Image
Não contavam com minha astúcia! But my english is terrible...
Chapolin
 
Posts: 8
Joined: Fri Jul 15, 2005 7:58 pm
Location: Niterói - RJ (Brasil)
Score: 0 Give a positive score

Postby BeyondtheTech » Sat Jul 16, 2005 12:05 am

Create a global variable that will store the direction, based on the last key that was pressed.

i.e. 1 = left, 2 = right, 3 = up, 4 = down (if the last two are necessary)

That way, when you refer back to that variable, you'll know which animation to pick.
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby CdaMarinersFan » Sat Jul 16, 2005 5:33 pm

You can even do it the easy way and make "KeyDown" Events for each action, then use action "Change Animation" for each little thing you want your character to do.
User avatar
CdaMarinersFan
 
Posts: 109
Joined: Wed May 11, 2005 11:20 pm
Score: 0 Give a positive score

Postby Chapolin » Sun Jul 17, 2005 8:35 pm

Very thank you, people! :D I go to try this immediately! I will try to make a mini-game with only one stage contend some characteristics of a platform style game. I wait that it is a good example of tutorial or demo for people who are starting in the creation of this type of game.

One more time: Thank you! :wink:
Image
Não contavam com minha astúcia! But my english is terrible...
Chapolin
 
Posts: 8
Joined: Fri Jul 15, 2005 7:58 pm
Location: Niterói - RJ (Brasil)
Score: 0 Give a positive score

Postby Chapolin » Tue Jul 19, 2005 1:31 pm

Well, I have followed the help of you guys and a script tutorial in the GE Help menu updated and tried things like this for the jump movement:


int key = getLastKey();

if(lastKey = KEY_LEFT)
{
ChangeAnimation("player", "jump_left", FORWARD);
}

if(lastKey = KEY_RIGHT)
{
ChangeAnimation("player", "jump_right", FORWARD);
}

last:Key = key


But not work correctly. Just for one of the sides (only left or only right). This is a bug (well... I'm a bug, but... he)? Or the functions are in conflict because of the use of the same key (the "KEY_UP" in KeyDown event>up)? When I remove one of the lines...:


if(lastKey = KEY_LEFT)
{
ChangeAnimation("player", "jump_left", FORWARD);
}


... the other works correctly.

And what the diference between "=" and "==" in the script? "==" is for a persistent order or something like this? When I put "==" in the script you look, he not works!

For last, have somebody a platform game demo with a script simmilar to this, for example? The tutorial in the GE is too simple, although I have get more skill in GE with then (thanks for the author!).
Image
Não contavam com minha astúcia! But my english is terrible...
Chapolin
 
Posts: 8
Joined: Fri Jul 15, 2005 7:58 pm
Location: Niterói - RJ (Brasil)
Score: 0 Give a positive score

Postby BeyondtheTech » Tue Jul 19, 2005 4:22 pm

== is a equal test.
!= is not equal test.
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: Google Adsense [Bot] and 1 guest