C
CrackedGamer§
Guest
I need help with the enemy AI in a top-down game I am working on. I want them to collide with obj_solid and walk around it on collision.
All code I have at the moment is:
Create:
Step:
Alarm0:
Collision (obj_sword):
All of this is in the object called obj_enemy_wolf but I want it to be useable with any enemy I create with the same movement (except speed and other minor changes that I can manage myself). Thank you Bayesian for showing me the code blocks.
All code I have at the moment is:
Create:
Code:
enemyspd=5
spotted = false
Code:
//Pause After Attack
if(place_meeting(x, y, obj_player)) {
enemyspd = 0;
alarm[0] = 30;
}
else if(alarm[0] == 0) {
enemyspd = 5;
}
//Attack Player
if(spotted=true){
script_execute(scr_attack_player());
}
//Spotting The Player
if(place_meeting(x, y, obj_enemy_detection_range)){
spotted = true;
global.inbattle = true;
} else{
spotted = false;
global.inbattle = false;
}
Code:
enemyspd = 5;
Code:
global.inbattle = false
instance_destroy();
Last edited by a moderator: