1 |
function scr_arc_jumpscr_arc_jumpfunction scr_arc_jump(argument0, argument1) //gml_Script_scr_arc_jump
{
var jump_target_x = argument0
var jump_target_y = argument1
var _xd = jump_target_x - x
var _yd = jump_target_y - y
if (_xd == 0)
_xd = 1
gravity = 1.5
var _hsp = sign(_xd) * sqrt(abs(_xd)) / 1.5
var _time = ceil(_xd / _hsp)
hspeed = _xd / _time
vspeed = _yd / _time - gravity / 2 * (_time + 1)
alarm[0]
if (round(x) == jump_target_x && round(y) == jump_target_y)
{
hspeed = 0
vspeed = 0
x = jump_target_x
y = jump_target_y
gravity = 0
return true;
}
return false;
} (argument0, argument1) //gml_Script_scr_arc_jump |
2 |
{ |
3 |
var jump_target_x = argument0 |
4 |
var jump_target_y = argument1 |
5 |
var _xd = jump_target_x - x |
6 |
var _yd = jump_target_y - y |
7 |
if (_xd == 0) |
8 |
_xd = 1 |
9 |
gravity = 1.5 |
10 |
var _hsp = sign(_xd) * sqrt(abs(_xd)) / 1.5 |
11 |
var _time = ceil(_xd / _hsp) |
12 |
hspeed = _xd / _time |
13 |
vspeed = _yd / _time - gravity / 2 * (_time + 1) |
14 |
alarm[0] |
15 |
if (round(x) == jump_target_x && round(y) == jump_target_y) |
16 |
{ |
17 |
hspeed = 0 |
18 |
vspeed = 0 |
19 |
x = jump_target_x |
20 |
y = jump_target_y |
21 |
gravity = 0 |
22 |
return true; |
23 |
} |
24 |
return false; |
25 |
} |