toggle menu
Categories
Discussions
Dashboard
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Dashboard
Sign In
·
Register
×
Home
›
GameSalad 101
›
Working with GS (Mac)
Where was that enemy radius detection example?
TouchTiltGames
Member
Posts:
1,162
August 2010
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
firemaplegames
Member
Posts:
3,211
August 2010
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]
TouchTiltGames
Member
Posts:
1,162
August 2010
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
scitunes
Member, Sous Chef
Posts:
4,047
August 2010
In the above example what does game.bombRadiusX represent?
Do you have game.bombRadiusX constrained to the x position of something?
TouchTiltGames
Member
Posts:
1,162
August 2010
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.
Comments
magnitude is used like this:
myMagnitude = magnitude(Actor1.X - Actor2.X , Actor1.Y - Actor2.Y)
Rule
When myMagnitude < [some number]
-----[do something]
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
Do you have game.bombRadiusX constrained to the x position of something?
game.bombRadiusX to: self.positionx
game.bombRadiusY to: self.positionY
Still isn't working hmm..good thing I bought Photics GS book