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 |
mons = global.monsterinstance[global.mytarget]; |
19 |
ht = 100; |
20 |
wd = 100; |
21 |
if (instance_exists(mons)) |
22 |
mons.trgtest = id; |
23 |
with (mons) |
24 |
{ |
25 |
trgtest.ht = ht; |
26 |
trgtest.wd = wd; |
27 |
} |
28 |
if (image_speed == 0) |
29 |
{ |
30 |
if (control_check_pressed(0)) |
31 |
{ |
32 |
mons = global.monsterinstance[global.mytarget]; |
33 |
hspeed = 0; |
34 |
script_execute(scr_attackcalc); |
35 |
global.damage = damage; |
36 |
global.damage += random(2); |
37 |
myx = x + (sprite_width / 2); |
38 |
myperfectx = obj_target.x + (obj_target.sprite_width / 2); |
39 |
bonusfactor = abs(myx - myperfectx); |
40 |
if (bonusfactor == 0) |
41 |
bonusfactor = 1; |
42 |
global.stretch = (obj_target.sprite_width - bonusfactor) / obj_target.sprite_width; |
43 |
if (bonusfactor <= 12) |
44 |
global.damage = round(global.damage * 2.2); |
45 |
if (bonusfactor > 12) |
46 |
global.damage = round(global.damage * global.stretch * 2); |
47 |
with (mons) |
48 |
takedamage = global.damage; |
49 |
instance_create((mons.x + (wd / 2)) - 5, mons.y - 5, obj_slice); |
50 |
global.hurtanim[global.mytarget] = 1; |
51 |
image_speed = 0.4; |
52 |
} |
53 |
} |
54 |
if (global.myfight != 1) |
55 |
instance_destroy(); |