Another stupid question that probabvly has an obvious answer:
I have an object that I want to rotate at a constant rate... Kind of like those rotating statues in Zelda that shoot at you.
Here's my create event:
Then I make it rotate in the step event:
The problem is where I try to find its line of sight. Here's my collision code (also in the step event):
if collision_line(x,y,lengthdir_x(40,dir),lengthdir_y(40,dir),ob_player,true,true)&&guntimer <= 0{
i=instance_create(x,y,ob_pl_shot_missile)
i.dir = point_direction(x,y,ob_player.x,ob_player.y)
i.hspd = lengthdir_x(5,i.dir)
i.vspd = lengthdir_y(5,i.dir)
guntimer = 20
}
That creates a missile, but it goes in the wrong direction. To test my line of sight, I decided to draw it:
draw_line(x,y,lengthdir_x(40,dir),lengthdir_y(40,dir))
And sure enough, the line doesn't just rotate slowly, it waves back and forth in a right sinewave pattern.
I checked the "dir" variable, and it's adding one each steo like I told it to. So I guess I'm doing something wrong in the "lengthdir" functions. Anyone know what I'm doing wrong?