• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

help making more than one enemy

1213brett

Member
Hi I have more than one enemy called goblin and its almost like they take turns moving and attacking I don't know how to make them attack and move at once.

in create event of other object
globalvar grid;
grid = mp_grid_create(0, 0, room_width div 16, room_height div 16, 16, 16);
mp_grid_add_instances(grid, wall, true);





in goblin create event

global.goblinpath = path_add();
WalkUp=true
Attack=false


in goblin step event

depth=-y
if( abs(angle_difference(-90, direction)) > 90){
WalkUp = true
}else{
WalkUp = false
}
if( abs(angle_difference(180, direction)) < 90){
FaceLeft = true
}else{
FaceLeft = false
}
if x<= player.x+3 and x>= player.x-3 and y<=player.y+3 and y>= player.y-3 Attack = true else Attack = false

if mp_grid_path(grid,global.goblinpath, x, y, player.x, player.y, 0)
{
path_start(global.goblinpath, 1, 0, 0);
}


in goblin draw event

if Attack = false && WalkUp = false && FaceLeft=false draw_sprite_ext(sprite8,-1,x,y,1,1,0,c_white,1)
if Attack = false && WalkUp = true && FaceLeft=false draw_sprite_ext(sprite81,-1,x,y,1,1,0,c_white,1)
if Attack = false && WalkUp = false && FaceLeft=true draw_sprite_ext(sprite8,-1,x,y,-1,1,0,c_white,1)
if Attack = false && WalkUp = true && FaceLeft=true draw_sprite_ext(sprite81,-1,x,y,-1,1,0,c_white,1)

if WalkUp = false && FaceLeft=false && Attack = true draw_sprite_ext(sprite82,-1,x,y,1,1,0,c_white,1)
if WalkUp = true && FaceLeft=false && Attack = true draw_sprite_ext(sprite821,-1,x,y,1,1,0,c_white,1)
if WalkUp = false && FaceLeft=true && Attack = true draw_sprite_ext(sprite82,-1,x,y,-1,1,0,c_white,1)
if WalkUp = true && FaceLeft=true && Attack = true draw_sprite_ext(sprite821,-1,x,y,-1,1,0,c_white,1)
 
Top