# Why won't my ship shoot? :(

**URL:** https://forum.kirupa.com/t/why-wont-my-ship-shoot/284664
**Category:** flash
**Created:** [March 21, 2009, 10:27pm UTC](https://forum.kirupa.com/t/why-wont-my-ship-shoot/284664 "2009-03-21T22:27:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Dirge](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Dirge](https://forum.kirupa.com/u/Dirge)
#### Post date: [March 21, 2009, 10:27pm UTC](https://forum.kirupa.com/t/why-wont-my-ship-shoot/284664/1 "2009-03-21T22:27:26Z")

</div>

Greetings everyone, I’m making a game based off of space invaders and teaching myself how to code in the process.

Here is the current code for my ship:

onClipEvent (enterFrame) {  
var speed = 9;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.LEFT)) {  
\_x -= speed;  
\_rotation = -15;  
} else {  
if (Key.isDown(Key.RIGHT)) {  
\_x += speed;  
\_rotation = 15;  
} else {  
\_rotation = 0;  
}  
}  
}  
onClipEvent (enterFrame) {  
if (this.\_y\>378) {  
this.\_y = 378;  
}  
if (this.\_y\<0) {  
this.\_y = 0;  
}  
if (this.\_x\>374) {  
this.\_x = 374;  
}  
if (this.\_x\<25) {  
this.\_x = 25;  
}  
}

and here is the code I placed on a separate layer on the time line for my ship to fire bullets, this code was written for me by a friend who told me what each snippet does. I don’t get an error message, but it doesn’t work. Can anyone tell me why?

i = 1;  
if (Key.isDown(Key.UP)) {  
\_root.attachMovie(“bullet”, “bullet”+i, i);  
\_root[“bullet”].onEnterFrame = function() {  
this.\_y–;  
};  
}

Thanks in advance guys!
