P
Purin
Guest
Hello, I'm trying to make my player shoot two streams of flame in the direction that the object is facing. My player sprite rotates with the mouse, but it has a fixed rotation speed. I am able to shoot flames from the right place and in the direction the mouse is pointing, but when my object rotates, i'm not sure how to rotate the creation location. In my code it currently shoots the flame to the mouse location, but my end goal is to have it shoot in the direction the player is facing.
In my player's step event, I have this:
In my player's Glob Left Button event, I have this:
Here is a picture of the player sprite's dimensions and origin, in case that helps to clarify anything:
P.S. No, I cant use particles because i'm planning on having some collision events with the flame in the future.
In my player's step event, I have this:
Code:
///Rotate object in the direction of mouse
var mouse_angle = point_direction(x,y,mouse_x,mouse_y);
var rot_factor = 15; // speed of rotation
image_angle -= (sin(degtorad(image_angle - mouse_angle)) * rot_factor);
Code:
/// Shoot flame
//Left Side
fire = instance_create(x+32, y-16, ctrl_flamethrower);
fire.speed = 5;
variation = choose (-2, -1, 0, 1, 2)
fire.direction = point_direction(x, y, mouse_x, mouse_y) + variation;
//Right Side
fire = instance_create(x+32, y+16, ctrl_flamethrower);
fire.speed = 5;
variation = choose (-2, -1, 0, 1, 2)
fire.direction = point_direction(x, y, mouse_x, mouse_y) + variation;
P.S. No, I cant use particles because i'm planning on having some collision events with the flame in the future.