Page 1 of 1
Walking Character Online Tutorial
Posted:
Thu Feb 12, 2004 2:38 am
by trajecto
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.
Posted:
Fri Feb 13, 2004 4:02 am
by Just4Fun
OK trajecto:
I've got my ghost sprite but I'm not spooked
I'm just ready to levitate to your lead. I learned alot from your last tutorial. I'm looking forward to this one.
Posted:
Fri Feb 13, 2004 6:24 am
by jazz_e_bob
I've got the skeleton dude.
Posted:
Fri Feb 13, 2004 11:19 pm
by trajecto
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.
Posted:
Sat Feb 14, 2004 12:04 am
by trajecto
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.
Posted:
Sat Feb 14, 2004 12:17 am
by trajecto
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.
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;
Posted:
Sat Feb 14, 2004 4:39 am
by trajecto
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!!!
Posted:
Sat Feb 14, 2004 1:52 pm
by makslane
Great job
Posted:
Sat Feb 14, 2004 7:16 pm
by ingsan
is that ok, mr voltare
Posted:
Sun Feb 15, 2004 10:34 pm
by Just4Fun
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 =
Posted:
Tue Feb 17, 2004 4:09 am
by trajecto
You are welcome Rachel, I couldn't do it without everybody's help here! I will try to keep them coming