1 |
if (hspeed > 0) |
2 |
{ |
3 |
if (x > (obj_target.x + obj_target.sprite_width)) |
4 |
xxx = 1; |
5 |
} |
6 |
if (hspeed < 0) |
7 |
{ |
8 |
if (x < obj_target.x) |
9 |
xxx = 1; |
10 |
} |
11 |
if (xxx == 1) |
12 |
{ |
13 |
global.damage = 0; |
14 |
global.hurtanim[global.mytarget] = 5; |
15 |
instance_destroy(); |
16 |
exit; |
17 |
} |
18 |
if (image_speed == 0) |
19 |
{ |
20 |
if (control_check_pressed(0)) |
21 |
{ |
22 |
mons = global.monsterinstance[global.mytarget]; |
23 |
hspeed = 0; |
24 |
script_execute(scr_attackcalc); |
25 |
global.damage = damage; |
26 |
global.damage += random(2); |
27 |
myx = x + (sprite_width / 2); |
28 |
myperfectx = obj_target.x + (obj_target.sprite_width / 2); |
29 |
bonusfactor = abs(myx - myperfectx); |
30 |
if (bonusfactor == 0) |
31 |
bonusfactor = 1; |
32 |
global.stretch = (obj_target.sprite_width - bonusfactor) / obj_target.sprite_width; |
33 |
if (bonusfactor <= 12) |
34 |
global.damage = round(global.damage * 2.2); |
35 |
if (bonusfactor > 12) |
36 |
global.damage = round(global.damage * global.stretch * 2); |
37 |
with (mons) |
38 |
takedamage = global.damage; |
39 |
instance_create((mons.x + (mons.sprite_width / 2)) - 5, mons.y - 5, obj_slice); |
40 |
global.hurtanim[global.mytarget] = 1; |
41 |
image_speed = 0.4; |
42 |
} |
43 |
} |
44 |
if (global.myfight != 1) |
45 |
instance_destroy(); |