# Fla Help! Firing Bullets!

**URL:** https://forum.kirupa.com/t/fla-help-firing-bullets/21492
**Category:** Uncategorized
**Created:** [May 22, 2003, 4:34am UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492 "2003-05-22T04:34:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ironzionmarley](https://avatars.discourse-cdn.com/v4/letter/i/6a8cbe/32.png) [@ironzionmarley](https://forum.kirupa.com/u/ironzionmarley)
#### Post date: [May 22, 2003, 4:34am UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/1 "2003-05-22T04:34:55Z")

</div>

Hey everyone. I have a quick question. I should know how to do this, but i am brain dead right now. I followed Kirupa’s intructions and I can get my square box to shoot out a red circle. I took it further and added simple left and right key presses tom make my square move on the x axis. But whevever i shoot bullet, then move, my bullet stays ahead of my box, so my key presses control the box AND the bullet. How do I get the circle a.k.a. bullet to go in straight path in which i shot it. Pissin me off.😠 Here is code.

=============================================

Square “Gun” Actions instance name =“gun”

on (keyPress “\<Space\>”) {  
\_root.fire = 1;  
\_root.i += 1;  
duplicateMovieClip(\_root.bullet, “bullet”+i, i);  
}  
on (keyPress “\<Left\>”) {  
\_x += -5;  
}  
on (keyPress “\<Right\>”) {  
\_x += 5;  
}

=============================================

Circle “Bullet” Actions instance name =“bullet”

onClipEvent (load) {  
this.\_visible = 0;  
if (\_root.fire == 1) {  
this.\_x = \_root.crab.\_x;  
this.\_y = \_root.crab.\_y;  
}  
}  
onClipEvent (enterFrame) {  
if (this != \_level0.bullet) {  
if (\_root.fire == 1) {  
this.\_y -= 5;  
this.\_visible = 1;  
}  
if (this.\_y\<0) {  
this.removeMovieClip();  
}  
}  
}

=============================================

Please help me out, remember I want the bullet to go straight after i press space bar a.k.a. “fire button” and not to move along with my shooter. Thanx =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2003, 5:37am UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/2 "2003-05-22T05:37:59Z")

</div>

the problem is probably \_root.fire  
doublecheck that it is set to 0 and 1 at all appropriate times

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2003, 5:39am UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/3 "2003-05-22T05:39:26Z")

</div>

try changing duplicateMovieClip to \_root.duplicateMovieClip  
see what that does

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2003, 4:38pm UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/4 "2003-05-22T16:38:49Z")

</div>

Thanks for the help but neither of those worked. Nice try though!🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2003, 5:04pm UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/5 "2003-05-22T17:04:36Z")

</div>

try using this.\_x instead of just \_x

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2003, 5:46pm UTC](https://forum.kirupa.com/t/fla-help-firing-bullets/21492/6 "2003-05-22T17:46:08Z")

</div>

Still didnt work. Its aight though.
