Be a Supporter!

AS: moving a character

  • 291 Views
  • 8 Replies
New Topic Respond to this Topic
lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
AS: moving a character 2005-07-23 08:42:31 Reply

ok i have this actionscript for my moving guy:

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);
_x -= -10;
} else if (!Key.isDown(Key.RIGHT)) {
this.gotoAndStop(1);
}
}

but you see if i do that and add this:

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop(3);
_x -= -10;
} else if (!Key.isDown(Key.LEFTT)) {
this.gotoAndStop(1);
}
}

to the moveclip guy aswell the whole thing stuffs up eg

i want a moving link when you push left it shows a moving animation of link
then when you release the left button it will show the stoped animation of link that is what i want but i cant seem to get it can som1 help me please!

O3Dstudios
O3Dstudios
  • Member since: Jan. 4, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: moving a character 2005-07-23 08:45:15 Reply

you got 2 "T"s in one of the left's

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: moving a character 2005-07-23 08:45:16 Reply

YOU DON'T PUT AS: IN FRONT OF YOUR THREAD UNLESS IT IS A TUTORIAL ABOUT THE SUBJECT OF THAT THREAD

just make the frames inside the player movieclips themselves and animate those movieclips

lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: moving a character 2005-07-23 08:48:20 Reply

just make the frames inside the player movieclips themselves and animate those movieclips

yeah i have done that but i want the action script saying when left is pushed play frame 2 (walking link left)
then when left is release play frame 1 (standing link)

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: moving a character 2005-07-23 08:50:46 Reply

then the error is the fact you have two T 's in the else if
why not just do:

if (Key.isDown(Key.LEFT)) {
this.gotoAndStop(3);
_x -= -10;
} else {
this.gotoAndStop(1);
}
}

lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: moving a character 2005-07-23 08:53:31 Reply

*sigh*
that is not a prob that waz a typo i cant seem to have 2 else actions in the 1 movie clip

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to AS: moving a character 2005-07-23 08:57:44 Reply

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);
_x -= -10;
}else if (Key.isDown(Key.LEFT)) {
this.gotoAndStop(3);
_x -= -10;
}else{
this.gotoAndStop(1);
}
}


- - Flash - Music - Images - -

BBS Signature
lan00
lan00
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: moving a character 2005-07-23 08:59:29 Reply

thankyou alot dude

DarthRaver
DarthRaver
  • Member since: Oct. 6, 2004
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to AS: moving a character 2005-08-08 21:27:21 Reply

if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);
_x -= -10;
}else if (Key.isDown(Key.LEFT)) {
this.gotoAndStop(3);
_x -= -10;

You forgot to change (key.LEFT)) from "_x-= -10;" it should be "_x-= 10;" no negative infront of the ten


BBS Signature