B
Bengs
Guest
Hello everybody i need a lot of help with my enemy code.
1) my enemy is a little buggy when hitting the floor
2) when my enemy is in patrol it wont even hit te floor it wil just float in 1 position
3) my enemy will always hit my character can i somehow randomize that process
4) When in patrol is ther a way to see what checkpoint it has hit so i can put walking animations in the right direction
1) my enemy is a little buggy when hitting the floor
2) when my enemy is in patrol it wont even hit te floor it wil just float in 1 position
3) my enemy will always hit my character can i somehow randomize that process
4) When in patrol is ther a way to see what checkpoint it has hit so i can put walking animations in the right direction
Code:
player_x = Obj_Character.x;
player_y = Obj_Character.y;
//moving
if (point_distance(x,y,player_x,player_y) < 100) {
path_end();
mp_potential_step_object(player_x, player_y, walksp, par_envirement)
if player_x < x {
image_speed =2/1.5;
sprite_index = Spr_BasicKnightWalkLeft;
} else if player_x > x {
image_speed =2/1.5;
sprite_index = Spr_BasicKnightWalkRight;
}
} else if(path_index !=path_patrol) {
mp_potential_step_object(start_x, start_y, walksp, par_envirement)
if start_x < x {
image_speed =2/1.5;
sprite_index = Spr_BasicKnightWalkLeft;
} else if start_x > x {
image_speed =2/1.5;
sprite_index = Spr_BasicKnightWalkRight;
}
if start_y < y {
vsp = -3;
vsp = vsp + grv
y = y + vsp
image_speed = 0;
image_index = 0;
}
if (abs(x-start_x) < 2 and abs(y)) {
path_start(path_patrol, 2, path_action_restart, false);
}
}
//Vertical Movement
vsp = vsp + grv
y = y + vsp
if (place_meeting(x,y+vsp,par_envirement))
{
while (!place_meeting(x,y+sign(vsp),par_envirement))
{
y=y+sign(vsp);
}
vsp = 0;
}
hsp = facing_way * walksp;
//attack system
if (place_meeting(x+1,y,Obj_Character)){
hsp = 1;
x = x + hsp;
image_speed = 2;
sprite_index = Spr_BasicKnightAttack01Right;
Edmg = 25;
if (image_index > image_number - 1){
attack = 0;
Edmg=0;
}
}
if (place_meeting(x-1,y,Obj_Character)){
hsp = 1;
x = x - hsp;
image_speed = 2;
sprite_index = Spr_BasicKnightAttack01Left;
Edmg = 25;
if (image_index > image_number - 1){
attack = 0;
Edmg=0;
}
}