Main
Projects
Art
Music
Scripting
LiveJournal
Forum
Links
Three-Framed Walking
by PCI

I have nothing to say about this script, so I refer you to the author's own notes:

The big trick is to think of it not as "3 frames", but as "4 frames". Of course, some of you readers are saying, "Are you nuts? Of course there are only 3 frames. One for each foot, and then a still position. Well, if you look at it closer, there really are 4 steps to this whole thing. They are:

1. Standing Still.
2. One of the feet goes forward.
3. Standing Still.
4. The other foot goes forward.

There are two Standing Still frames. Therefore before we do any plotscripting, you have to create 2 sets for one hero. There, now that that is done, we can start the scripting.



define script (1,KeyPress,none) 
define script (autonumber,WhichDirection,none) 
define script (autonumber,MoveKeyIsPressed,none) 

script, KeyPress, begin 
while (MoveKeyIsPressed) 
do, begin 
walk hero (me,WhichDirection,1) 
wait (2) 
set hero frame (1) 
wait (2) 
if (MoveKeyIsPressed) 
then, begin 
set hero picture (me,get hero picture (me) + 1) 
set hero frame (me,0) 
wait (1) 
walk hero (me,WhichDirection,1) 
wait (2) 
set hero frame (me,1) 
wait (2) 
set hero picture (me,get hero picture (me) -- 1) 
set hero frame (me,0) 
wait (1) 
end 
else, begin 
wait (1) 
end 
set hero frame (0) 
end 
# This is only because the game is suspended, you cannot exit the game 
without having an alternate way out. 
if (key is pressed (key: Esc)) 
then, begin 
game over 
end 
end 

script, WhichDirection, begin 
if (key is pressed (key: Right)) 
then, begin 
return (east) 
end 
if (key is pressed (key: Up)) 
then, begin 
return (north) 
end 
if (key is pressed (key: Left)) 
then, begin 
return (west) 
end 
if (key is pressed (key: Down)) 
then, begin 
return (south) 
end 
end 

script, MoveKeyIsPressed, begin 
if (key is pressed (key: Down)) 
then, begin 
return (true) 
end 
if (key is pressed (key: Up)) 
then, begin 
return (true) 
end 
if (key is pressed (key: Right)) 
then, begin 
return (true) 
end 
if (key is pressed (key: Left)) 
then, begin 
return (true) 
end 
end 

Site layout (c)2000 Jennifer Raby. Used by permission.