This content has been marked as final. Show 5 replies
It looks like in the example above that the movieclip is just been scaled in to give the impression that it's facing left or right. I think a much better solution is to have different graphics in your character movieclip that show it looking in different directions. It'll require you having to have to draw the graphics yourself, but it'll look a lot better.
So say you add extra frames inside your guy_mc movieclip. You make the first frame the default state, the second frame you make your character look left, and the third frame he looks right. Then you create a labels layer above your graphics and name each frame 'normal', 'lookLeft', and 'lookRight'. Add another layer above that for actions and put a stop() action on the first frame.
Back in the movement actionscript you add the functionality to go to those frames depending on which button is pressed. Here's how I would write the script. The additions in the code will not affect the other functions, but as you will not need to use the rotation property, I have commented them out.
I see you added lines such as this one:
How exactly would this work? Wouldn't I also need to edit out the rotation codes? Would I need to create a new mc called lookRight?
Ignore my last post - just make changes to the following areas in the code you already have. All it does is make the width of your character half it's size. This gives it the impression that the character is sort of facing left or right. That's how they've done it in the example you like at Flashkit.
And yes - delete all references in the code to the rotation property. You don't need it.
Ok, my mistake. When I used that animation as a reference, I was trying to give an example of where the frame changes when a key is down. Here is what I want it to look like the guy in this game:
If you play until after the first battle (like 1 minute), you'll see the kind of character movement I'm talking about (i.e. vector/sprite).
I probably wasn't clear about that in the beginning.
Yeah, basically what I wrote in my first post is how you would accomplish what you want to do, except now you would need a graphic for the down frame and change the functionality a little.
If you followed the tutorial at Kirupa exactly, then what you need to do is this.
1) Open up the Guy movieclip and create 2 new layers. Name the top one Actions and the one under that Labels. The bottom layer should be just the graphic of your character. Call this layer Character.
2) Click on the first frame of your Actions layer and hit F9 to open the Actions panel. Put a simple stop(); command there.
3) Click on the first frame of the Labels layer and then go down to the Properties panel and under Frame in the <Frame Label> field type in upPosition.
4) Back in the timeline click on frame 2 of the same Labels layer and press F6 to create a new keyframe. Go back down to the Properties
panel to the Frame Label field and type downPosition.
5) Repeat for frames 3 and 4 but give them names of leftPosition and rightPosition. You use these names in Actionscript to refer to the position your character will face depending on the direction key that is pressed.
6) The next part is up to you how you draw your graphics. The upPosition frame already has a graphic. You need to create graphics for each of the other frames. So you create keyframes(F6) on your Character layer and draw your character facing down, left, and right.
Once you've done that then you make the following changes to the script. Bear in mind these changes will not affect the other functions in the script.
I hope the instructions I've given are clear and easy to follow.