T
ThatAussieKiwi
Guest
Hello,
I am trying to make a shield that spawns into the PlayerLayer when left mb is pressed and while left mb is pressed follow the player, basically mimicking player movement. But instead the shield stays in the same place where it was first spawned until left mb is released when the instance is destroyed.
My code:
if (mouse_check_button(mb_right)) {
if instance_exists(obj_PlayerSheild)
{
x = obj_PlayerShip.x;
y = obj_PlayerShip.y;
}
else {
instance_create_layer(x, y, "PlayerLayer", obj_PlayerSheild);
}
}
if (mouse_check_button(mb_right) = false) {
instance_destroy(obj_PlayerSheild);
}
Once again, thank you for all your help!
I am trying to make a shield that spawns into the PlayerLayer when left mb is pressed and while left mb is pressed follow the player, basically mimicking player movement. But instead the shield stays in the same place where it was first spawned until left mb is released when the instance is destroyed.
My code:
if (mouse_check_button(mb_right)) {
if instance_exists(obj_PlayerSheild)
{
x = obj_PlayerShip.x;
y = obj_PlayerShip.y;
}
else {
instance_create_layer(x, y, "PlayerLayer", obj_PlayerSheild);
}
}
if (mouse_check_button(mb_right) = false) {
instance_destroy(obj_PlayerSheild);
}
Once again, thank you for all your help!