| 1 |
canrepeat = false; |
| 2 |
if (global.encounterno == 89 && global.inv > 0 && hit == 0) |
| 3 |
{ |
| 4 |
controller.special = -4; |
| 5 |
hit = true; |
| 6 |
} |
| 7 |
if (init == 0 || restart) |
| 8 |
{ |
| 9 |
if (init == 0) |
| 10 |
{ |
| 11 |
animator.creator = creator; |
| 12 |
animator.quizmode = 1; |
| 13 |
} |
| 14 |
if (difficulty >= 4) |
| 15 |
{ |
| 16 |
turnspeed = 40 - ((difficulty - 4) * 5); |
| 17 |
turns = difficulty - 3; |
| 18 |
} |
| 19 |
else if (difficulty == 5) |
| 20 |
{ |
| 21 |
turnspeed = 30; |
| 22 |
turns = 5; |
| 23 |
} |
| 24 |
else if (difficulty == 4) |
| 25 |
{ |
| 26 |
turnspeed = 40; |
| 27 |
turns = 4; |
| 28 |
} |
| 29 |
tm = global.monsterinstance[creator]; |
| 30 |
init = 1; |
| 31 |
restart = false; |
| 32 |
for (i = 0; i < turns; i++) |
| 33 |
{ |
| 34 |
if (tm != -4 && tm.lastQuizLetter != -1) |
| 35 |
{ |
| 36 |
var nextletter = irandom(2); |
| 37 |
if (nextletter == tm.lastQuizLetter) |
| 38 |
nextletter = 3; |
| 39 |
letters[i] = nextletter; |
| 40 |
tm.lastQuizLetter = nextletter; |
| 41 |
} |
| 42 |
else |
| 43 |
{ |
| 44 |
letters[i] = irandom(3); |
| 45 |
if (tm != -4) |
| 46 |
tm.lastQuizLetter = letters[i]; |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
timer--; |
| 51 |
if (state == -1) |
| 52 |
{ |
| 53 |
if (timer <= 0) |
| 54 |
{ |
| 55 |
timer = 0; |
| 56 |
state = 0; |
| 57 |
} |
| 58 |
} |
| 59 |
if (state == 0) |
| 60 |
{ |
| 61 |
if (currentturn == turns) |
| 62 |
{ |
| 63 |
animator.targetx = obj_growtangle.x + 100; |
| 64 |
animator.targety = obj_growtangle.y; |
| 65 |
state = 1; |
| 66 |
animator.quizloop = true; |
| 67 |
currentturn = 0; |
| 68 |
timer = turnspeed + 10; |
| 69 |
} |
| 70 |
else if (timer <= 0) |
| 71 |
{ |
| 72 |
var targetDirection; |
| 73 |
if (turns > 1) |
| 74 |
{ |
| 75 |
var bottomangle = 140; |
| 76 |
var topangle = 220; |
| 77 |
if (turns == 2) |
| 78 |
{ |
| 79 |
bottomangle = 170; |
| 80 |
topangle = 190; |
| 81 |
} |
| 82 |
else if (turns == 3) |
| 83 |
{ |
| 84 |
bottomangle = 155; |
| 85 |
topangle = 205; |
| 86 |
} |
| 87 |
targetDirection = lerp(bottomangle, topangle, currentturn / (turns - 1)); |
| 88 |
} |
| 89 |
else |
| 90 |
{ |
| 91 |
targetDirection = 180; |
| 92 |
} |
| 93 |
var offset = 36; |
| 94 |
var xx = x + 80 + lengthdir_x(offset, targetDirection); |
| 95 |
var yy = y + 40 + lengthdir_y(offset, targetDirection); |
| 96 |
var _letter; |
| 97 |
for (i = 0; i < 2; i++) |
| 98 |
{ |
| 99 |
temp = instance_create(xx, yy, obj_tm_quizletter); |
| 100 |
temp.sprite_index = spr_tm_letters; |
| 101 |
temp.image_speed = 0; |
| 102 |
_letter = letters[currentturn]; |
| 103 |
temp.image_index = _letter; |
| 104 |
temp.direction = targetDirection; |
| 105 |
temp.speed = 10; |
| 106 |
temp.friction = 1; |
| 107 |
timer = turnspeed - 20; |
| 108 |
if (i == 1) |
| 109 |
{ |
| 110 |
temp.outline = 1; |
| 111 |
temp.depth++; |
| 112 |
} |
| 113 |
temp.alarm[0] = (20 * (turns - currentturn)) - ((turns - 1 - currentturn) * 2); |
| 114 |
} |
| 115 |
currentturn++; |
| 116 |
snd_play(voiceclips[_letter]); |
| 117 |
} |
| 118 |
} |
| 119 |
else if (state == 1) |
| 120 |
{ |
| 121 |
if (animator.state == 0 && timer < 20) |
| 122 |
animator.state = 1; |
| 123 |
if (timer <= 0) |
| 124 |
{ |
| 125 |
animator.zapping = true; |
| 126 |
var xx = obj_growtangle.x + 1; |
| 127 |
var yy = obj_growtangle.y; |
| 128 |
var zaptime = (difficulty >= 4) ? clamp(turnspeed - 20, 10, 20) : 20; |
| 129 |
if (difficulty == 1) |
| 130 |
zaptime = 15; |
| 131 |
else if (difficulty == 2) |
| 132 |
zaptime = 15; |
| 133 |
for (i = 0; i < 4; i++) |
| 134 |
{ |
| 135 |
if (i == letters[currentturn]) |
| 136 |
continue; |
| 137 |
d = scr_bullet_createscr_bullet_createfunction scr_bullet_create(arg0, arg1, arg2)
{
var __newbullet = instance_create(arg0, arg1, arg2);
__newbullet.damage = damage;
__newbullet.target = target;
if (variable_instance_exists(self, "element"))
__newbullet.element = element;
return __newbullet;
} (xx, yy, obj_tm_quizzap); |
| 138 |
d.alarm[0] = zaptime; |
| 139 |
d.letter = i; |
| 140 |
} |
| 141 |
currentturn++; |
| 142 |
animator.state = 2; |
| 143 |
timer = turnspeed; |
| 144 |
if (currentturn == turns) |
| 145 |
{ |
| 146 |
alarm[1] = zaptime; |
| 147 |
state = 2; |
| 148 |
timer = 20; |
| 149 |
} |
| 150 |
else |
| 151 |
{ |
| 152 |
alarm[0] = zaptime; |
| 153 |
} |
| 154 |
} |
| 155 |
} |