Multiple actors walking into a wall, how to decrease wall hp while touching?

QuestionManQuestionMan Member Posts: 81
edited August 2012 in Working with GS (Mac)
I know this doesn't sound right but right now when I have a monster walk into my wall, I want the walls hp to go down 1 every 1 second. I also have several monsters that I want this capability of.

My problem is that I'm using 'when wall overlaps/touches monster' then do such and such...However, this isn't a constant attribute like I thought it would be, so it will only happen just once, and will not trigger the timer.

(To test this, I changed the trigger to mouse down, and the timer would only be activated as long as I was touching the image)

So I thought about using a boolean that will trigger when it first touches, which makes sense, but the problem comes when the 2nd or the 3rd monster come here too. So the boolean can't be used.

Any ideas? Points for simplicity as always!

FYI all of the monsters are from the same actor, and there will be many more than just 3

Answers

  • QuestionManQuestionMan Member Posts: 81
    OK so I just realized that I can use a boolean inside the actor and it will be unique for each instance of that actor, is that correct?
  • QuestionManQuestionMan Member Posts: 81
    I guess I figured it out on my own after trying several different ways. If anyone else needs to know, this is a summary:

    I had an index on the monster actor that was 0 if walking and changed to 1 if it touched the wall. I put a timer in the monster that every 1 second it does HP (a global variable) -1.

    This seems to work and sounds incredibly easy. My understanding of the actors being copied isn't up to speed I guess. Thanks for looking guys.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    what you can also do is add enemy tag to different monsters and when the enemy tag collides with the wall, it goes -1, this way you might not need to make it local to each monster, you can handle globally without putting the code in each monster.
  • QuestionManQuestionMan Member Posts: 81
    are the tags in the professional version of GS only? I'm not familiar with them
Sign In or Register to comment.