S
s0ngbirdd
Guest
I have a program when an obj_pawn move (when key released) on one square towards wall and when obj_pawn is next to wall it will destroy and then when i released a key the obj_pawn respawns again and do the same thing again.
So, I have an object of obj_pawn and it works great. But when i create more than 1 instance of obj_pawn works only 1rst. Others have just destroyed and dont respawn again.
CODE:
obj_pawn:
create_event:
move = 0;
step_event:
if keyboard_check_released(1) && instance_exists(obj_pawn) && move == 0 {
if place_meeting(x, y + 64, obj_player){
game_restart();
}
if !place_meeting(x,y + 64, obj_wall) {
y += 64;
}
else if place_meeting(x, y + 64, obj_wall) {
move = 1
}
}
if move == 1 {
alarm[0] = 1;
}
alarm[0]_event:
instance_destroy(obj_pawn);
move = 0;
obj_game (transparent object):
create_event:
xprr = obj_pawn.xstart;
yprr = obj_pawn.ystart;
step_event:
if keyboard_check_released(1) && !instance_exists(obj_pawn)
{
instance_create_layer(xprr,yprr,"Instances",obj_pawn);
}
So, I have an object of obj_pawn and it works great. But when i create more than 1 instance of obj_pawn works only 1rst. Others have just destroyed and dont respawn again.
CODE:
obj_pawn:
create_event:
move = 0;
step_event:
if keyboard_check_released(1) && instance_exists(obj_pawn) && move == 0 {
if place_meeting(x, y + 64, obj_player){
game_restart();
}
if !place_meeting(x,y + 64, obj_wall) {
y += 64;
}
else if place_meeting(x, y + 64, obj_wall) {
move = 1
}
}
if move == 1 {
alarm[0] = 1;
}
alarm[0]_event:
instance_destroy(obj_pawn);
move = 0;
obj_game (transparent object):
create_event:
xprr = obj_pawn.xstart;
yprr = obj_pawn.ystart;
step_event:
if keyboard_check_released(1) && !instance_exists(obj_pawn)
{
instance_create_layer(xprr,yprr,"Instances",obj_pawn);
}