A
Andrew R. C. Beck
Guest
Howdydiddly all! I am having an issue in which the user controlling a ship should be able to move left and right as they wish whilst maybe using other buttons, but everytime another button is pressed as well as the left or right move keys, the movement is interrupted until they press move again :S
Here is the control code:
Step:
Any help to stop this interruption would be much appreciated!
Here is the control code:
Step:
Code:
//Play True / False//
if (global.play = true)
{
//-----//
//Mouse / Keyboard//
//-----//
if (global.m_or_k = true)
{
xPos = mouse_x;
}
else
if (global.m_or_k = false)
{
xPos = x;
}
//----------//
//Controls//
//----------//
//Movement//
//-----//
//if (global.m_or_k = false)
{
if (keyboard_key = global_variables.mov_left)
{
if (xPos > 504)
{
x -= global.spd_1;
}
}
if (keyboard_key = global_variables.mov_right)
{
if (xPos < 1496)
{
x += global.spd_1;
}
}
}
//Launch//
//-----//
if (keyboard_check_pressed(global_variables.launch))
{
if (instance_number(projectile_obj) = 0)
{
ball = instance_create((x + 25),(y - 150),projectile_obj);
with (ball)
{
vspeed = -global.spd_2;
}
}
// else
// {
// exit;
// }
}
//-----//
//Bounce//
//-----//
if (place_meeting ( x + 20, y, projectile_obj))
{
with (projectile_obj)
{
x += 1;
}
}
if (place_meeting ( x - 20, y, projectile_obj))
{
with (projectile_obj)
{
x -= 1;
}
}
//-----//
//Boundaries//
//-----//
if (global.m_or_k = true)
{
if (mouse_x >= 504 && mouse_x <= 1496)
{
x = mouse_x;
}
else
if (mouse_x < 504)
{
xPos = 504;
}
else
if (mouse_x > 1496)
{
xPos = 1496;
}
else
{
xPos = x;
}
}
//-----//
}
//-----//
//Win//
//-----//
if (global.win = true)
{
y -= 10;
with (projectile_obj)
{
instance_destroy();
}
}
if ((y + 125) <= 0)
{
audio_stop_all()
if (global.gm == 1)
{
if (global.cur_lvl == global.lvl_fin_st)
{
global.lvl_fin_st +=1;
}
}
else
if (global.gm == 2)
{
if (global.cur_lvl == global.lvl_fin_tl)
{
global.lvl_fin_tl +=1;
}
}
scr_savegame(1);
room_goto(1);
with (main_menu_obj)
{
if (global.gm = 1)
{
menu = 10;
}
else
{
menu = 11;
}
}
}
//-----//
//Lose//
//-----//
if (global.lose = true)
&&
(!alarm_get(1))
{
audio_play_sound(explode_snd ,1, false);
effect_create_above(ef_explosion, x, y + 10, 10, c_blue);
alarm_set(1, room_speed);
with (projectile_obj)
{
instance_destroy();
}
}