I’m doing a game (supposed to be done tomorrow).
In this game I’ve got a hero who throws books at the enemies.
When the book hits the enemy, I want the book to dissapear, but the thing is that it contiues to fly straight ahead and kill all the other enemies too. I’ve got a really huge source code for the game, but this part wouldn’t be too hard to do, would it?
So I’ve put this piece of code inside the book’s movieclip.
onClipEvent (enterFrame) {
this._x += bokSpeed;
for (i = 0; i < 3; i++) {
if (this.hitTest(_root.tomt["fiende"+i])) {
// This part seems not to work. WHY????
this.removeMovieClip();
_root.tomt["fiende"+i].play();
}
}
Please help me today. I really need to get this game ready for tomorrow…
Actually I’ve tried both and right now I’m using attachMovie. So how should I write the script for removing the book mc that hit the enemy?
The attachMovie code goes here:
Thank you very much. Just that you’re taking the time and look through it. Take your time =) Btw… Sorry for all the variables and comments. It’s in swedish…
Haha… Yeah I know… Pretty confusing it is… Well here’s the deal
In the first frame in _root I create the map, place the player and the enemies.
In the mc “evald” (which is the player) i have the code for walking in the first frame. In this movieclip I also attach the book mc on line 35 or something… I’ve linked the mc called “boken” as “bok” so that’s the mc which is attached. In “boken” I’ve put the mc “bok” with some script in it.
If you select the player in the mc evald, I’ve got some code to check if he hits an enemy.
It’s pretty hard to know exactly where all the mc’s are positioned because I attach them inside other mc’s all the time. It IS really confusing… But this is my first game ever so…