Yes is another walking problem. I AM A NEWB AT AS

thanks to anyone that is reading this.

ok this is what i have so far:

-mc called “jump”-dont know yet how many frames will be
-mc called “stand”-3 frames long
-mc called “walk”-24 frames long
-mc called “shooting”-10 frames long (dont know how many frames will be yet but lets assume)

now my question WHAT IS THE ACTION SCRIPT TO MAKE THIS THING WORK WELL. i have tried but the problem is that when i release the “right” or “left” key the “walk” mc keeps playing until it reaches the end.

and i swear I WILL make a tutorial about this cuse there isn’t really one that just teaches you just that. no hitTest no scrolling no nothing just how to make your hero in the game walk left right jump and shoot.
so please help me so i can help others also thanks a lot.

if you need any more information to help me out please let me know i have tried the little i know to get it to work and have come back with nothing.

hmm…

When I do anything like this, I like making one movie clip and having frame labels in it. For example, a movie clip called person with a labels called “standing”, “walking” and “jumping”. All of these would be looped (e.g. at the end of the walking sequence "gotoAndPlay(“walking”)).

That way I can say something like:

onClipEvent(keyDown) {
if (Key.isDown(Key.RIGHT)) {
// goto the walking sequence
this.gotoAndPlay(“walking”);
// make the guy face right
this._xscale = 100;
}
if (Key.isDown(Key.LEFT)) {
// goto the walking sequence
this.gotoAndPlay(“walking”);
// make the guy face left
this._xscale = -100;
}
if (Key.isDown(Key.UP)) {
// goto the jumping sequence
this.gotoAndPlay(“jump”);
}
}
onClipEvent(keyUp) {
this.gotoAndPlay(“standing”);
}

This would go in the guy’s actions and. Of coarse, this is just a rough outline.

Hope this helps a bit.

so you saying at the end of each of my walking stand jumping animations i should put a “gotoandplay(1)” so that the walking keeps on looping instead of putting a “stop”?

and by the way i have to create a variable called speed=whatever but where to indicate the speed i want the guy to move at but where will i put that on the AS you provided me with?

you wont unless you use something liek a var

ok i got the guy to walk fine using the code i was provided with even though it took like half an hour to realize that it wasnt working cuse i didnt name the instance mc. but i have a lil problem when i press down he crouches the thing is i dont know how to make him crouch so that if you facing left and you crouch he crouches facing that way and the same for the right.

i tried adding and please dont laught…ok go ahead and laught hahaha

to the crouching action but


if (Key.isDown(Key.LEFT)) {
this.gotoAndPlay("walking");
this._xscale = -100;
this._xscale= 100;

but as you guys know it didnt work.

and one thing isnt there a phisics coding i have to do to make the guy jump? please correct me if i am right and where will i put that code sorry am good at math but i havent take phisics yet.

For the crouching sequence, you have left as the crouching button, i’m not sure if this is what you want. What the xscale does, is if it is 100, the direction is normal, but if it is -100, the direction is inverted. You only need to put this in the <right> and <left> commands, because they change the direction. In the crouching command, the xscale should already be set to the correct direction, so if you just make it go to the crouching sequence, that should be fine.

As for the physics, it would be easier to help if I knew what kind of game you’re making. Eg. Will there be different levels?

The .fla would also be nice

yep, fla and we’ll see what we can do …

no sorry is not the left is the down arrow i just put as an example. and when i get home ill post the code cuse i am trying to avoid posting the fla file cuse i am trying to keep the game under wraps until it is actually done …AND I PROMISE YOU it will be THE BEST flash game you will ever see if not it will be among the best. and thanks for the help everyone. without this forum i wouldnt be able to even get started on the game.

oh and yes there will be dif. levels up to 6 i am thinkin so far.

sounds good.

tell us when its done, havent played an awsome flash game in a long time.

if anyone of you guys would like to help me script the game. and help me with part of the background work since is a lot of work to do background in art base so that the game doesnt take as long to finish anyone is more then welcome the only condition is to keep the game fla under wraps until it is complete. thanks to AS brains that would like to contribute to making the game.

ill give you a lil something about what the game will include just to see if you want to be part of it…

-like i said before i am thinking at least 6 levels
-a few puzzles to solves
-since i cant do the saving feature i am doing the password feature
-about 5-7 weapons
-and the big hint is…youll be driving a tank-and maybe other vehicles…

anyone interested in helping please email me or pm me or post

[email protected]

NOTE:i do flash game/animation just because i love to draw and i love the idea of someone seen my work and going " wow this is great"

oh sorry one thing i forgot to mention i am still havin problem with the crouchin animation when i crouch if i am facin left its still faces to right when i do and if i am facing right it faces right. i wanted so that when i am facin left and you crouch it stays looking that way.

I did it in my game by setting a flag for crouching:


if (Key.isDown(Key.RIGHT)) {
_root.char.faceright = true;
} else if (Key.isDown(Key.LEFT)) {
_root.char.faceright = false;
}
 
// after all the other key checks
 
if (_root.char.faceright) { // this is for a character that faces right by default.
_root.char._xscale = 100
} else {
_root.char._xscale = -100
}

thanks for the code man but your coding is really long and you are using 8 lines of coding for that.
and i found a way to do it with just 3 lines of code. but thanks a lot though


onClipEvent(EnterFrame) {
if (Key.isDown(Key.DOWN)) {
// goto the walking animation
this.gotoAndStop("crouch");
}

by the way wat type of game are you making?