At 03:38 AM 11/30/00, Jon Paul Alongi wrote:
>how can i move a simpel graphic dynamicly down the stage like mario moves
>acrross the tv....
>
>could some one write me a simple piece of code...
>i know its only about 4 lines long...but i just cant get it right
Here's one way. Let's say you've set the variable (if that's what the
subject line is asking) in a keyDown handler in a movie script as shown in
the following untested Lingo:
-- movie script
global gLocIncrement
on keyDown me
case (the keyCode) of
123: gLocIncrement = point(-1,0)
126: gLocIncrement = point(0,-1)
125: gLocIncrement = point(0,1)
124: gLocIncrement = point(1,0)
end case
end
on keyUp me
gLocIncrement = point(0,0)
end
Then in a behavior script on Mario:
--behavior script
global gLocIncrement
on exitFrame me
sprite(me.spriteNum).loc = sprite(me.spriteNum).loc + gLocIncrement
end
I imagine there are other, more efficient ways, but this might get you
started. For instance, you may be able to utilize 'the keyPressed' to deal
with the user pressing 2 keys to move in a diagonal direction.
You would probably benefit by reading some of the many articles on the DOUG
site:
"Game Quick Links"
http://www.director-online.com/quickLink.cfm?id=315
And the Learning Arcade at MediaMacros:
http://www.mediamacros.com/cgi-bin/webdata_game.cgi?cgifunction=Search
--
Mark A. Boyd
Keep-On-Learnin' :)
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]