|
11-15-2010, 07:07 AM | #1 |
Hardcore Head-Ripper
Join Date: Nov 2010
Posts: 8
|
Actionscripting (2 and/or 3) a walk...
I had a huge greeting typed out, but now it's gone. In a nutshell, I'm here because I happen to think the people of this forum are quite intelligent.
I am currently programming a game, a flash game. I've managed to get the scripting right for a concept sprite to move and jump, but the walk animation doesn't... animate. I'm guessing the actionscripting inside the sprite's movieclip isn't assigned to the right frames, or the wrong actions are being commanded. What I need are the proper actions and frame assignments for the sprite's movieclip. What I'm using: Flash CS5 Actionscript 2 and 3 (I'll take advice for both, or either) Mac OS Feel free to ask for more details. Any help would be tremendously (yes, that much) appreciated. Apologies if this or a topic like this has been posted, I made an effort to look. Last edited by ArtisticSkytzo; 11-15-2010 at 07:09 AM. |
11-15-2010, 08:13 AM | #2 |
Sent to the cornfield
|
Just comment out everything then add them back in line by line till you find an error.
Alternatively turn it off and turn it back on again. That solves 90% of my programming dilemmas. |
11-15-2010, 12:10 PM | #3 | ||
Blue Psychic, Programmer
Join Date: Feb 2007
Location: Home!
Posts: 8,814
|
Quote:
Screenshots and some of the code might help.
__________________
Quote:
Journal | Twitter | FF Wiki (Talk) | Projects | Site |
||
11-15-2010, 02:16 PM | #4 |
Hardcore Head-Ripper
Join Date: Nov 2010
Posts: 8
|
Uploaded with ImageShack.us The above is the inside of the movieclip. The most recent method I used was to frame by frame the walk, insert a blank keyframe on frame 1, and copy and paste frame 2 (the "stand" frame) ahead of all the other frames (which would be frame 12). The commands are as follows: In frame 1, blank frame: gotoAndStop(2) In frame 2, the stand frame: gotoAndStop(12) In frame 12, the last frame: gotoAndPlay(2) This part is where I'm having trouble making it work. I've played with the commands, and either the sprite doesn't walk but still moves, or walks continuously while moving. I'm trying to get the little guy to show walking only when the key is pressed. Here's the coding for the key presses assigned to frame 1 of the main stage (not inside the movieclip): if(Key.isDown(Key.RIGHT)) { _x+=speed; _xscale=100; } if(Key.isDown(Key.LEFT)) { _x-=speed; _xscale=-100; } if(Key.isDown(Key.SPACE)) { isJumping = true; jumpSpeed =-10 Feel free to ask for more details. |
11-15-2010, 03:01 PM | #5 | |
Blue Psychic, Programmer
Join Date: Feb 2007
Location: Home!
Posts: 8,814
|
The issue is the gotoAndStops you're using. That function makes all playing cease and waits for additional input to make it go again.
What I'd really suggest, though, is simply making it a loop that plays through until directional input ceases if you can. Then it's just a matter of adding an event listener for a key-up (I think Flash has that one) to make it go back to the standing pose. Edit: What I mean is you should switch the standing movie clip symbol with the walking one when the character moves and switch back when it stops.
__________________
Quote:
Journal | Twitter | FF Wiki (Talk) | Projects | Site Last edited by bluestarultor; 11-15-2010 at 03:06 PM. |
|
11-15-2010, 03:35 PM | #6 |
Hardcore Head-Ripper
Join Date: Nov 2010
Posts: 8
|
Ok, I'll try that. Thanks yo.
|
11-15-2010, 04:03 PM | #7 |
Hardcore Head-Ripper
Join Date: Nov 2010
Posts: 8
|
One more question, would I code the key up function on the main stage frame 1, or within the movieclip?
|
11-15-2010, 05:05 PM | #8 | |
Blue Psychic, Programmer
Join Date: Feb 2007
Location: Home!
Posts: 8,814
|
I'm not sure off the top of my head. I'd assume it would be at the same level as your key down events.
__________________
Quote:
Journal | Twitter | FF Wiki (Talk) | Projects | Site |
|
11-15-2010, 09:17 PM | #9 |
Hardcore Head-Ripper
Join Date: Nov 2010
Posts: 8
|
Ok thanks again, and thank you too, Smarty.
|
|
|