A
Artwark
Guest
Ok so I want it so that when the player touches the powerup, it should repel other objects for a short time.
So this is how I tried doing it but nothing happened
On collision with powerup
Step event
Then I go for the collision even for the enemy object that collides with the player
Collision Event if obj_asteroids collides with obj_player
When I test it, it shows this error
FATAL ERROR in
action number 1
of Step Eventobj_player
for object obj_asteroids:
Unable to find any instance for object index '0' name 'obj_player'
at gml_Object_obj_asteroids_CollisionEvent_0_1 (line 40) - direction=point_direction(obj_player.x,obj_player.y,obj_asteroids.x,obj_asteroids.y-50,)
How do I fix this?
EDIT: Oh an when I mean repel, I meant the enemies are pushed away from the player like some strong force.
So this is how I tried doing it but nothing happened
Code:
Create Event
global.repel = 0;
Code:
global.repel = 300;
Code:
if global.repel;
global.repel--;
Collision Event if obj_asteroids collides with obj_player
Code:
if (global.repel !=0)
{
direction=point_direction(obj_player.x,obj_player.y,obj_asteroids.x,obj_asteroids.y-50);
}
FATAL ERROR in
action number 1
of Step Eventobj_player
for object obj_asteroids:
Unable to find any instance for object index '0' name 'obj_player'
at gml_Object_obj_asteroids_CollisionEvent_0_1 (line 40) - direction=point_direction(obj_player.x,obj_player.y,obj_asteroids.x,obj_asteroids.y-50,)
How do I fix this?
EDIT: Oh an when I mean repel, I meant the enemies are pushed away from the player like some strong force.