GameMaker: Studio

GameMaker: Studio

View Stats:
Smakdude Oct 26, 2014 @ 8:58am
Enemy shooting when facing player
Hi I am working on a game witch has 4 directional movement and independent mouse aiming. I have enames that shoot in agine 4 directions but I whanna know how to make theme shoot only when thay see the player.
< >
Showing 1-1 of 1 comments
Daynar Oct 26, 2014 @ 10:58am 
What factors do you have? Are there walls, can enemies shoot through each other, do they have a max range, do they only check the direction they are facing or do they turn to fire in the direction of the player, and finally do they only fire when the enemy is lined up with the player, or should it fire when the player is in an arc or 'collum' of the enemies sight?

Assuming you want them to shoot only when they see a player, but have no other restrictions or turning
if collision_line(x,y,oPlayer.x,oPlayer.y,/* objects that may block view */,false,true) = noone { //shoot }
< >
Showing 1-1 of 1 comments
Per page: 1530 50

Date Posted: Oct 26, 2014 @ 8:58am
Posts: 1