C
Chickan
Guest
Hello everyone,
I'm brand spanking new to Gamemaker and am starting out bu making a simple space shooter game.
Question:
Is there a way to create an instance of an object but set a timer to prevent that object being able to collide with other objects?
Context:
The player controls a spaceship obj_ship. When they press space bar it creates an instance of obj_laser
This is then adjusted to match the angle and direction of the current object (your ship) and then given a speed
This works fine and, with collision events on the targets, is behaving as expected.
However I have made the game in such a way that, if you miss your target, obj_laser wraps (h & v) when outside the room. In other words I want it to just fly forever until it hits something.
This works for all objects except my ship. I wanted to set a collision event for your ship so that, if you miss your target and the bullet loops around the edge of the screen, you can potentially hit yourself.
Problem is that the obj_laser instance is created at the exact position of the ship meaning that, as soon as it's created, it collides with the player ship. Layer wise it's under the ship so, as it starts to move, it looks like it comes out the cannon at the front - so I don't really want to offset the xy position to create the instance outside the bounds of the ship's hitbox.
Is there a way to delay collision detection for an object? Or can anyone advise a way I might achieve what I'm after?
I'm brand spanking new to Gamemaker and am starting out bu making a simple space shooter game.
Question:
Is there a way to create an instance of an object but set a timer to prevent that object being able to collide with other objects?
Context:
The player controls a spaceship obj_ship. When they press space bar it creates an instance of obj_laser
Code:
laser = instance_create(x,y,obj_laser);
Code:
laser.image_angle = image_angle;
laser.direction = image_angle;
laser.speed = 8;
However I have made the game in such a way that, if you miss your target, obj_laser wraps (h & v) when outside the room. In other words I want it to just fly forever until it hits something.
This works for all objects except my ship. I wanted to set a collision event for your ship so that, if you miss your target and the bullet loops around the edge of the screen, you can potentially hit yourself.
Problem is that the obj_laser instance is created at the exact position of the ship meaning that, as soon as it's created, it collides with the player ship. Layer wise it's under the ship so, as it starts to move, it looks like it comes out the cannon at the front - so I don't really want to offset the xy position to create the instance outside the bounds of the ship's hitbox.
Is there a way to delay collision detection for an object? Or can anyone advise a way I might achieve what I'm after?