GML Minimap to show enemies

I am creating a minimap for the game I am working on.
I have set up a minimap square 1 tenth of the size of the room. I have a smaller version of the player moving at the player's position/10.
That works fine but since I have multiple enemies this doesn't work for the enemies. Any ideas? Thanks!
 

Simon Gust

Member
It does work if you use a with statement instead of enemy.x/10 and enemy.y/10
Code:
with (obj_enemy)
{
    draw_sprite(sprite_index, image_index, x/10, y/10);
}
If you have multiple of an instance, don't refrence the object name as it will automatically take the latest enemy created while the other ones are ignored.
 
It does work if you use a with statement instead of enemy.x/10 and enemy.y/10
Code:
with (obj_enemy)
{
    draw_sprite(sprite_index, image_index, x/10, y/10);
}
If you have multiple of an instance, don't refrence the object name as it will automatically take the latest enemy created while the other ones are ignored.
Thanks!
 
C

create_event@

Guest
Each enemy that is running the code will show on the minimap. Neat little trick, I wouldn't have thought of it.
 

flerpyderp

Member
Each enemy that is running the code will show on the minimap. Neat little trick, I wouldn't have thought of it.
The enemies are not running that code, it is run from another object, and the "with" statement simply references all instances of the enemy object that currently exist in the room.
 
C

create_event@

Guest
The enemies are not running that code, it is run from another object, and the "with" statement simply references all instances of the enemy object that currently exist in the room.
Right. I probably should have used a better wording.
 
Top