woods
Member
so i am working on a space shooter(asteroids style) the issue i am facing is dealing with facing and drift.
i want to be able to start moving in one direction and turn my ship and still have the "forward motion" until i hit forward...if that makes sense.
reducing friction simply allows me to slide farther... not exactly what i am looking for.
thoughts?
obj_player create event
obj_player step event
i want to be able to start moving in one direction and turn my ship and still have the "forward motion" until i hit forward...if that makes sense.
reducing friction simply allows me to slide farther... not exactly what i am looking for.
thoughts?
obj_player create event
Code:
/// initialize variables
speed = 0;
max_speed = 5;
min_speed = -3;
direction = 0;
image_angle = 0;
powerup_splitshot = false
friction = 0.01
obj_player step event
Code:
/// movement
if speed >= max_speed //max speed
{
speed = max_speed;
}
if speed <= min_speed // max reverse speed
{
speed = min_speed;
}
//controller - sticks
if gamepad_axis_value(0, gp_axislh) > 0.5 //right
{
direction -=2;
image_angle = direction;
}
if gamepad_axis_value(0, gp_axislh) < -0.5 //left
{
direction +=2;
image_angle = direction;
}
if gamepad_axis_value(0, gp_axislv) < -0.5 //forward
{
speed += 0.1;
}
if gamepad_axis_value(0, gp_axislv) > 0.5 //reverse
{
speed -= 0.1;
}