-
[F8] Character problems
How do i make my character change its form when up or down is pressed. Like i press up, he becomes another sprite and so on.
-
-
Getting There!
Easy tex, sometimes it takes longer than half an hour, we're all busy too.
Besides your question is a little vague. What do you by change its form. You'll need to use key listeners to pay attention to the keyboard and fire off a function when the up key is pressed. but what that function is, how are we to know?
_b
-
ummm I'm kinda of an actionscript newbie so...... All i need to know is how to to make him like...That he changes his direction, looks the other way. But instead of rotating i want to draw him in that other direction. So how do i display that?
-
Getting There!
put another drawing on the second frame of his clip. put a stop() action on both frames so that it doesn't flicker back and forth. add a key listener to toggle the current frame.
So... lets say the character's clip is called 'char'. Facing left drawing is frame one, facing right drawing is frame 2. So far so good.
This code on the time line will listen for keyboard in put and switch the frames if the up arrow key is pressed:
var listen:Object = new Object();
listen.onKeyDown = function(){
if(Key.isDown(Key.UP)){
var targetFrame = (_root.char._currentFrame == 1)? 2 : 1;
_root.char.gotoAndStop(targetFrame);
}
}
Key.addListener(listen);
All set.
-
wow thanx. But will this work if i already have another frame for his legs moving?
In that case i must make them switch between 1:3 not 1:2 right?
-
Getting There!
try nesting body parts in sub clips.
so char.legs can be doing whatever they're doing, and you can use the same principle above to control char.head, or char.chest, or whatever.
-
OK I put the code you said and it worked but as long as i am pressing up it keeps switching between the two frames... Why dont i just upload it and u show me how it's done?
-
Nevermind, I figured out how it works. Thanx alot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|