1 |
siner += 1; |
2 |
if (z_b != 0) |
3 |
hspeed = cos(z_a * siner) * z_b; |
4 |
draw_set_color(c_white); |
5 |
draw_rectangle(x - len, y, x + len, y + 6, true); |
6 |
draw_set_color(c_green); |
7 |
draw_rectangle(x - len, y + 2, x + len, y - 4, true); |
8 |
if (collision_rectangle((x - len) + 2, y + 2, (x + len) - 2, y - 4, obj_heart, 0, 1)) |
9 |
{ |
10 |
if (obj_heart.vspeed >= 0 && obj_heart.y <= (y - 11)) |
11 |
{ |
12 |
lock = 1; |
13 |
obj_heart.y = y - 16; |
14 |
obj_heart.vspeed = 0; |
15 |
obj_heart.jumpstage = 1; |
16 |
} |
17 |
} |
18 |
else |
19 |
{ |
20 |
if (lock == 1 && obj_heart.jumpstage == 1) |
21 |
{ |
22 |
obj_heart.jumpstage = 2; |
23 |
obj_heart.vspeed = 0; |
24 |
} |
25 |
lock = 0; |
26 |
} |
27 |
if (lock == 1) |
28 |
{ |
29 |
obj_heart.x += hspeed; |
30 |
obj_heart.y += vspeed; |
31 |
if (obj_heart.x < (global.idealborder[0] + 5)) |
32 |
obj_heart.x = global.idealborder[0] + 5; |
33 |
if (obj_heart.x > (global.idealborder[1] - 16)) |
34 |
obj_heart.x = global.idealborder[1] - 16; |
35 |
} |
36 |
if (x < (0 - len) && hspeed < 0) |
37 |
instance_destroy(); |
38 |
if (x > (640 + len) && hspeed > 0) |
39 |
instance_destroy(); |
40 |
if (vspeed > 0 && y > global.idealborder[3]) |
41 |
instance_destroy(); |
42 |
if (jud == 1) |
43 |
{ |
44 |
jtimer += 1; |
45 |
if (jtimer >= 5 && jtimer <= 20) |
46 |
hspeed += 0.25; |
47 |
if (jtimer == 21) |
48 |
hspeed = 3; |
49 |
if (x > (global.idealborder[1] - len)) |
50 |
{ |
51 |
if (hspeed > 0) |
52 |
hspeed *= -1; |
53 |
} |
54 |
if (x < (global.idealborder[0] + len)) |
55 |
{ |
56 |
if (hspeed < 0) |
57 |
hspeed *= -1; |
58 |
} |
59 |
} |