Começe com os sprites
vc precisa de sprites:
Inimigo:
inimigo_parado
inimigo_andando
inimigo_pulando
inimigo_kunai
agora crie os objetos:
obj_inimigo:
CREATE/CODIGO:
image_speed = 0.2;
gravity_direction = 270;
dir = choose(1,-1)
seen = 0
canshoot = true
hp = 5
sightdistance = 200
sightheight = 40
wspeed = 1.5
knifing = 0
scared = 0
ALARM 0/ CODIGO:
canshoot = true
STEP / CODIGO:
if (place_free(x, y + 1))
{
gravity = 0.5
;}
else
{
gravity = 0;
}
vspeed = min(12, vspeed);
if seen = 0{
movment()
jump()
}
if scared = 0{
if seen = 1{
if knifing = 0{shooting()}
knife()
}
}
if hp<2 {scared = 1}
if scared = 1{
movment()
run_away()
jump()
}
if hp = 0{instance_destroy()}
if scared = 0{
if distance_to_object(obj_player) < sightdistance {seen = 0 // and the player is out of sight, we cant se them
if obj_player.x>x then {dir = 1}
if obj_player.x}
}
COLISION -obj_block-/ CODIGO
if (vspeed > 0 && !place_free(x, y + vspeed))
{
move_contact_solid(270, 4);
}
vspeed = 0;
COLISION -obj_tiro_player- / CODIGO
seen = 1
hp -=1
COLISION -obj_dir_change- (se não tiver crie) / CODIGO
if scared = 0{
if dir = 1 {dir = -1}
else
if dir = -1 {dir = 1}
}
Animation end / CODIGO
if sprite_index = bad_guy_knife {knifing = 0}
sprite_index = bad_guy_stand
DRAW / CODIGO
draw_sprite_ext(sprite_index,image_index,x,y,dir,image_yscale,image_angle,image_blend,image_alpha)
if scared = 0{
scr_EnemyView(sightheight,sightdistance);
}
o inimigo ta pronto!
os objetos tem que ja estarem feitos
té +