changeset 7717 | 2684fdb9d874 |
parent 7229 | c34516ec0f27 |
child 7838 | 5c2337f8dbb2 |
7716:95117607b81a | 7717:2684fdb9d874 |
---|---|
233 local fMod = 1000000 -- use this for dev and .16+ games |
233 local fMod = 1000000 -- use this for dev and .16+ games |
234 |
234 |
235 -- some console stuff |
235 -- some console stuff |
236 local shellID = 0 |
236 local shellID = 0 |
237 local explosivesID = 0 |
237 local explosivesID = 0 |
238 local luaGameTicks = 0 |
|
238 |
239 |
239 -- gaudyRacer |
240 -- gaudyRacer |
240 local boosterOn = false |
241 local boosterOn = false |
241 local roundLimit = 3 -- no longer set here (see version history) |
242 local roundLimit = 3 -- no longer set here (see version history) |
242 local roundNumber = 0 |
243 local roundNumber = 0 |
294 local pointBlankHits = 0 |
295 local pointBlankHits = 0 |
295 --------------------- |
296 --------------------- |
296 -- tumbler goods |
297 -- tumbler goods |
297 --------------------- |
298 --------------------- |
298 |
299 |
300 local moveTimer = 0 |
|
299 local leftOn = false |
301 local leftOn = false |
300 local rightOn = false |
302 local rightOn = false |
301 local upOn = false |
303 local upOn = false |
302 local downOn = false |
304 local downOn = false |
303 |
305 |
314 |
316 |
315 |
317 |
316 local primShotsMax = 5 |
318 local primShotsMax = 5 |
317 local primShotsLeft = 0 |
319 local primShotsLeft = 0 |
318 |
320 |
321 local TimeLeftCounter = 0 |
|
319 local TimeLeft = 0 |
322 local TimeLeft = 0 |
320 local stopMovement = false |
323 local stopMovement = false |
321 local tumbleStarted = false |
324 local tumbleStarted = false |
322 |
325 |
323 local beam = false |
326 local beam = false |
326 |
329 |
327 local shockwave |
330 local shockwave |
328 local shockwaveHealth = 0 |
331 local shockwaveHealth = 0 |
329 local shockwaveRad = 300 |
332 local shockwaveRad = 300 |
330 |
333 |
334 local Timer100 = 0 |
|
335 |
|
331 local vTag = {} |
336 local vTag = {} |
332 |
337 |
333 ----------------------------------------------- |
338 ----------------------------------------------- |
334 -- CIRCLY GOODIES |
339 -- CIRCLY GOODIES |
335 ----------------------------------------------- |
340 ----------------------------------------------- |
339 local targetHit = false |
344 local targetHit = false |
340 |
345 |
341 local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies |
346 local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies |
342 local pTimer = 0 -- tracking projectiles following player |
347 local pTimer = 0 -- tracking projectiles following player |
343 |
348 |
344 --local m2Count = 0 -- handle speed of circs |
349 local circAdjustTimer = 0 -- handle adjustment of circs direction |
350 local m2Count = 0 -- handle speed of circs |
|
345 |
351 |
346 local vCirc = {} |
352 local vCirc = {} |
347 local vCCount = 0 |
353 local vCCount = 0 |
348 |
354 |
349 local rCirc = {} |
355 local rCirc = {} |
350 local rCircX = {} |
356 local rCircX = {} |
351 local rCircY = {} |
357 local rCircY = {} |
352 local rAlpha = 255 |
358 local rAlpha = 255 |
359 local rPingTimer = 0 |
|
353 local radShotsLeft = 0 |
360 local radShotsLeft = 0 |
354 |
361 |
355 local vCircActive = {} |
362 local vCircActive = {} |
356 local vCircHealth = {} |
363 local vCircHealth = {} |
357 local vType = {} |
364 local vType = {} |
1151 end |
1158 end |
1152 |
1159 |
1153 end |
1160 end |
1154 |
1161 |
1155 |
1162 |
1156 function onGameTick20() |
1163 function onGameTick() |
1157 |
1164 |
1158 |
1165 |
1159 --WriteLnToConsole("Start of GameTick") |
1166 --WriteLnToConsole("Start of GameTick") |
1167 luaGameTicks = luaGameTicks + 1 -- GameTime |
|
1160 |
1168 |
1161 HandleCircles() |
1169 HandleCircles() |
1162 |
1170 |
1163 -- derp |
1171 -- derp |
1164 --if shockwaveHealth > 0 then |
1172 --if shockwaveHealth > 0 then |
1165 -- shockwaveHealth = shockwaveHealth - 1 |
1173 -- shockwaveHealth = shockwaveHealth - 1 |
1166 -- shockwaveRad = shockwaveRad + 5 |
1174 -- shockwaveRad = shockwaveRad + 5 |
1167 --end |
1175 --end |
1168 |
1176 |
1169 |
1177 |
1170 if GameTime%100 == 0 then |
1178 Timer100 = Timer100 + 1 |
1179 if Timer100 >= 100 then |
|
1180 Timer100 = 0 |
|
1171 |
1181 |
1172 if beam == true then |
1182 if beam == true then |
1173 shieldHealth = shieldHealth - 1 |
1183 shieldHealth = shieldHealth - 1 |
1174 if shieldHealth < 80 then -- <= 80 |
1184 if shieldHealth < 80 then -- <= 80 |
1175 shieldHealth = 80 |
1185 shieldHealth = 80 |
1189 --nw WriteLnToConsole("Finished ThingsToBeRunOnGears()") |
1199 --nw WriteLnToConsole("Finished ThingsToBeRunOnGears()") |
1190 |
1200 |
1191 --runOnGears(HandleLifeSpan) |
1201 --runOnGears(HandleLifeSpan) |
1192 --runOnGears(DeleteFarFlungBarrel) |
1202 --runOnGears(DeleteFarFlungBarrel) |
1193 |
1203 |
1194 if CirclesAreGo == true and CurrentHedgehog ~= nil then |
1204 if CirclesAreGo == true then |
1195 CheckDistances() |
1205 CheckDistances() |
1196 --runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason |
1206 --runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason |
1197 --runOnGears(ProjectileTrack) |
1207 --runOnGears(ProjectileTrack) |
1198 end |
1208 end |
1199 |
1209 |
1213 -- start the player tumbling with a boom once their turn has actually begun |
1223 -- start the player tumbling with a boom once their turn has actually begun |
1214 if (tumbleStarted == false) and (gameOver == false) then |
1224 if (tumbleStarted == false) and (gameOver == false) then |
1215 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
1225 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
1216 --AddCaption(LOC_NOT("Good to go!")) |
1226 --AddCaption(LOC_NOT("Good to go!")) |
1217 tumbleStarted = true |
1227 tumbleStarted = true |
1218 TimeLeft = div(TurnTime, 1000) --45 |
1228 TimeLeft = (TurnTime/1000) --45 |
1219 FadeAlpha = 0 |
1229 FadeAlpha = 0 |
1220 rAlpha = 255 |
1230 rAlpha = 255 |
1221 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1231 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1222 DrawTag(0) |
1232 DrawTag(0) |
1223 DrawTag(1) |
1233 DrawTag(1) |
1231 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1241 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1232 |
1242 |
1233 --AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) ) |
1243 --AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) ) |
1234 |
1244 |
1235 -- Calculate and display turn time |
1245 -- Calculate and display turn time |
1236 if GameTime%1000 == 0 then |
1246 TimeLeftCounter = TimeLeftCounter + 1 |
1247 if TimeLeftCounter == 1000 then |
|
1248 TimeLeftCounter = 0 |
|
1237 TimeLeft = TimeLeft - 1 |
1249 TimeLeft = TimeLeft - 1 |
1238 |
1250 |
1239 if TimeLeft >= 0 then |
1251 if TimeLeft >= 0 then |
1240 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1252 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1241 DrawTag(0) |
1253 DrawTag(0) |
1296 chainLength = 0 |
1308 chainLength = 0 |
1297 end |
1309 end |
1298 end |
1310 end |
1299 |
1311 |
1300 -- handle movement based on IO |
1312 -- handle movement based on IO |
1301 if GameTime%100 == 0 then -- 100 |
1313 moveTimer = moveTimer + 1 |
1314 if moveTimer == 100 then -- 100 |
|
1302 --nw WriteLnToConsole("Start of Player MoveTimer") |
1315 --nw WriteLnToConsole("Start of Player MoveTimer") |
1316 moveTimer = 0 |
|
1303 |
1317 |
1304 --------------- |
1318 --------------- |
1305 -- new trail code |
1319 -- new trail code |
1306 --------------- |
1320 --------------- |
1307 -- the trail lets you know you have 5s left to pilot, akin to birdy feathers |
1321 -- the trail lets you know you have 5s left to pilot, akin to birdy feathers |
1606 vCircDX[i] = 0 |
1620 vCircDX[i] = 0 |
1607 vCircDY[i] = 0 |
1621 vCircDY[i] = 0 |
1608 |
1622 |
1609 vType[i] = "generic" |
1623 vType[i] = "generic" |
1610 vCounter[i] = 0 |
1624 vCounter[i] = 0 |
1611 vCounterLim[i] = 150 |
1625 vCounterLim[i] = 3000 |
1612 vCircScore[i] = 0 |
1626 vCircScore[i] = 0 |
1613 vCircHealth[i] = 1 |
1627 vCircHealth[i] = 1 |
1614 |
1628 |
1615 vCircMinA[i] = 80 --80 --20 |
1629 vCircMinA[i] = 80 --80 --20 |
1616 vCircMaxA[i] = 255 |
1630 vCircMaxA[i] = 255 |
1799 --if r <= 2 then |
1813 --if r <= 2 then |
1800 vCircCol[i] = 0xff0000ff -- red |
1814 vCircCol[i] = 0xff0000ff -- red |
1801 vType[i] = "drone" |
1815 vType[i] = "drone" |
1802 vCircRadMin[i] = 50 *5 |
1816 vCircRadMin[i] = 50 *5 |
1803 vCircRadMax[i] = 90 *5 |
1817 vCircRadMax[i] = 90 *5 |
1804 vCounterLim[i] = 150 |
1818 vCounterLim[i] = 3000 |
1805 vCircScore[i] = 10 |
1819 vCircScore[i] = 10 |
1806 vCircHealth[i] = 1 |
1820 vCircHealth[i] = 1 |
1807 --else |
1821 --else |
1808 elseif r == 1 then |
1822 elseif r == 1 then |
1809 vCircCol[i] = 0x00ff00ff -- green |
1823 vCircCol[i] = 0x00ff00ff -- green |
1824 vCircCol[i] = 0x0050ffff -- sexy blue |
1838 vCircCol[i] = 0x0050ffff -- sexy blue |
1825 vType[i] = "blueboss" |
1839 vType[i] = "blueboss" |
1826 vCircRadMin[i] = 100*5 |
1840 vCircRadMin[i] = 100*5 |
1827 vCircRadMax[i] = 180*5 |
1841 vCircRadMax[i] = 180*5 |
1828 vCircWidth[i] = 1 |
1842 vCircWidth[i] = 1 |
1829 vCounterLim[i] = 100 |
1843 vCounterLim[i] = 2000 |
1830 vCircScore[i] = 30 |
1844 vCircScore[i] = 30 |
1831 vCircHealth[i] = 3 |
1845 vCircHealth[i] = 3 |
1832 else |
1846 else |
1833 --elseif r == 1 then |
1847 --elseif r == 1 then |
1834 --vCircCol[i] = 0xffae00ff -- orange |
1848 --vCircCol[i] = 0xffae00ff -- orange |
1996 --end |
2010 --end |
1997 |
2011 |
1998 end |
2012 end |
1999 |
2013 |
2000 -- if player is hit by circle bazooka |
2014 -- if player is hit by circle bazooka |
2001 elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then --or (GetGearType(gear) == gtBall) then |
2015 elseif (GetGearType(gear) == gtShell) then --or (GetGearType(gear) == gtBall) then |
2002 |
2016 |
2003 dist = GetDistFromGearToGear(gear, CurrentHedgehog) |
2017 dist = GetDistFromGearToGear(gear, CurrentHedgehog) |
2004 |
2018 |
2005 if beam == true then |
2019 if beam == true then |
2006 |
2020 |
2127 end]] |
2141 end]] |
2128 |
2142 |
2129 |
2143 |
2130 if rAlpha ~= 255 then |
2144 if rAlpha ~= 255 then |
2131 |
2145 |
2132 if GameTime%100 == 0 then |
2146 rPingTimer = rPingTimer + 1 |
2147 if rPingTimer == 100 then |
|
2148 rPingTimer = 0 |
|
2133 |
2149 |
2134 rAlpha = rAlpha + 5 |
2150 rAlpha = rAlpha + 5 |
2135 if rAlpha >= 255 then |
2151 if rAlpha >= 255 then |
2136 rAlpha = 255 |
2152 rAlpha = 255 |
2137 end |
2153 end |
2243 |
2259 |
2244 |
2260 |
2245 end |
2261 end |
2246 |
2262 |
2247 -- alter the circles velocities |
2263 -- alter the circles velocities |
2248 if GameTime%2000 == 0 then |
2264 circAdjustTimer = circAdjustTimer + 1 |
2265 if circAdjustTimer == 2000 then |
|
2266 |
|
2267 circAdjustTimer = 0 |
|
2249 |
2268 |
2250 for i = 0,(vCCount-1) do |
2269 for i = 0,(vCCount-1) do |
2251 |
2270 |
2252 -- bounce the circles off the edges if they go too far |
2271 -- bounce the circles off the edges if they go too far |
2253 -- or make them move in random directions |
2272 -- or make them move in random directions |
2254 |
2273 |
2255 if vCircX[i] > 5500 then |
2274 if vCircX[i] > 5500 then |
2256 vCircDX[i] = -4 --5 circmovchange |
2275 vCircDX[i] = -5 --5 circmovchange |
2257 elseif vCircX[i] < -1500 then |
2276 elseif vCircX[i] < -1500 then |
2258 vCircDX[i] = 4 --5 circmovchange |
2277 vCircDX[i] = 5 --5 circmovchange |
2259 else |
2278 else |
2260 |
2279 |
2261 z = GetRandom(2) |
2280 z = GetRandom(2) |
2262 if z == 1 then |
2281 if z == 1 then |
2263 z = 1 |
2282 z = 1 |
2266 end |
2285 end |
2267 vCircDX[i] = vCircDX[i] + GetRandom(3)*z --3 circmovchange |
2286 vCircDX[i] = vCircDX[i] + GetRandom(3)*z --3 circmovchange |
2268 end |
2287 end |
2269 |
2288 |
2270 if vCircY[i] > 1500 then |
2289 if vCircY[i] > 1500 then |
2271 vCircDY[i] = -4 --5 circmovchange |
2290 vCircDY[i] = -5 --5 circmovchange |
2272 elseif vCircY[i] < -2900 then |
2291 elseif vCircY[i] < -2900 then |
2273 vCircDY[i] = 4 --5 circmovchange |
2292 vCircDY[i] = 5 --5 circmovchange |
2274 else |
2293 else |
2275 z = GetRandom(2) |
2294 z = GetRandom(2) |
2276 if z == 1 then |
2295 if z == 1 then |
2277 z = 1 |
2296 z = 1 |
2278 else |
2297 else |
2284 end |
2303 end |
2285 |
2304 |
2286 end |
2305 end |
2287 |
2306 |
2288 -- move the circles according to their current velocities |
2307 -- move the circles according to their current velocities |
2289 --m2Count = m2Count + 1 |
2308 m2Count = m2Count + 1 |
2290 --if m2Count == 25 then --25 circmovchange |
2309 if m2Count == 25 then --25 circmovchange |
2291 |
2310 |
2292 -- m2Count = 0 |
2311 m2Count = 0 |
2293 for i = 0,(vCCount-1) do |
2312 for i = 0,(vCCount-1) do |
2294 vCircX[i] = vCircX[i] + vCircDX[i] |
2313 vCircX[i] = vCircX[i] + vCircDX[i] |
2295 vCircY[i] = vCircY[i] + vCircDY[i] |
2314 vCircY[i] = vCircY[i] + vCircDY[i] |
2296 |
2315 |
2297 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2316 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2328 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
2347 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
2329 end |
2348 end |
2330 |
2349 |
2331 |
2350 |
2332 |
2351 |
2333 --end |
2352 end |
2334 |
2353 |
2335 for i = 0,(vCCount-1) do |
2354 for i = 0,(vCCount-1) do |
2336 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2355 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2337 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2356 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2338 end |
2357 end |
2385 |
2404 |
2386 --WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID")) |
2405 --WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID")) |
2387 --WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy) |
2406 --WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy) |
2388 --WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) ) |
2407 --WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) ) |
2389 |
2408 |
2390 if CurrentHedgehog ~= nil then |
2409 if GetX(gear) > GetX(CurrentHedgehog) then |
2391 if GetX(gear) > GetX(CurrentHedgehog) then |
2410 dx = dx - turningSpeed--0.1 |
2392 dx = dx - turningSpeed--0.1 |
2411 else |
2393 else |
2412 dx = dx + turningSpeed--0.1 |
2394 dx = dx + turningSpeed--0.1 |
2413 end |
2395 end |
2414 |
2396 |
2415 if GetY(gear) > GetY(CurrentHedgehog) then |
2397 if GetY(gear) > GetY(CurrentHedgehog) then |
2416 dy = dy - turningSpeed--0.1 |
2398 dy = dy - turningSpeed--0.1 |
2417 else |
2399 else |
2418 dy = dy + turningSpeed--0.1 |
2400 dy = dy + turningSpeed--0.1 |
2419 end |
2401 end |
|
2402 end |
|
2403 |
2420 |
2404 |
2421 |
2405 if (GetGearType(gear) == gtShell) then |
2422 if (GetGearType(gear) == gtShell) then |
2406 dxlimit = 0.4*fMod |
2423 dxlimit = 0.4*fMod |
2407 dylimit = 0.4*fMod |
2424 dylimit = 0.4*fMod |