Create:
xsp = 1
ysp = 1
var_speed_p = 2
var_speed_p_add = 1
debug = 0
Step:
var_beg_c = keyboard_check(ord("C"))
var_beg_shift = keyboard_check(vk_shift)
var_right = keyboard_check(vk_right)
var_left = keyboard_check(vk_left)
var_up = keyboard_check(vk_up)
var_down = keyboard_check(vk_down)
//for debug
debug = 1
if debug = 1
{
xsp_d = "X speed " + string(xsp)
ysp_d = "Y speed " + string(ysp)
sp_add = "Added speed " + string(var_speed_p_add)
c_d = "C " + string(var_beg_c)
shift_d = "Shift " + string(var_beg_shift)
}
//speed
if var_beg_shift = 0 and var_speed_p_add <= 1
{
if var_beg_c = 1
var_speed_p_add = clamp(var_speed_p_add - 0.01, 0.1, 1)
if var_beg_c = 0
var_speed_p_add = clamp(var_speed_p_add + 0.01, 0.1, 1)
}
if var_beg_c = 0 and var_speed_p_add >= 1
{
if var_beg_shift = 1
var_speed_p_add = clamp(var_speed_p_add + 0.01, 1, 2.5)
if var_beg_shift = 0
var_speed_p_add = clamp(var_speed_p_add - 0.01, 1, 2.5)
}
if var_beg_c = 0 and var_beg_shift = 0 and xsp = 0 and ysp = 0
var_speed_p_add = 1
xsp = (var_right - var_left) * (var_speed_p * var_speed_p_add)
ysp = (var_down - var_up) * (var_speed_p * var_speed_p_add)
x += xsp
y += ysp
Draw:
draw_set_colour(c_white);
draw_set_halign(fa_center)
draw_set_valign(fa_middle)
draw_set_font(fnt);
draw_self()
if debug = 1
{
draw_text(x- 50, y + 5, xsp_d);
draw_text(x -50, y + 25, ysp_d);
draw_text(x-50, y - 15, sp_add);
draw_text(x-50, y - 35, c_d);
draw_text(x-50, y - 55, shift_d);
}
0 comments