GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

problem with making a magnet (distancefrom)

sparx13sparx13 Posts: 97Member
edited August 2012 in Working with GS (Mac)
HI I have followed Distance between Actors video by T shirt booth but the distance from attribute did not work right.
I have an enemy actor that spawns every 5 seconds or so. and I also have an actor that I control to destroy the enemies.
So i was following his video and when I tested the distance between the two two actors. The distance from is displayed on the enemy. But when the enemy spawns it shows the distance from at the time it spawns but as it gets closer it does not change.
Any help with this would be awesome thanks.
btw I'm making a magnet

Best Answer

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    edited August 2012 Accepted Answer
    Make two real game level attributes. Call one enemy x and enemy y. This assumes you only spawn one enemy to track on screen at any given time. In your enemy actor use two constrain attributes as you're spawning be sure you edit the actor in the actors palette and not one you may have on the stage. Constrain the enemies self x & y to the real game level attributes. In your player actor monitor the game level attributes of your enemy to get the distance from.

Answers

This discussion has been closed.