Where was that enemy radius detection example?

TouchTiltGamesTouchTiltGames Member Posts: 1,162
edited November -1 in Working with GS (Mac)
I think Tshirtbooth had it up somewhere, it was to demo - if an actor or bullet was close to an enemy radius it would react to it....Anyone know where that is?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    The distance between two points is called 'magnitude'. I have a magnitude demo on my wall that you can look through.

    magnitude is used like this:

    myMagnitude = magnitude(Actor1.X - Actor2.X , Actor1.Y - Actor2.Y)

    Rule
    When myMagnitude < [some number]
    -----[do something]
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Hey FMG, Thanks a lot yeah I saw your demo it's cool but a little to complex for me at this point lol. This is what I have:

    On the Actor:

    When game.bombClose = 1

    Change attribute: game.bombClose to: magnitude( game.bombRadiusX - self.Position.X , game.bombRadiusY - self.Position.Y )

    When game.bombClose > 100
    Play Sound

    On the Bomb:

    When game.bombClose = 1
    game.bombRadiusX to: self.positionx
    game.bombRadiusY to: self.positionY

    Doesn't seem to be working for me :(
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    In the above example what does game.bombRadiusX represent?
    Do you have game.bombRadiusX constrained to the x position of something?
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Oh ok, On the bomb I constrained

    game.bombRadiusX to: self.positionx
    game.bombRadiusY to: self.positionY

    Still isn't working hmm..good thing I bought Photics GS book :)
Sign In or Register to comment.