Hey guys.
Heres the skinny.
I'm make a game where the player is displayed as a picture at x,y coordinates.
No problem.
next, as he gets close to other pictures, they are repelled by the player.
Again, no problem.
To do this, I have an event set on Parallel process running a call script to controll each enemy picture that says
$game_variables[@event_id] = enemies picture X coordinate
$game_variables[@event_id + 50] = enemies picture Y coordinate
$game_variables[1] = Players X
$game_variables[2] = Players Y
now my question is this. I would like to add the magnetic effect so that enemies repel eachother as well.
So, is there a method, and how would I implement it, that would check to see if a picture is within 30 pixels of another picture, and if it is, add/subtract to the correct variables so they are repelled?
Thanks!
Heres the skinny.
I'm make a game where the player is displayed as a picture at x,y coordinates.
No problem.
next, as he gets close to other pictures, they are repelled by the player.
Again, no problem.
To do this, I have an event set on Parallel process running a call script to controll each enemy picture that says
where:[conditonal event-Script]
($game_variables[@event_id] - $game_variables[1]).abs <= 30
and
($game_variables[@event_id + 50] - $game_variables[2]).abs <= 30
then... repel enemy picture. by adding/subtracting 1 from the enemies x/y depending on where they are in relation to the player.
[end]
$game_variables[@event_id] = enemies picture X coordinate
$game_variables[@event_id + 50] = enemies picture Y coordinate
$game_variables[1] = Players X
$game_variables[2] = Players Y
now my question is this. I would like to add the magnetic effect so that enemies repel eachother as well.
So, is there a method, and how would I implement it, that would check to see if a picture is within 30 pixels of another picture, and if it is, add/subtract to the correct variables so they are repelled?
Thanks!