# Another airplane problem

**URL:** https://forum.kirupa.com/t/another-airplane-problem/26251
**Category:** flash
**Created:** [July 21, 2003, 1:40pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251 "2003-07-21T13:40:17Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![luster](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@luster](https://forum.kirupa.com/u/luster)
#### Post date: [July 21, 2003, 1:40pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/1 "2003-07-21T13:40:17Z")

</div>

Does anyone know why the score is going mad in the beginning of the movie? Sorry about the messy code.

PS = The gotoandplay (2) in the “enemy” code is a frame that hasn’t been made yet. But I don’t think that influences the problem.

---

<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: [July 26, 2003, 8:37am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/2 "2003-07-26T08:37:45Z")

</div>

Anyone?

---

<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: [July 27, 2003, 10:27am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/3 "2003-07-27T10:27:44Z")

</div>

still stuck? i think i figured it out. In your laser movieclip, i changed the ‘for’ part to this:

[AS]  
for (j=1; j\<=\_root.numEnemy; j++) {  
if (this.hitTest(\_root[“enemy”+i])) {  
\_root.score += 10;  
\_root[“enemy”+i].gotoAndPlay(2);  
this.removeMovieClip();  
}  
}  
[/AS]

well as you can see, its basically the same except i changed ‘i’ to ‘j’. I think the problem was you had another thing which used ‘i’ as a variable.

Oh ya, you should put all your code on the same keyframe, so its much easier to handle in the future 🙂

---

<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: [July 27, 2003, 12:33pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/4 "2003-07-27T12:33:49Z")

</div>

? The score’s normal now, but it doesn’t hitTest.  
It just passes by???

---

<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: [July 27, 2003, 1:24pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/5 "2003-07-27T13:24:55Z")

</div>

What doesn’t hitTest? the bombs and the house thing? it does for me…

---

<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: [July 27, 2003, 1:33pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/6 "2003-07-27T13:33:54Z")

</div>

The lasers and helicopters don’t.

---

<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: [July 27, 2003, 1:51pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/7 "2003-07-27T13:51:43Z")

</div>

well i edited it it works now but what it was i think j was already in use i done k and it worked fine

---

<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: [July 27, 2003, 2:01pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/8 "2003-07-27T14:01:55Z")

</div>

Tried K too… Can you post the edited .fla?

---

<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: [July 27, 2003, 2:08pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/9 "2003-07-27T14:08:41Z")

</div>

yeah gimme a minute

---

<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: [July 27, 2003, 2:10pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/10 "2003-07-27T14:10:13Z")

</div>

well the fla i downloaded from you din’dt do anything on hitTest with the plane and the helicoptor…

---

<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: [July 27, 2003, 2:12pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/11 "2003-07-27T14:12:36Z")

</div>

here it is

hope this is what you wanted (if not tell me and ill try again)

---

<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: [July 27, 2003, 2:31pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/12 "2003-07-27T14:31:23Z")

</div>

It says " Unexpected file format" .  
Maybe post the whole code for the laser, that’ll work I guess…

---

<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: [July 27, 2003, 3:43pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/13 "2003-07-27T15:43:45Z")

</div>

hi sorry i dint respond sooner (i was making a game of my own) but here it is

onClipEvent (load) {

laserMoveSpeed=20;

this.\_y=\_root.vliegtuigje.\_y;  
this.\_x=\_root.vliegtuigje.\_x+20;

}  
onClipEvent (enterFrame) {  
this.\_x+=laserMoveSpeed;  
if (this.\_x\>600){  
this.removeMovieClip();  
}  
for (k=1; k\<=\_root.numEnemy; k++){  
if (this.hitTest( \_root[“enemy”+k])){  
\_root.score+=10;  
\_root[“enemy”+k].gotoAndPlay( 2 );  
this.removeMovieClip ();  
}

}  
}

hope this helps

---

<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: [July 28, 2003, 6:22am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/14 "2003-07-28T06:22:09Z")

</div>

First , thanks for the reply. But it still doesnt work! Now it hittests, but the score goes weird again in the beginning.

---

<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: [July 28, 2003, 6:52am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/15 "2003-07-28T06:52:35Z")

</div>

what did you want to happen when the planes hit each other? because nothing ever happend in your first file nor this one…

change \_root[“enemy”+k] to:

\_root[“enemy”+i] and the score doesn’t go weird…

---

<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: [July 28, 2003, 6:57am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/16 "2003-07-28T06:57:36Z")

</div>

The planes and helicopters, dont have to hittest, but the helicopters have to with the lasers (press SPACE)

---

<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: [July 28, 2003, 7:20am UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/17 "2003-07-28T07:20:03Z")

</div>

sorry don’t know, but you needa organize your whole thing. Your code is EVERYWHERE. It would be easier to identify the problem if it wasn’t all spread out…

---

<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: [July 28, 2003, 2:25pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/18 "2003-07-28T14:25:40Z")

</div>

I know but it’s spread, but I’m trying to do all my code (until the fla is finished ) and then organize it.

PS= Anyone can solve it?

---

<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: [July 28, 2003, 2:46pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/19 "2003-07-28T14:46:29Z")

</div>

i know, but if you’re stuck then why not just organize eveything to find the problem so its easier for us and you?? It’ll be a pain to find it with the mess now…

---

<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: [July 28, 2003, 2:56pm UTC](https://forum.kirupa.com/t/another-airplane-problem/26251/20 "2003-07-28T14:56:31Z")

</div>

yes thats true… the spaghetti code is very messy and its mind boggling

[Next page](https://forum.kirupa.com/t/another-airplane-problem/26251.md?page=2)
