-
I am making a wrestling game....I know how to do everything in flash EXCEPT action script..can someone help me?
1.- i can make my guy walk left to right with the script, but there is one problem. i have a walk left animation, and a walk right animation. they are both in seperate frames. so when u press right he walks right, left he walks left...BUT since they are in diffrent frames, i placed them both in the middle. so what happens is if u go alllll the way to hte right, and hten press left, he will start walking left from the middle of the screen. any pointers how to fix that?
ill ask somemore if someone can help me out with this
-
Moderator
-
-
Re: oopss
a neat trick is to use the same animation clip.
I.e. walking left to right on the spot and then set the_xscale to -100 for walking left and +100 for walking right.
-
um
can u rephrase that and maybe give me a code? thanks
-
....he's amazing!!!
Originally posted by firezwolf153
I know how to do everything in flash EXCEPT action script
Then you're going to have a hard time writing games. Actionscript/programming is the single most important skill that you need.
You'll need to animate the character walking left and right, without moving him, then move the instance of the movieclip using actionscript.
I hate to be mean, but if I was in your position, I'd go and learn some basic actionscript then come back and start asking questions. It's virtually impossible to explain these things to people with no actionscript knowledge.
You need to know the basics, like the difference between instances and movieclips, setting properties of objects, and using variables, loops and conditions before you can even think about writing a game.
-
i do know BASIC action script, but none of that hard crap
-
....he's amazing!!!
Originally posted by firezwolf153
i do know BASIC action script, but none of that hard crap
Well I don't know what you mean by basic, but referring you back to mark horsell's advice, setting the x_scale of an instance is about as basic as it gets.
If you want to be talked through the whole process of writing a game, you won't get much joy here, apart from the occasional tutorial by mad-sci. Best learn as much as possible by yourself, and ask when you get stuck at certain points. I suggest three things, all of which will help you a great deal:
1. Buy or downlaod the trial of Flash MX, the tutorials and examples are SO much better than in flash5, and there's example files of the very thing your looking for (character moving around with keys)
2. Search/browse the tutorials on this site, there's loads of good stuff there, including some game tutorials.
3. Search the forums. Your question may well have been answered in this forum before. (Try link below)
http://board.flashkit.com/board/sear...aily=&pagenum=
-
Here's the explanation of _xscale:
The _xscale property controls the width (that is, the x scale) of a movie clip. The default is always 100. That means the width of the character is 100% of its original width. If you set _xscale = 50 the movie clip would then be 50% of its original width or half its original width. If you set _xscale = 0, it would appear invisible, because it would be 0% of its original width.
Okay, here's where the technique for reversing your character's direction comes in. If you set _xscale = -100, then you get the mirror image of the original movie clip. In other words, a character that was animated walking to the right would now be animated walking to the left.
Knowing this, you can eliminate your second animation and just use one animation. Assuming that the animation you keep is of the character walking to the right, whenever the left key is pressed you would . . .
this._xscale = -100
. . . which would make him face left. Then you can move him to the left the way you're doing right now.
And whenever the right key is pressed you would . . .
this._xscale = 100
. . . which makes him face right again.
Hope that helps.
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
|