changeset 7135 | 4d863aadd0b2 |
parent 6819 | 07e8de67c3c2 |
child 7144 | 6e3974128631 |
7133:9f250f79cb79 | 7135:4d863aadd0b2 |
---|---|
295 local pointBlankHits = 0 |
295 local pointBlankHits = 0 |
296 --------------------- |
296 --------------------- |
297 -- tumbler goods |
297 -- tumbler goods |
298 --------------------- |
298 --------------------- |
299 |
299 |
300 local moveTimer = 0 |
|
301 local leftOn = false |
300 local leftOn = false |
302 local rightOn = false |
301 local rightOn = false |
303 local upOn = false |
302 local upOn = false |
304 local downOn = false |
303 local downOn = false |
305 |
304 |
316 |
315 |
317 |
316 |
318 local primShotsMax = 5 |
317 local primShotsMax = 5 |
319 local primShotsLeft = 0 |
318 local primShotsLeft = 0 |
320 |
319 |
321 local TimeLeftCounter = 0 |
|
322 local TimeLeft = 0 |
320 local TimeLeft = 0 |
323 local stopMovement = false |
321 local stopMovement = false |
324 local tumbleStarted = false |
322 local tumbleStarted = false |
325 |
323 |
326 local beam = false |
324 local beam = false |
329 |
327 |
330 local shockwave |
328 local shockwave |
331 local shockwaveHealth = 0 |
329 local shockwaveHealth = 0 |
332 local shockwaveRad = 300 |
330 local shockwaveRad = 300 |
333 |
331 |
334 local Timer100 = 0 |
|
335 |
|
336 local vTag = {} |
332 local vTag = {} |
337 |
333 |
338 ----------------------------------------------- |
334 ----------------------------------------------- |
339 -- CIRCLY GOODIES |
335 -- CIRCLY GOODIES |
340 ----------------------------------------------- |
336 ----------------------------------------------- |
344 local targetHit = false |
340 local targetHit = false |
345 |
341 |
346 local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies |
342 local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies |
347 local pTimer = 0 -- tracking projectiles following player |
343 local pTimer = 0 -- tracking projectiles following player |
348 |
344 |
349 local circAdjustTimer = 0 -- handle adjustment of circs direction |
345 --local m2Count = 0 -- handle speed of circs |
350 local m2Count = 0 -- handle speed of circs |
|
351 |
346 |
352 local vCirc = {} |
347 local vCirc = {} |
353 local vCCount = 0 |
348 local vCCount = 0 |
354 |
349 |
355 local rCirc = {} |
350 local rCirc = {} |
1158 end |
1153 end |
1159 |
1154 |
1160 end |
1155 end |
1161 |
1156 |
1162 |
1157 |
1163 function onGameTick() |
1158 function onGameTick20() |
1164 |
1159 |
1165 |
1160 |
1166 --WriteLnToConsole("Start of GameTick") |
1161 --WriteLnToConsole("Start of GameTick") |
1167 luaGameTicks = luaGameTicks + 1 -- GameTime |
1162 luaGameTicks = luaGameTicks + 1 -- GameTime |
1168 |
1163 |
1173 -- shockwaveHealth = shockwaveHealth - 1 |
1168 -- shockwaveHealth = shockwaveHealth - 1 |
1174 -- shockwaveRad = shockwaveRad + 5 |
1169 -- shockwaveRad = shockwaveRad + 5 |
1175 --end |
1170 --end |
1176 |
1171 |
1177 |
1172 |
1178 Timer100 = Timer100 + 1 |
1173 if GameTime%100 == 0 then |
1179 if Timer100 >= 100 then |
|
1180 Timer100 = 0 |
|
1181 |
1174 |
1182 if beam == true then |
1175 if beam == true then |
1183 shieldHealth = shieldHealth - 1 |
1176 shieldHealth = shieldHealth - 1 |
1184 if shieldHealth < 80 then -- <= 80 |
1177 if shieldHealth < 80 then -- <= 80 |
1185 shieldHealth = 80 |
1178 shieldHealth = 80 |
1199 --nw WriteLnToConsole("Finished ThingsToBeRunOnGears()") |
1192 --nw WriteLnToConsole("Finished ThingsToBeRunOnGears()") |
1200 |
1193 |
1201 --runOnGears(HandleLifeSpan) |
1194 --runOnGears(HandleLifeSpan) |
1202 --runOnGears(DeleteFarFlungBarrel) |
1195 --runOnGears(DeleteFarFlungBarrel) |
1203 |
1196 |
1204 if CirclesAreGo == true then |
1197 if CirclesAreGo == true and CurrentHedgehog ~= nil then |
1205 CheckDistances() |
1198 CheckDistances() |
1206 --runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason |
1199 --runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason |
1207 --runOnGears(ProjectileTrack) |
1200 --runOnGears(ProjectileTrack) |
1208 end |
1201 end |
1209 |
1202 |
1223 -- start the player tumbling with a boom once their turn has actually begun |
1216 -- start the player tumbling with a boom once their turn has actually begun |
1224 if (tumbleStarted == false) and (gameOver == false) then |
1217 if (tumbleStarted == false) and (gameOver == false) then |
1225 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
1218 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
1226 --AddCaption(LOC_NOT("Good to go!")) |
1219 --AddCaption(LOC_NOT("Good to go!")) |
1227 tumbleStarted = true |
1220 tumbleStarted = true |
1228 TimeLeft = (TurnTime/1000) --45 |
1221 TimeLeft = div(TurnTime, 1000) --45 |
1229 FadeAlpha = 0 |
1222 FadeAlpha = 0 |
1230 rAlpha = 255 |
1223 rAlpha = 255 |
1231 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1224 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1232 DrawTag(0) |
1225 DrawTag(0) |
1233 DrawTag(1) |
1226 DrawTag(1) |
1241 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1234 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1242 |
1235 |
1243 --AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) ) |
1236 --AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) ) |
1244 |
1237 |
1245 -- Calculate and display turn time |
1238 -- Calculate and display turn time |
1246 TimeLeftCounter = TimeLeftCounter + 1 |
1239 if GameTime%1000 == 0 then |
1247 if TimeLeftCounter == 1000 then |
|
1248 TimeLeftCounter = 0 |
|
1249 TimeLeft = TimeLeft - 1 |
1240 TimeLeft = TimeLeft - 1 |
1250 |
1241 |
1251 if TimeLeft >= 0 then |
1242 if TimeLeft >= 0 then |
1252 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1243 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1253 DrawTag(0) |
1244 DrawTag(0) |
1308 chainLength = 0 |
1299 chainLength = 0 |
1309 end |
1300 end |
1310 end |
1301 end |
1311 |
1302 |
1312 -- handle movement based on IO |
1303 -- handle movement based on IO |
1313 moveTimer = moveTimer + 1 |
1304 if GameTime%100 == 0 then -- 100 |
1314 if moveTimer == 100 then -- 100 |
|
1315 --nw WriteLnToConsole("Start of Player MoveTimer") |
1305 --nw WriteLnToConsole("Start of Player MoveTimer") |
1316 moveTimer = 0 |
|
1317 |
1306 |
1318 --------------- |
1307 --------------- |
1319 -- new trail code |
1308 -- new trail code |
1320 --------------- |
1309 --------------- |
1321 -- the trail lets you know you have 5s left to pilot, akin to birdy feathers |
1310 -- the trail lets you know you have 5s left to pilot, akin to birdy feathers |
2259 |
2248 |
2260 |
2249 |
2261 end |
2250 end |
2262 |
2251 |
2263 -- alter the circles velocities |
2252 -- alter the circles velocities |
2264 circAdjustTimer = circAdjustTimer + 1 |
2253 if GameTime%2000 == 0 then |
2265 if circAdjustTimer == 2000 then |
|
2266 |
|
2267 circAdjustTimer = 0 |
|
2268 |
2254 |
2269 for i = 0,(vCCount-1) do |
2255 for i = 0,(vCCount-1) do |
2270 |
2256 |
2271 -- bounce the circles off the edges if they go too far |
2257 -- bounce the circles off the edges if they go too far |
2272 -- or make them move in random directions |
2258 -- or make them move in random directions |
2273 |
2259 |
2274 if vCircX[i] > 5500 then |
2260 if vCircX[i] > 5500 then |
2275 vCircDX[i] = -5 --5 circmovchange |
2261 vCircDX[i] = -4 --5 circmovchange |
2276 elseif vCircX[i] < -1500 then |
2262 elseif vCircX[i] < -1500 then |
2277 vCircDX[i] = 5 --5 circmovchange |
2263 vCircDX[i] = 4 --5 circmovchange |
2278 else |
2264 else |
2279 |
2265 |
2280 z = GetRandom(2) |
2266 z = GetRandom(2) |
2281 if z == 1 then |
2267 if z == 1 then |
2282 z = 1 |
2268 z = 1 |
2285 end |
2271 end |
2286 vCircDX[i] = vCircDX[i] + GetRandom(3)*z --3 circmovchange |
2272 vCircDX[i] = vCircDX[i] + GetRandom(3)*z --3 circmovchange |
2287 end |
2273 end |
2288 |
2274 |
2289 if vCircY[i] > 1500 then |
2275 if vCircY[i] > 1500 then |
2290 vCircDY[i] = -5 --5 circmovchange |
2276 vCircDY[i] = -4 --5 circmovchange |
2291 elseif vCircY[i] < -2900 then |
2277 elseif vCircY[i] < -2900 then |
2292 vCircDY[i] = 5 --5 circmovchange |
2278 vCircDY[i] = 4 --5 circmovchange |
2293 else |
2279 else |
2294 z = GetRandom(2) |
2280 z = GetRandom(2) |
2295 if z == 1 then |
2281 if z == 1 then |
2296 z = 1 |
2282 z = 1 |
2297 else |
2283 else |
2303 end |
2289 end |
2304 |
2290 |
2305 end |
2291 end |
2306 |
2292 |
2307 -- move the circles according to their current velocities |
2293 -- move the circles according to their current velocities |
2308 m2Count = m2Count + 1 |
2294 --m2Count = m2Count + 1 |
2309 if m2Count == 25 then --25 circmovchange |
2295 --if m2Count == 25 then --25 circmovchange |
2310 |
2296 |
2311 m2Count = 0 |
2297 -- m2Count = 0 |
2312 for i = 0,(vCCount-1) do |
2298 for i = 0,(vCCount-1) do |
2313 vCircX[i] = vCircX[i] + vCircDX[i] |
2299 vCircX[i] = vCircX[i] + vCircDX[i] |
2314 vCircY[i] = vCircY[i] + vCircDY[i] |
2300 vCircY[i] = vCircY[i] + vCircDY[i] |
2315 |
2301 |
2316 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2302 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2347 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
2333 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
2348 end |
2334 end |
2349 |
2335 |
2350 |
2336 |
2351 |
2337 |
2352 end |
2338 --end |
2353 |
2339 |
2354 for i = 0,(vCCount-1) do |
2340 for i = 0,(vCCount-1) do |
2355 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2341 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2356 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2342 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2357 end |
2343 end |