Need help with keyboard movements for character in Flash MX!?

Adrianna R

New member
I've tried every tutorial I can find and I don't know what I'm doing wrong. Okay, so I have my flash document, right? I made the ground. I dunno if it's supposed to be an MC but whatever.
I made my character an MC. I double click the MC. First frame, Left Still. I added "stop();" to this, because something told me to. Second frame, Right Still. I also added "stop();" to this. Third frame, Left Run. I added no actionscript to this, because I don't think I need to. Now, I don't know if this may be the problem, but someone told me to make the runs individual MCs. I did that. So inside the Left Run MC, I have 12 frames of my character running. (I like to be accurate at the movement, because my character is an alien dog thing.) I haven't yet finished the last frame, which would be Right Run. The reason for this is because Flash MX does not have a flip tool, so I have to trace all of the frames in a different program and put them back in MX. I do not know if that may be the problem, but I think that the Left Run should work when I press the left Arrow key.
Here's the actionscript I have on the original MC:

onClipEvent (load) { gravity = 0.2; yspeed = 0; xspeed = 1; jumping = 0; } onClipEvent (enterFrame) { if (_root.go) { if (Key.isDown(Key.LEFT)) { if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) { _x -= xspeed; } } if (Key.isDown(Key.RIGHT)) { if (!_root.terrain.hitTest(_x+_width/2, _y+_height/4, true)) { _x += xspeed; } } if ((Key.isDown(Key.UP)) and (!jumping)) { yspeed = -5; jumping = 1; } yspeed += gravity; while (_root.terrain.hitTest(_x, _y+_height/2, true)) { _y--; yspeed = 0; jumping = 0; } if ((!_root.terrain.hitTest(_x, _y+_height/2+1, true)) or (yspeed<0)) { _y += yspeed; } else { yspeed = 0; jumping = 0; } } } onClipEvent (load) { scale = _xscale; } onClipEvent (enterFrame) { if (key.isdown(key.right)) { this._x += 10; _xscale = scale; play(); } if (key.isdown(key.left)) { this._x -= 10; _xscale = -scale; play(); } }

if there is something wrong with the script, please inform me.
I only would like my character to run left and right, and use the spacebar to jump. I don't know how to even approach this. If this is all gibberish to you and you nkow a lot about flash, I could just send you the .fla file and you can either tell me how to fix it or do me a favor and help fix it for me. It would be a lot easier for me. I'm really stressing about this. Please, contact me ASAP!
If you want to contact me, here are my websites:
Skype: sicklepickle
deviantArt: http://tamakanasama.deviantart.com/
Newgrounds: http://strawberrydelish.newgrounds.com/

A lot of help would be MUCH appreciated.
 
Back
Top