Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : How do I do this?


bunny5619
3/4/2004 10:21:48 PM
I'm trying to make a simple game where you move around trying to find stuff
that people have lost, but I cant figure out how to make it so that when you
press an arrow key (let's say the right one) he moves right. Can anyone help me?
bunny5619
3/4/2004 11:00:40 PM
Jack.
3/4/2004 11:17:30 PM
amount = 10;
minP = 25;
maxP = 275;

this.onEnterFrame = function(){
with(man){
if(key.isDown(Key.LEFT)){_x<minP ? _x=minP :_x -= amount;}
if(key.isDown(Key.RIGHT)){_x>maxP ? _x=maxP :_x += amount;}
if(key.isDown(Key.UP)){_y<minP ? _y=minP :_y -= amount;}
if(key.isDown(Key.DOWN)){_y>maxP ? _y=maxP :_y += amount;}
}
};

hth,
bunny5619
3/4/2004 11:21:14 PM
Jack.
3/4/2004 11:33:05 PM
[quoted text, click to view]

yes....
with your figure as a movieclip symbol,
and given the instance name of "man",
paste the code to the frame on the main
timeline that contains your clip.


bunny5619
3/4/2004 11:50:39 PM
bunny5619
3/4/2004 11:56:32 PM
bunny5619
3/5/2004 12:46:21 AM
AddThis Social Bookmark Button