Under rating threshold (hideshow)
Ok my ship is killing the enemy ships, but now my missiles will only kill some of the ships... Roughly 1 in every 6 enemy ships will be hit by my bullet. The rest wont...
Under rating threshold (hideshow)
To everyone complaining about hitTest not working: make sure to define your explode function OUTSIDE of the onEnterFrame function. Should look like this. class EnemyShip extends MovieClip {
var speed;
function explode() {
this.removeMovieClip();
}
function onLoad() {
_x = 700;
_y = Math.random()*200+50;
speed = Math.random()*5+5;
}
function onEnterFrame() {
_x -= speed;
if (_x<=-100) {
this.removeMovieClip();
}
if (this.hitTest(_root.ship)) {
explode();
}
}
}
Under rating threshold (hideshow)
To anyone concerned about collision detection - be careful with naming and targetting correctly.
You may use targetPath ( http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001827.html ). I've had similar problem.
Under rating threshold (hideshow)
i dont get it...
my code it perfect but they arnt dissapearing when i run into or shoot them...
they just fly over me
Under rating threshold (hideshow)
I lol'd, when every programming was done, i tested the movie. What happend? The enemies came flying normal, but then they shot a missile and they suddenly exploded. There was also a white missile of mine in front of them, even if i hadn't shot any missiles.
Under rating threshold (hideshow)
mustard, if your explode() function wont work, make sure to create that function in the enemy ship's class. go outside the onFrameEnter block and type function explode() and braces with code in it. this.removeMovieClip() only deletes it. AND STOP ADVERTISING THE EFFING SITE! I DONT GIVE A FLYING *is cut off because of profanity*
Under rating threshold (hideshow)
When i did:
if(this.hitTest(_root.ship))
{
explode();
}
the enemy ships wouldnt disappear when i crashed into them. If you are having the same problem, try writing this command instead:
if(this.hitTest(_root.ship))
{
this.removeMovieClip();
}
It worked for me. Using the above command, the part where you create the function "explode()" won't be needed.
Under rating threshold (hideshow)
Hey guys, I have completed this game and its works perfectly. But when I try to use the same sort of code for another game the collision detection doesn't work. It only detects the first object enemy or object wall in the array and no other. Can please help me out? :D I start off stating the array.
Under rating threshold (hideshow)
Right. None of the missiles were hitting the ships and disappearing but i managed to get the enemy missiles to disappear. Anyone got any suggestions concerning hero missiles as i can't find any problems with it. I'll keep trying. Thanks.
Under rating threshold (hideshow)
I'm stuck on page 10 :-\
my missiles fly right through the enemies, the missile hitTest doesn't seem to be doing it's job.
any suggestions?
Under rating threshold (hideshow)
I followed everything exactly the way the tutorials said, all of the way up to the health bars and the scores, but after adding those then every time I destroy an enemy ship then it destroys all of them on the screen... Its so annoying and I have back tracked to check the codes and everything is exactly the way it should be... Does anyone know how to fix this?
Under rating threshold (hideshow)
I added a function in the EnemyShip class, which removes the EnemyShip from the enemies array in the Ship class, when it is destroyed or moves out of scope. This can make a difference in performance if you use big arrays.
Here' the function:
function removeFromArray()
{
for(var i in _root.ship.enemies)
{
if(this == _root.ship.enemies[i])
{
_root.ship.enemies.splice(i,1);
}
}
}
Add it somewhere in the EnemyShip class and execute it when the ship is destroyed or moves left out of the stage.The splice(a,1) function removes 1 object on the a-th position from an array.
Since I'm new to Flash a pro should take a lot at this and correct me if I'm wrong.
Under rating threshold (hideshow)
Fantastic tutorial , but may be there is one error : "right click on the explosion clip in the library and choose : Linkage" , I think "properties".
Under rating threshold (hideshow)
For ppl having trouble with page 2 and changing instance name, if ur layer Ship also then either rename the Ship something else or the layer. The reason its not working is because it's using the layer name "Ship" instead of the movie clip. I just change the instance name to something else and it works fine.
Under rating threshold (hideshow)
on every shootorial, almost all of the comments are "OMG HELP ME I CAN"T FIGURE THIS OUT!" or something. I have only had 1 trouble, and that was figuring out how to make an explosion animation, but i figured it out, so you people need to stop complaining and figure it out yourself.
Under rating threshold (hideshow)
For some reason, the enemy ships are exploding when I run into them, but not when my missiles hit them. If you have any idea why this is happening, then please send me a message. Thanks!
Under rating threshold (hideshow)
hey, can someone help me? Im having a problem in page 2. When i name the hero ship instance "ship", in the root timeline, it looses all of the functions and properties ive add in the past tutorials. Im using flash cs4, idk if thats the problem.. If anyone knows how to solve please pm(message) me or leave a comment. Also, sorry for the bad english, im not a native speaker. Thx =)
Under rating threshold (hideshow)
this is SPARTAAAAA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Under rating threshold (hideshow)
hey, i am stuck on pg 5, it says to right click on the clip in the library and choose "linkage..." nut it isnt there....
Under rating threshold (hideshow)
OMG LOL OMG LOL!!!!! Ignore my other comments...
Guess what? the HitTest... instance name is Ship... i put _root.ship WTF is wrong with me? :)
Under rating threshold (hideshow)
Still stuck on trying to make the hero's ship missiles to hit and explode the enemies, i check all the coding and i see no mistakes any help? i using cs5
Under rating threshold (hideshow)
I just noticed that when you change the EnemyShip code to for the EnemyMissile, the code changes the y that the enemy appears from back to: *300, when you have changed it to *200 + 50 in a previous Shootorial. Hope this helps someone.
Under rating threshold (hideshow)
In step 10 I got boned for a couple hours because I didnt see that there is a space after 'in', before '_root.ship.enemies' in line 14. So I researched for hours learning about basic for statements and advanced for statements, which this is. So thats the plus side. On the negative side, I'm a total moron lol :P
Under rating threshold (hideshow)
Nvm, I got it to work with AlmightyGERM's advice... I had to make the instance name differ from the class name. Strange world o.o Maybe it's because I'm using cs5 lol
Under rating threshold (hideshow)
When I add the instance name to the ship everything stops working except my background. Many other people having the same problem but those many other people have many different solutions :(