31
Programming Questions / Spawning attack by player x and set y?
« on: December 31, 2015, 02:01:07 AM »
So I am trying to create a boss attack that spawns a sword that shoots up out of the ground and then goes back down. I want it to spawn under the players current position and along the y access of the floor. So I set up an alarm that calls it like so.
if (instance_exists(objPlayer))
{
var a = instance_create(player.x,y,objGLSword);
alarm[0] = 100;
}
I'm not sure what to put for the y to make it at ground level and the game just crashes whenever the alarm goes off.
In the objGLSword object I just have the image speed set and then it deletes after animation end.
The crash report reads:
Fatal error in action number 1 of alarm event for alarm 3 for object objBoss
Push :: Execution Error - Variable Get 103930.player(100162, -2147483648)
at gml_objBoss_objAlarm3_1(line 3)- var a = instance_create(player.x,y,objGLSword);
Also how would I make it so the attack would only go off 5 or so times and then the alarm would stop resetting?
PS: I'm using yoyo's studio engine.
if (instance_exists(objPlayer))
{
var a = instance_create(player.x,y,objGLSword);
alarm[0] = 100;
}
I'm not sure what to put for the y to make it at ground level and the game just crashes whenever the alarm goes off.
In the objGLSword object I just have the image speed set and then it deletes after animation end.
The crash report reads:
Fatal error in action number 1 of alarm event for alarm 3 for object objBoss
Push :: Execution Error - Variable Get 103930.player(100162, -2147483648)
at gml_objBoss_objAlarm3_1(line 3)- var a = instance_create(player.x,y,objGLSword);
Also how would I make it so the attack would only go off 5 or so times and then the alarm would stop resetting?
PS: I'm using yoyo's studio engine.