Enemy Shooting Back

CAmaninacanCAmaninacan Member Posts: 11
edited November -1 in Working with GS (Mac)
How do you make a enemy shoot at you and you lose one life if it hits you. And how do you make it rotate itself, so it can face you and shoot at you?

Thanks

Comments

  • KamazarKamazar Member Posts: 287
    I'll help you out this time, but reading the Wiki is really worth it. You might not understand my instructions if you don't at least skim it.

    1) First, constrain two real attributes in the game attributes section to the X and Y position of your character. Have the bullet/laser/whatever either accelerate or move to those positions. Then create an integer attribute also in game attribute section with the number of lives you want as the value. Every time the bullet collides with your character, change the attribute to "game.lives -1). I recommend setting up a controller (an invisible, unmovable, uncollidable actor) to take care of this.

    2) Simply use the same two attributes used to track your character's position and plug them in the "Rotate To" behavior.
  • CAmaninacanCAmaninacan Member Posts: 11
    Thanks for that Kamazar, I got the rotating and shooting to work but not the lives, when I put change attribute game.lives to -1 whenever the actor gets hit it changes lives to -1? Also when lives reach zero how do you make it change scene?

    Thanks
  • KamazarKamazar Member Posts: 287
    Kk, set up a rule that says:

    When "game.Lives" is less than 1
    Change scene to "Game Over".

    That'll change the scene when you run out of lives.

    And under the Lives attribute, you set the value to something over 0, right?
  • CAmaninacanCAmaninacan Member Posts: 11
    Ya it is over 0.
  • CAmaninacanCAmaninacan Member Posts: 11
    Never mind I just figured it out I looked into one of the other templates thanks for all of your help.
  • KamazarKamazar Member Posts: 287
    Ooooh, I see what you did. No, don't change game.Lives to just -1. Change (game.Lives) to (game.Lives-1).
Sign In or Register to comment.