Forum Topic: Shooting with the A button

(256 views • 11 replies)

This topic is 1 page long.

<< < > >>
None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 05:55 AM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

Ok, I'm desperate here, I'm making a basic side scrolling platformer . Everything is going fine so far, standing, running, jumping all work fine, except for I 'm having trouble with the 4th frame where the attack animation is. I have it set so that the Player can shoot by pressing the A key, the problem is when I press the A key it only plays the first frame of the movieclip I have the shooting animation in. Can anyone help me out with this, I'm new to AS and have been playing around with this for hours and searching the forums for solutions.

if (Key.isDown(32))
{
this.gotoAndStop(4);


None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 07:51 AM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

Here's the full code, I'm using Atomic Sponge's tutorial.

onClipEvent (load) {
stop();
hitwallr = false;
hitwalll = false;
grav = 0;
jumping = true;
running = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT) and !jumping) {
gotoAndStop(2);
this._xscale = 100;
if (!hitwallr) {
this._x += 9;
running = true;
}
} else if (Key.isDown(Key.LEFT) and !jumping) {
gotoAndStop(2);
this._xscale = -100;
if (!hitwalll) {
this._x -= 9;
running = true;
}
} else {
running = false;
if (!jumping) {
this.gotoAndStop(1);
if (Key.isDown(65)) {
this.gotoAndStop(4);
}
}
}
if (Key.isDown(Key.UP) and !jumping) {
if (!running) {
jumping = true;
grav = 15;
this.gotoAndStop(3);
} else if (Key.isDown(Key.RIGHT) and !hitwallr) {
this.gox = 11;
jumping = true;
grav = 14;
this.gotoAndStop(3);
} else if (Key.isDown(Key.LEFT) and !hitwalll) {
this.gox = -11;
jumping = true;
grav = 14;
this.gotoAndStop(3);
}
}
if (jumping) {
this.gotoAndStop(3);
this._y -= grav;
grav -= 1;
if (!hitwallr and !hitwalll) {
this._x += gox;
}
} else {
gox = 0;
}
}


None

Momo-the-Monkey

Reply To Post Reply & Quote

Posted at: 7/10/06 08:28 AM

Momo-the-Monkey EVIL LEVEL 30

Sign-Up: 10/15/05

Posts: 3,096

At 7/10/06 05:55 AM, Flash_Beagle wrote:
if (Key.isDown(32))
{
this.gotoAndStop(4);

that's not the a button

the a button is 64

You should see Gir's Soundboard...
{ PHP: Main | | Java: Main }
Every Villian Is Lemons

BBS Signature

None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 08:34 AM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

whoops, yea 32 is the space bar, A is actually 65, but that's not the problem, it responds to pressing the key, but won't play the full mc animation, just the first frame of it.


None

Momo-the-Monkey

Reply To Post Reply & Quote

Posted at: 7/10/06 08:39 AM

Momo-the-Monkey EVIL LEVEL 30

Sign-Up: 10/15/05

Posts: 3,096

i knew it was either 64-65 or whatever.

Do you have stop(); on that one frame?

You should see Gir's Soundboard...
{ PHP: Main | | Java: Main }
Every Villian Is Lemons

BBS Signature

None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 08:45 AM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

No AS at all on that frame


None

Jovatov

Reply To Post Reply & Quote

Posted at: 7/10/06 08:48 AM

Jovatov LIGHT LEVEL 16

Sign-Up: 04/26/04

Posts: 1,879

Very weird, try instance naming the movieclip attack_mc or something and then

if(keyIsDown(65)) {
gotoAndStop(4);
attack_mc.play();

It's a long shot, it may not work, but I can't see any other problems here.


None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 08:54 AM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

Yup wierd, when i put that in, I don't get any any errors, but then when I press A, it doens't do anything at all.


None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 05:53 PM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

-bump

this is driving me crazy


None

ismellarat

Reply To Post Reply & Quote

Posted at: 7/10/06 06:19 PM

ismellarat FAB LEVEL 18

Sign-Up: 08/11/05

Posts: 2,025

I have a similar problem with my walking code. My guy walks in all 4 directions, but for left, down and right, it only shows the first frame and up works perfect :/.

"If the Ancient Greeks could survive without Gameboys and Porno, I'm sure we can too!" - LastSpartan
JUST ASK HER OUT!

BBS Signature

None

Nuggs

Reply To Post Reply & Quote

Posted at: 7/10/06 06:24 PM

Nuggs LIGHT LEVEL 19

Sign-Up: 12/17/05

Posts: 1,222

At 7/10/06 08:48 AM, Jovatov wrote:
if(keyIsDown(65)) {
gotoAndStop(4);
attack_mc.play();

maybe it is the Stop
try gotoAndPlay(4);

to quote Carlos Mencia:
"deet dee dee"

Games|1|2|3| Movies|1|2|

BBS Signature

None

Flash-Beagle

Reply To Post Reply & Quote

Posted at: 7/10/06 06:55 PM

Flash-Beagle NEUTRAL LEVEL 04

Sign-Up: 06/18/05

Posts: 25

Nope still no luck, I'll try playing around with it some more.


All times are Eastern Standard Time (GMT -5) | Current Time: 08:21 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!