19 local hhs = {} |
19 local hhs = {} |
20 local hog_greenhorn, hog_cappy |
20 local hog_greenhorn, hog_cappy |
21 local crates = {} |
21 local crates = {} |
22 local switcherGear |
22 local switcherGear |
23 local tookDamage = false |
23 local tookDamage = false |
24 local switchTicks = -1 |
24 local switchTextDelay = -1 |
25 local walkingText = false |
25 local walkingText = false |
26 |
26 |
27 local map = { |
27 local map = { |
28 "\1\74\7\29\135\1\74\8\11\0\1\83\7\135\135", |
28 "\1\74\7\29\135\1\74\8\11\0\1\83\7\135\135", |
29 "\1\250\7\135\0\1\204\7\137\135\1\238\7\135\0", |
29 "\1\250\7\135\0\1\204\7\137\135\1\238\7\135\0", |
254 SetWeapon(amNothing) |
254 SetWeapon(amNothing) |
255 SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmAllStoppable))) |
255 SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmAllStoppable))) |
256 EndGame() |
256 EndGame() |
257 end |
257 end |
258 |
258 |
259 function onGearAdd(gear) |
259 local function switchHedgehogText() |
260 if GetGearType(gear) == gtSwitcher then |
260 if CurrentHedgehog == hog_cappy then |
261 switcherGear = gear |
261 ShowMission(loc("Basic Movement Training"), loc("Switch Hedgehog (3/3)"), |
|
262 loc("This is Cappy.").."|".. |
|
263 loc("To finish hedgehog selection, just do anything|with him, like walking."), |
|
264 2, 20000) |
|
265 else |
262 ShowMission(loc("Basic Movement Training"), loc("Switch Hedgehog (2/3)"), |
266 ShowMission(loc("Basic Movement Training"), loc("Switch Hedgehog (2/3)"), |
263 loc("You have activated Switch Hedgehog!").."|".. |
267 loc("You have activated Switch Hedgehog!").."|".. |
264 loc("The spinning arrows above your hedgehog show|which hedgehog is selected right now.").."|".. |
268 loc("The spinning arrows above your hedgehog show|which hedgehog is selected right now.").."|".. |
265 loc("Hit the “Switch Hedgehog” key until you have|selected Cappy, the hedgehog with the cap!").."|".. |
269 loc("Hit the “Switch Hedgehog” key until you have|selected Cappy, the hedgehog with the cap!").."|".. |
266 loc("Switch hedgehog: [Tabulator]"), 2, 20000) |
270 loc("Switch hedgehog: [Tabulator]"), 2, 20000) |
|
271 end |
|
272 end |
|
273 |
|
274 function onGearAdd(gear) |
|
275 if GetGearType(gear) == gtSwitcher then |
|
276 switcherGear = gear |
|
277 switchHedgehogText() |
267 end |
278 end |
268 end |
279 end |
269 |
280 |
270 function onGearDelete(gear) |
281 function onGearDelete(gear) |
271 -- Switching done |
282 -- Switching done |
349 end |
360 end |
350 |
361 |
351 function onSwitch() |
362 function onSwitch() |
352 -- Update help while switching hogs |
363 -- Update help while switching hogs |
353 if switcherGear then |
364 if switcherGear then |
354 -- Delay by one tick for CurrentHedgehog to update |
365 -- Delay for CurrentHedgehog to update |
355 switchTicks = 1 |
366 switchTextDelay = 1 |
356 end |
367 end |
357 end |
368 end |
358 |
369 |
359 function onGameTick() |
370 function onGameTick20() |
360 --AddCaption(GetX(CurrentHedgehog)..":"..GetY(CurrentHedgehog)) |
371 if switchTextDelay > 0 then |
361 if switchTicks > 0 then |
372 switchTextDelay = switchTextDelay - 1 |
362 switchTicks = switchTicks - 1 |
373 elseif switchTextDelay == 0 then |
363 elseif switchTicks == 0 then |
374 switchHedgehogText() |
364 if CurrentHedgehog == hog_cappy then |
375 switchTextDelay = -1 |
365 ShowMission(loc("Basic Movement Training"), loc("Switch Hedgehog (3/3)"), |
|
366 loc("This is Cappy.").."|".. |
|
367 loc("To finish hedgehog selection, just do anything|with him, like walking."), |
|
368 2, 20000) |
|
369 else |
|
370 ShowMission(loc("Basic Movement Training"), loc("Switch Hedgehog (2/3)"), |
|
371 loc("You have activated Switch Hedgehog!").."|".. |
|
372 loc("The spinning arrows above your hedgehog show|which hedgehog is selected right now.").."|".. |
|
373 loc("Hit the “Switch Hedgehog” key until you have|selected Cappy, the hedgehog with the cap!").."|".. |
|
374 loc("Switch hedgehog: [Tabulator]"), 2, 20000) |
|
375 end |
|
376 switchTicks = -1 |
|
377 end |
376 end |
378 end |
377 end |
379 |
378 |
380 function onGearResurrect(gear) |
379 function onGearResurrect(gear) |
381 AddCaption(loc("Your hedgehog has been revived!")) |
380 AddCaption(loc("Your hedgehog has been revived!")) |