bullet kills all actors at once why?

guillefaceguilleface Member Posts: 1,014
edited November -1 in Working with GS (Mac)
i copy 20 enemies of the same on the scene, on bullet i have a rule, when collide with enemy change attribute game.killenemy to game.killenemy+1
so in the enemy i have a rule, when attribute game.killenemy=3, destroy this enemy but if i hit one emeny, then another, on the third hit all of the enemy are destroyed, what i want is to destroy one enemy when is hit 3x

Comments

  • butterbeanbutterbean Member Posts: 4,315
    Are you using a global game attirbute game.killenemy to destroy your actors?

    If you want the enemies to be destroyed after 3 hits, you need to create self.attributes to track how many times they are hit.

    So in the enemy actor, create a self.attribute, and call it "health", and make it 3 (integer) put a rule that says, when overlaps or collides with bullet, change self.health to self.health -1

    Then put a rule, when self.health < or = to 0, destroy this actor

    Then if you want to track how many enemies are killed, create a global game attribute (integer) called "EnemiesDestroyed"

    Make a rule in each enemy that says when they're destroyed, to change game.enemiesdestroyed to game.enemiesdestroyed to +1 that way you can track how many enemies were destroyed, and keep a scoring system, you can change the +1 to any number, like +10, or +100, whatever you like to create a scoring system

    Hope this makes sense
  • guillefaceguilleface Member Posts: 1,014
    yes i was using game.attribute i never thought about self attribute thank thank you very much is working great, just one more thing if is not to much to ask, i open the allien conquerors template, but i cant figure out how the allien do the left and right move, i think somethig is missing on the otherwise,all i see is is "move" direction 0 , iam working on a similar game and thats the basic and most important move, if i cant do it i cant keep going on my game :( and thank you again
  • butterbeanbutterbean Member Posts: 4,315
    On the alien template, look at the Right and Left Wall actors, and that will explain how it triggers the aliens to move back and forth :) The wall actors are controlling the move direction, which control when the aliens move.

    Let me know if you need any more help!
  • guillefaceguilleface Member Posts: 1,014
    i checked too but all i understand was only for changing the attribute which i was right, but i find what i was missing, in the otherwise rule, i thought in move 0 direction means to move to the right, which i thought i was missing the rule for left , but now i can see that speed is the one changing the direction as when movedirection = -1 that makes speed to -90 so it moves left, wow that was so tricky guys but fun :) , thanks a lot butterbean i really i appreciate your help
  • butterbeanbutterbean Member Posts: 4,315
    Yeah it is a bit tricky, but once you look at it, it makes sense, good luck!
Sign In or Register to comment.