P
Parzival
Guest
Hi. I'm using Drag and Drop and am new to coding so I'm having some trouble with this.
I've created an enemy called obj_enemy_dropper that that bounces off walls. I've tried looking through tons of threads and watch countless videos but I can't seem to find out how to make the bullet shoot at my player.
There seem to be two methods in doing this:
1. Using test chance and create moving instance. However, these functions were for the old gamemaker and don't work in GMS 2.
2. Creating the bullet, setting its direction as towards the player, and making it go at the player at some rate using alarms. I am using this method, below is my code.
CREATE:
alarm[1]=room_speed*5
Alarm 1:
var bullet = instance_create(x, y, obj_enemy_bullet);
{
direction = point_direction(x, y, obj_ship.x, obj_ship.y);
speed = 6;
}
alarm[0] = room_speed * 5;
When I try to run this, I get this compile error:
Object: obj_enemy_dropper Event: Alarm 1 at line 5: unknown function or script instance_create.
p.s. In my obj_enemy_bullet, there are variables that give my enemy_bullet a speed of 6, and that destroy the bullet if they leave the room.
I've created an enemy called obj_enemy_dropper that that bounces off walls. I've tried looking through tons of threads and watch countless videos but I can't seem to find out how to make the bullet shoot at my player.
There seem to be two methods in doing this:
1. Using test chance and create moving instance. However, these functions were for the old gamemaker and don't work in GMS 2.
2. Creating the bullet, setting its direction as towards the player, and making it go at the player at some rate using alarms. I am using this method, below is my code.
CREATE:
alarm[1]=room_speed*5
Alarm 1:
var bullet = instance_create(x, y, obj_enemy_bullet);
{
direction = point_direction(x, y, obj_ship.x, obj_ship.y);
speed = 6;
}
alarm[0] = room_speed * 5;
When I try to run this, I get this compile error:
Object: obj_enemy_dropper Event: Alarm 1 at line 5: unknown function or script instance_create.
p.s. In my obj_enemy_bullet, there are variables that give my enemy_bullet a speed of 6, and that destroy the bullet if they leave the room.