16 local radius = 75 |
16 local radius = 75 |
17 local totalTime = 15000 |
17 local totalTime = 15000 |
18 local totalSaucers = 3 |
18 local totalSaucers = 3 |
19 local gameEnded = false |
19 local gameEnded = false |
20 local RED = 0xff0000ff |
20 local RED = 0xff0000ff |
21 local GREEN = 0x38d61cff |
21 local GREEN = 0x00ff00ff |
22 local challengeObjectives = loc("To win the game you have to pass into the rings in time.").. |
22 local challengeObjectives = loc("To win the game you have to pass into the rings in time.").. |
23 "|"..loc("You'll get extra time in case you need it when you pass a ring.").."|".. |
23 "|"..loc("You'll get extra time in case you need it when you pass a ring.").."|".. |
24 loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer.").."|".. |
24 loc("Green double rings also give you a new flying saucer.").."|".. |
25 loc("Use the attack key twice to change the flying saucer while floating in mid-air.") |
25 loc("Use the attack key twice to change the flying saucer while floating in mid-air.") |
26 local timeRecord |
26 local timeRecord |
27 -- dialogs |
27 -- dialogs |
28 local dialog01 = {} |
28 local dialog01 = {} |
29 -- hogs |
29 -- hogs |
244 |
244 |
245 function placeNextWaypoint() |
245 function placeNextWaypoint() |
246 if currentWaypoint > 1 then |
246 if currentWaypoint > 1 then |
247 local wp = waypoints[currentWaypoint-1] |
247 local wp = waypoints[currentWaypoint-1] |
248 DeleteVisualGear(wp.gear) |
248 DeleteVisualGear(wp.gear) |
|
249 DeleteVisualGear(wp.gear2) |
249 end |
250 end |
250 if currentWaypoint < 16 then |
251 if currentWaypoint < 16 then |
251 local wp = waypoints[currentWaypoint] |
252 local wp = waypoints[currentWaypoint] |
252 wp.gear = AddVisualGear(1,1,vgtCircle,1,true) |
253 wp.gear = AddVisualGear(1,1,vgtCircle,1,true) |
253 -- add bonus time and "fuel" |
254 -- 1st, 3rd, 5th, 7th, 9th, ... ring |
254 if currentWaypoint % 2 == 0 then |
255 if currentWaypoint % 2 == 0 then |
|
256 -- Render single red ring |
|
257 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, RED) |
|
258 -- Give 1 flying saucer and, if needed, extra time |
|
259 AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1) |
255 PlaySound(sndShotgunReload) |
260 PlaySound(sndShotgunReload) |
256 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, RED) |
|
257 AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1) |
|
258 totalSaucers = totalSaucers + 1 |
261 totalSaucers = totalSaucers + 1 |
259 local vgear = AddVisualGear(GetX(hero.gear), GetY(hero.gear), vgtAmmo, 0, true) |
262 local vgear = AddVisualGear(GetX(hero.gear), GetY(hero.gear), vgtAmmo, 0, true) |
260 if vgear ~= nil then |
263 if vgear ~= nil then |
261 SetVisualGearValues(vgear,nil,nil,nil,nil,nil,amJetpack) |
264 SetVisualGearValues(vgear,nil,nil,nil,nil,nil,amJetpack) |
262 end |
265 end |
268 message = loc("Got 1 more saucer and 8 more seconds added to the clock") |
271 message = loc("Got 1 more saucer and 8 more seconds added to the clock") |
269 else |
272 else |
270 message = loc("Got 1 more saucer") |
273 message = loc("Got 1 more saucer") |
271 end |
274 end |
272 AnimCaption(hero.gear, message, 4000) |
275 AnimCaption(hero.gear, message, 4000) |
|
276 -- 2nd, 4th, 6th, 8th, 10th, ... ring |
273 else |
277 else |
|
278 -- Render double green ring |
274 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, GREEN) |
279 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, GREEN) |
|
280 wp.gear2 = AddVisualGear(1,1,vgtCircle,1,true) |
|
281 SetVisualGearValues(wp.gear2, wp.x,wp.y, 20, 200, 0, 0, 100, radius - 6, 2, GREEN) |
|
282 -- Give extra time, if needed |
275 if TurnTimeLeft <= 16000 then |
283 if TurnTimeLeft <= 16000 then |
276 SetTurnTimeLeft(TurnTimeLeft + 6000) |
284 SetTurnTimeLeft(TurnTimeLeft + 6000) |
277 totalTime = totalTime + 6000 |
285 totalTime = totalTime + 6000 |
278 if currentWaypoint ~= 1 then |
286 if currentWaypoint ~= 1 then |
279 PlaySound(sndExtraTime) |
287 PlaySound(sndExtraTime) |
304 |
312 |
305 function heroLost() |
313 function heroLost() |
306 SendStat(siGameResult, loc("Oh man! Learn how to fly!")) |
314 SendStat(siGameResult, loc("Oh man! Learn how to fly!")) |
307 SendStat(siCustomAchievement, loc("To win the game you have to pass into the rings in time.")) |
315 SendStat(siCustomAchievement, loc("To win the game you have to pass into the rings in time.")) |
308 SendStat(siCustomAchievement, loc("You'll get extra time in case you need it when you pass a ring.")) |
316 SendStat(siCustomAchievement, loc("You'll get extra time in case you need it when you pass a ring.")) |
309 SendStat(siCustomAchievement, loc("Every 2 rings you'll get extra flying saucers.")) |
317 SendStat(siCustomAchievement, loc("Green double rings also give you a new flying saucer.")) |
310 SendStat(siCustomAchievement, loc("Use the attack key twice to change the flying saucer while being in air.")) |
318 SendStat(siCustomAchievement, loc("Use the attack key twice to change the flying saucer while being in air.")) |
311 sendSimpleTeamRankings({teamA.name}) |
319 sendSimpleTeamRankings({teamA.name}) |
312 EndGame() |
320 EndGame() |
313 end |
321 end |