SOLVED Programming an Angle on an Analog Stick

I got some shooting in my game to work, but I was wonder how I can shoot at a certain angle with the gamepad. What I want to go for is for the left analog stick to be pointing at an angle(45 degree angle) while I shoot. This what I have for the shooting, but it shoots straight when the player runs.

GML:
if abs(gamepad_axis_value(0,gp_axislh)) && (gamepad_button_check(0,gp_face3)) && canShoot
{
canShoot = false
alarm[0] = shoot_delay
with (instance_create_layer(x,y,"BULLETS",obj_projectile))
{
direction = 0;
speed = 20;
}
}
 

FrostyCat

Member
For that direction, would I program after the if statement? Also, where would I put the direction?
Replace the 0 given to direction with point_direction(0, 0, gamepad_axis_value(0,gp_axislh), gamepad_axis_value(0,gp_axislv)). Had you genuinely understood the code instead of blindly copying it, this is something that even a novice should have been able to spot in less than 1 minute.
 
Top