Walking Character Online Tutorial

Learn how to make certain types of games and use gameEditor.

Walking Character Online Tutorial

Postby trajecto » Thu Feb 12, 2004 2:38 am

Let's create a walking character. One that will follow the arrow keys on the PC and the 4 way button on the Pocket PC.

Start by first downloading one of Reiner "Tiles" Prokein's fantastic freeware sprites. All he asks for is a credit if you use his graphics: http://www.reinerstileset.de

Reiner has some great tile artwork also for backgrounds, buildings, paths, all sorts of goodies.
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby Just4Fun » Fri Feb 13, 2004 4:02 am

OK trajecto:
I've got my ghost sprite but I'm not spooked :wink: I'm just ready to levitate to your lead. I learned alot from your last tutorial. I'm looking forward to this one.
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby jazz_e_bob » Fri Feb 13, 2004 6:24 am

I've got the skeleton dude.
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 trajecto » Fri Feb 13, 2004 11:19 pm

And I have the Red Knight!

Ok first let's assign our animations to an actor. Actors can have multiple animations, By continually selecting add animation on an actor we create multiple animations.

Let's use the "walking" bitmaps, the Red Knight has 8 frames in each animation direction (N, NE, E, SE, S, etc.), I believe the other sprites do as well. We only need the N, S, E and W directions for this tutorial.

ok here we go!


Add an actor "mainChar" to a Game Editor session.

Add an animation "MainCharN' and add the file "walking n0000.bmp" as a multiple file.

Add an animation "MainCharE' and add the file "walking e0000.bmp" as a multiple file.

Add an animation "MainCharS' and add the file "walking s0000.bmp" as a multiple file.

Add an animation "MainCharW' and add the file "walking w0000.bmp" as a multiple file.

Note: You can change the starting animation by using Actor Control and the animation pull-down. Let's start with MainCharN.
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby trajecto » Sat Feb 14, 2004 12:04 am

Let's add our key down/up events now.

Add Event Key-down press the up arrow add the event Change Animation, use:

Event Actor
MainCharN
No change

Add as immediate action

Add Event Key-down press the left arrow add the event Change Animation, use:

Event Actor
MainCharW
No change

Add as immediate action

Add Event Key-down press the down arrow add the event Change Animation, use:

Event Actor
MainCharS
No change

Add as immediate action

Add Event Key-down press the right arrow add the event Change Animation, use:

Event Actor
MainCharE
No change

Add as immediate action

Now test your sprite in Game Mode by making sure he switches directions as you select the different arrow keys.
Last edited by trajecto on Sat Feb 14, 2004 4:27 am, edited 1 time in total.
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby trajecto » Sat Feb 14, 2004 12:17 am

Now let's make him move!!!
We will increment/decrement our actors screen coordinates through button presses. I have chosen 3 pixels as a distance traveled, feel free to adjust that. I use the actor's name and his x/yscreen coord but you can also just use "x -= 3" for example.

What is this funny looking "x -= 3;" or "x += 3;" you ask??? it's just C language shorthand for saying "x = x - 3" or "x = x + 3" -I started using it and now I am hooked. :twisted:

Here we go!

Actor Control
Events Add Key Down
Press the left arrow
Add Action
Script Editor
mainChar.xscreen -= 3;

Actor Control
Events Add Key Down
Press the right arrow
Add Action
Script Editor
mainChar.xscreen += 3;


Actor Control
Events Add Key Down
Press the down arrow
Add Action
Script Editor
mainChar.yscreen += 3;

Actor Control
Events Add Key Down
Press the up arrow
Add Action
Script Editor
mainChar.yscreen -= 3;
Last edited by trajecto on Sat Feb 14, 2004 4:56 am, edited 2 times in total.
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby trajecto » Sat Feb 14, 2004 4:39 am

One final detail and we will be done...

Our sprite keeps walking even when he is standing still. What we need to do is stop the animation when we release an arrow key, we also need to start the animation back up when we depress an arrow key.

We need to use "Change Animation Direction" Forward and Stopped.

For each direction add a Key Down and a Key Up event:

The key Down event will be:
Change animation direction
Event Actor
Forward

The Key Up event will be:
Change Animation Direction
Event Actor
Stopped


ALL DONE!!! now walk your guy around, make a game out of it!!!
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby makslane » Sat Feb 14, 2004 1:52 pm

Great job :D
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ingsan » Sat Feb 14, 2004 7:16 pm

is that ok, mr voltare :?: :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 Just4Fun » Sun Feb 15, 2004 10:34 pm

TRAJECTO
You are "THE MAN". Your tutorials are the best thing to happen since Makslane created GE! Your examples are so understandable that even a"simple muggle" like me can eventually muddle through. Thanks to your your contribution, my little ghost is levitating all around the screen. This is amazing fun!

Thanks again. Rachel = :lol:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby trajecto » Tue Feb 17, 2004 4:09 am

You are welcome Rachel, I couldn't do it without everybody's help here! I will try to keep them coming :D
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest