author | mikade |
Thu, 01 Sep 2011 00:28:38 +0200 | |
changeset 5720 | a962d0823f49 |
parent 5598 | 265429f7ba85 |
child 5825 | a6eab1b7c00d |
permissions | -rw-r--r-- |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
1 |
------------------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
2 |
-- TUMBLER |
5720 | 3 |
-- v.0.7 |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
4 |
------------------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
5 |
|
4872 | 6 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
7 |
loadfile(GetDataPath() .. "Scripts/Tracker.lua")() |
4872 | 8 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
9 |
local fMod = 1000000 -- use this for dev and .16+ games |
5720 | 10 |
|
4872 | 11 |
local leftOn = false |
12 |
local rightOn = false |
|
13 |
local upOn = false |
|
14 |
local downOn = false |
|
5720 | 15 |
local preciseOn = false |
4872 | 16 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
17 |
local wep = {} |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
18 |
local wepAmmo = {} |
5720 | 19 |
local wepCol = {} |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
20 |
local wepIndex = 0 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
21 |
local wepCount = 0 |
5720 | 22 |
local fGears = 0 |
23 |
||
24 |
local mineSpawn |
|
25 |
local barrelSpawn |
|
26 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
27 |
local roundKills = 0 |
5720 | 28 |
local barrelsEaten = 0 |
29 |
local minesEaten = 0 |
|
4872 | 30 |
|
5720 | 31 |
local moveTimer = 0 |
32 |
local fireTimer = 0 |
|
4872 | 33 |
local TimeLeftCounter = 0 |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
34 |
local TimeLeft = 0 |
4872 | 35 |
local stopMovement = false |
36 |
local tumbleStarted = false |
|
37 |
||
5720 | 38 |
local vTag = {} |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
39 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
40 |
------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
41 |
-- version 0.4 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
42 |
------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
43 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
44 |
-- removed some old code/comments |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
45 |
-- removed both shell and mortar as the primary and secondary weapons |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
46 |
-- the primary weapon is now an explosive(barrel) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
47 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
48 |
-- added support for picking up barrels scattered about the map (backspace) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
49 |
-- added support for dragging around mines (enter toggles on/off) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
50 |
-- added support for primary fire being onAttackUp |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
51 |
-- added a trail to indicate when the player has 5s or less left to tumble |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
52 |
-- updated showmission to reflect changed controls and options |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
53 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
54 |
------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
55 |
-- version 0.5 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
56 |
------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
57 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
58 |
-- changed some of the user feedback |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
59 |
-- i can't remember?? |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
60 |
-- substituted onAttackUp for onPrecise() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
61 |
-- brought in line with new velocity changes |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
62 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
63 |
------------------------ |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
64 |
-- version 0.6 |
4872 | 65 |
------------------------ |
66 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
67 |
-- reduced starting "ammo" |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
68 |
-- randomly spawn new barrels/mines on new turn |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
69 |
-- updated user feedback |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
70 |
-- better locs and coloured addcaptions |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
71 |
-- added tag for turntime |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
72 |
-- removed tractor beam |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
73 |
-- added two new weapons and changed ammo handling |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
74 |
-- health crates now give tumbler time, and wep/utility give flamer ammo |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
75 |
-- explosives AND mines can be picked up to increase their relative ammo |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
76 |
-- replaced "no weapon" selected message that hw serves |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
77 |
-- modified crate frequencies a bit |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
78 |
-- added some simple kill-based achievements, i think |
4872 | 79 |
|
5720 | 80 |
------------------------ |
81 |
-- version 0.7 |
|
82 |
------------------------ |
|
83 |
||
84 |
-- a few code optimisations/performance tweaks |
|
85 |
-- removed some deprecated code |
|
86 |
-- fix a potential spawn bug |
|
87 |
||
88 |
-- improved HUD (now shows ammo counts) |
|
89 |
-- improved user feedback (less generic messages) |
|
90 |
-- colour-coded addcaptions to match hud :) |
|
91 |
||
92 |
-- base tumbling time now equals scheme turntime |
|
93 |
-- tumbling time extension is now based on the amount of health contained in crate |
|
94 |
-- new mines per turn based on minesnum |
|
95 |
-- new barrels per turn based on explosives |
|
96 |
||
97 |
-- added 2 more achievements: barrel eater and mine eater (like kills, don't do anything atm) |
|
98 |
-- slightly increased grab distance for explosives/mines |
|
99 |
-- slightly increased flamer velocity |
|
100 |
-- slightly decreased flamer volume |
|
101 |
-- added a flame vaporiser (based on number of flame gears?) |
|
102 |
-- give tumblers an extra 47 health on the start of their tumble to counter the grenade (exp) |
|
103 |
-- refocus camera on tumbler on newturn (not on crates, barrels etc) |
|
104 |
-- increase delay: yes, yes, eat your hearts out |
|
105 |
||
106 |
-- commit log |
|
107 |
-- Better HUD |
|
108 |
-- Allow more user customization |
|
109 |
-- Bugfix for new gear spawns |
|
110 |
-- Performance tweaks |
|
111 |
-- Variety of small gameplay changes |
|
112 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
113 |
--------------------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
114 |
-- some other ideas/things |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
115 |
--------------------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
116 |
--[[ |
5720 | 117 |
-- add better gameflag handling |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
118 |
-- fix flamer "shots remaining" message on start or choose a standard versus % |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
119 |
-- add more sounds |
5720 | 120 |
-- better barrel/minespawn effects |
121 |
-- separate grab distance for mines/barrels |
|
122 |
-- [probably not] make barrels always explode? |
|
123 |
-- [probably not] persistent ammo? |
|
124 |
-- [probably not] dont hurt tumblers and restore their health at turn end? |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
125 |
]] |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
126 |
|
5720 | 127 |
|
128 |
---------------------------------------------------------------- |
|
129 |
---------------------------------------------------------------- |
|
130 |
||
131 |
local flames = {} |
|
132 |
local fGearValues = {} |
|
133 |
||
134 |
function runOnflames(func) |
|
135 |
for k, gear in ipairs(flames) do |
|
136 |
func(gear) |
|
137 |
end |
|
138 |
end |
|
139 |
||
140 |
function trackFGear(gear) |
|
141 |
table.insert(flames, gear) |
|
142 |
end |
|
143 |
||
144 |
function trackFGearDeletion(gear) |
|
145 |
fGearValues[gear] = nil |
|
146 |
for k, g in ipairs(flames) do |
|
147 |
if g == gear then |
|
148 |
table.remove(flames, k) |
|
149 |
break |
|
150 |
end |
|
151 |
end |
|
152 |
end |
|
153 |
||
154 |
function getFGearValue(gear, key) |
|
155 |
if fGearValues[gear] ~= nil then |
|
156 |
return fGearValues[gear][key] |
|
157 |
end |
|
158 |
return nil |
|
159 |
end |
|
160 |
||
161 |
function setFGearValue(gear, key, value) |
|
162 |
found = false |
|
163 |
for id, values in pairs(fGearValues) do |
|
164 |
if id == gear then |
|
165 |
values[key] = value |
|
166 |
found = true |
|
167 |
end |
|
168 |
end |
|
169 |
if not found then |
|
170 |
fGearValues[gear] = { [key] = value } |
|
171 |
end |
|
172 |
end |
|
173 |
||
174 |
function decreaseFGearValue(gear, key) |
|
175 |
for id, values in pairs(fGearValues) do |
|
176 |
if id == gear then |
|
177 |
values[key] = values[key] - 1 |
|
178 |
end |
|
179 |
end |
|
180 |
end |
|
181 |
||
182 |
function HandleLife(gear) |
|
183 |
||
184 |
decreaseFGearValue(gear, "L") |
|
185 |
if getFGearValue(gear, "L") == 0 then |
|
186 |
AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
|
187 |
DeleteGear(gear) |
|
188 |
end |
|
189 |
||
190 |
end |
|
191 |
||
192 |
---------------------------------------------------------------- |
|
193 |
---------------------------------------------------------------- |
|
194 |
||
195 |
function HideTags() |
|
196 |
||
197 |
for i = 0, 3 do |
|
198 |
SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
|
199 |
end |
|
200 |
||
201 |
end |
|
202 |
||
203 |
function DrawTag(i) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
204 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
205 |
zoomL = 1.3 |
4872 | 206 |
|
5720 | 207 |
xOffset = 40 |
208 |
||
209 |
if i == 0 then |
|
210 |
yOffset = 40 |
|
211 |
tCol = 0xffba00ff --0xffed09ff --0xffba00ff |
|
212 |
tValue = TimeLeft |
|
213 |
elseif i == 1 then |
|
214 |
zoomL = 1.1 |
|
215 |
yOffset = 70 |
|
216 |
tCol = wepCol[0] |
|
217 |
tValue = wepAmmo[0] |
|
218 |
elseif i == 2 then |
|
219 |
zoomL = 1.1 |
|
220 |
xOffset = 40 + 35 |
|
221 |
yOffset = 70 |
|
222 |
tCol = wepCol[1] |
|
223 |
tValue = wepAmmo[1] |
|
224 |
elseif i == 3 then |
|
225 |
zoomL = 1.1 |
|
226 |
xOffset = 40 + 70 |
|
227 |
yOffset = 70 |
|
228 |
tCol = wepCol[2] |
|
229 |
tValue = wepAmmo[2] |
|
230 |
end |
|
231 |
||
232 |
DeleteVisualGear(vTag[i]) |
|
233 |
vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
|
234 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i]) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
235 |
SetVisualGearValues ( |
5720 | 236 |
vTag[i], --id |
237 |
-(ScreenWidth/2) + xOffset, --xoffset |
|
238 |
ScreenHeight - yOffset, --yoffset |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
239 |
0, --dx |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
240 |
0, --dy |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
241 |
zoomL, --zoom |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
242 |
1, --~= 0 means align to screen |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
243 |
g7, --frameticks |
5720 | 244 |
tValue, --value |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
245 |
240000, --timer |
5720 | 246 |
tCol --GetClanColor( GetHogClan(CurrentHedgehog) ) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
247 |
) |
4872 | 248 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
249 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
250 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
251 |
function GetGearDistance(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
252 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
253 |
g1X, g1Y = GetGearPosition(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
254 |
g2X, g2Y = GetGearPosition(CurrentHedgehog) |
4872 | 255 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
256 |
q = g1X - g2X |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
257 |
w = g1Y - g2Y |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
258 |
return( (q*q) + (w*w) ) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
259 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
260 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
261 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
262 |
-- add to your ammo ***WHEN YOU PUSH A KEY*** near them |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
263 |
-- yes that was my justification for a non generic method |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
264 |
function CheckProximityToExplosives(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
265 |
|
5720 | 266 |
if (GetGearDistance(gear) < 1400) then |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
267 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
268 |
if (GetGearType(gear) == gtExplosives) then |
5720 | 269 |
|
270 |
wepAmmo[0] = wepAmmo[0] + 1 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
271 |
PlaySound(sndShotgunReload) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
272 |
DeleteGear(gear) |
5720 | 273 |
AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo ) |
274 |
DrawTag(1) |
|
275 |
||
276 |
barrelsEaten = barrelsEaten + 1 |
|
277 |
if barrelsEaten == 5 then |
|
278 |
AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2) |
|
279 |
end |
|
280 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
281 |
elseif (GetGearType(gear) == gtMine) then |
5720 | 282 |
wepAmmo[1] = wepAmmo[1] + 1 |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
283 |
PlaySound(sndShotgunReload) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
284 |
DeleteGear(gear) |
5720 | 285 |
AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo ) |
286 |
DrawTag(2) |
|
287 |
||
288 |
minesEaten = minesEaten + 1 |
|
289 |
if minesEaten == 5 then |
|
290 |
AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2) |
|
291 |
end |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
292 |
|
5720 | 293 |
end |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
294 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
295 |
else |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
296 |
--AddCaption("There is nothing here...") |
4872 | 297 |
end |
298 |
||
299 |
end |
|
300 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
301 |
-- check proximity on crates |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
302 |
function CheckProximity(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
303 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
304 |
dist = GetGearDistance(gear) |
5720 | 305 |
|
306 |
if (dist < 1600) and (GetGearType(gear) == gtCase) then |
|
307 |
||
308 |
if GetHealth(gear) > 0 then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
309 |
|
5720 | 310 |
AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 ) |
311 |
||
312 |
TimeLeft = TimeLeft + HealthCaseAmount --5 --5s |
|
313 |
DrawTag(0) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
314 |
--PlaySound(sndShotgunReload) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
315 |
else |
5720 | 316 |
wepAmmo[2] = wepAmmo[2] + 800 |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
317 |
PlaySound(sndShotgunReload) |
5720 | 318 |
AddCaption(wep[2] .. " " .. loc("fuel extended!"), wepCol[2], capgrpAmmoinfo ) |
319 |
DrawTag(3) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
320 |
end |
5720 | 321 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
322 |
DeleteGear(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
323 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
324 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
325 |
|
4872 | 326 |
end |
327 |
||
5720 | 328 |
function ChangeWeapon() |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
329 |
|
5720 | 330 |
wepIndex = wepIndex + 1 |
331 |
if wepIndex == wepCount then |
|
332 |
wepIndex = 0 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
333 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
334 |
|
5720 | 335 |
AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo ) |
336 |
AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
337 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
338 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
339 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
340 |
--------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
341 |
-- action keys |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
342 |
--------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
343 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
344 |
function onPrecise() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
345 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
346 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
347 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
348 |
wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
5720 | 349 |
AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
350 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
351 |
if wep[wepIndex] == loc("Barrel Launcher") then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
352 |
morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
353 |
CopyPV(CurrentHedgehog, morte) -- new addition |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
354 |
x,y = GetGearVelocity(morte) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
355 |
x = x*2 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
356 |
y = y*2 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
357 |
SetGearVelocity(morte, x, y) |
5720 | 358 |
DrawTag(1) |
359 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
360 |
elseif wep[wepIndex] == loc("Mine Deployer") then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
361 |
morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
362 |
SetTimer(morte, 1000) |
5720 | 363 |
DrawTag(2) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
364 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
365 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
366 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
367 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
368 |
preciseOn = true |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
369 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
370 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
371 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
372 |
function onPreciseUp() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
373 |
preciseOn = false |
4872 | 374 |
end |
375 |
||
376 |
function onHJump() |
|
5720 | 377 |
-- pick up explosives/mines if nearby them |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
378 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
379 |
runOnGears(CheckProximityToExplosives) |
4872 | 380 |
end |
381 |
end |
|
382 |
||
383 |
function onLJump() |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
384 |
ChangeWeapon() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
385 |
end |
4872 | 386 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
387 |
----------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
388 |
-- movement keys |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
389 |
----------------- |
4872 | 390 |
|
391 |
function onLeft() |
|
392 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) then |
|
393 |
leftOn = true |
|
394 |
end |
|
395 |
end |
|
396 |
||
397 |
function onRight() |
|
398 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) then |
|
399 |
rightOn = true |
|
400 |
end |
|
401 |
end |
|
402 |
||
403 |
function onUp() |
|
404 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) then |
|
405 |
upOn = true |
|
406 |
end |
|
407 |
end |
|
408 |
||
409 |
function onDown() |
|
410 |
if (CurrentHedgehog ~= nil) and (stopMovement == false) then |
|
411 |
downOn = true |
|
412 |
end |
|
413 |
end |
|
414 |
||
415 |
function onDownUp() |
|
416 |
downOn = false |
|
417 |
end |
|
418 |
function onUpUp() |
|
419 |
upOn = false |
|
420 |
end |
|
421 |
function onLeftUp() |
|
422 |
leftOn = false |
|
423 |
end |
|
424 |
function onRightUp() |
|
425 |
rightOn = false |
|
426 |
end |
|
427 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
428 |
-------------------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
429 |
-- other event handlers |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
430 |
-------------------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
431 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
432 |
function onGameInit() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
433 |
CaseFreq = 0 |
5720 | 434 |
HealthCaseProb = 0 |
435 |
Delay = 1000 |
|
436 |
||
437 |
mineSpawn = MinesNum |
|
438 |
if mineSpawn > 4 then |
|
439 |
mineSpawn = 4 |
|
440 |
end |
|
441 |
||
442 |
barrelSpawn = Explosives |
|
443 |
if barrelSpawn > 4 then |
|
444 |
barrelSpawn = 4 |
|
445 |
end |
|
446 |
||
447 |
--MinesNum = 0 |
|
448 |
--Explosives = 0 |
|
449 |
||
450 |
for i = 0, 3 do |
|
451 |
vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
|
452 |
end |
|
453 |
||
454 |
HideTags() |
|
455 |
||
456 |
wep[0] = loc("Barrel Launcher") |
|
457 |
wep[1] = loc("Mine Deployer") |
|
458 |
wep[2] = loc("Flamer") |
|
459 |
||
460 |
wepCol[0] = 0x78818eff |
|
461 |
wepCol[1] = 0xa12a77ff |
|
462 |
wepCol[2] = 0xf49318ff |
|
463 |
||
464 |
wepCount = 3 |
|
465 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
466 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
467 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
468 |
function onGameStart() |
5720 | 469 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
470 |
ShowMission ( |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
471 |
"TUMBLER", |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
472 |
loc("a Hedgewars mini-game"), |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
473 |
loc("Eliminate the enemy hogs to win.") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
474 |
" " .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
475 |
|
5720 | 476 |
loc("New Mines Per Turn") .. ": " .. (mineSpawn) .. "|" .. |
477 |
loc("New Barrels Per Turn") .. ": " .. (barrelSpawn) .. "|" .. |
|
478 |
loc("Time Extension") .. ": " .. (HealthCaseAmount) .. loc("sec") .. "|" .. |
|
479 |
" " .. "|" .. |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
480 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
481 |
loc("Movement: [Up], [Down], [Left], [Right]") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
482 |
loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
483 |
loc("Change Weapon") .. ": " .. loc("[Enter]") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
484 |
loc("Grab Mines/Explosives") .. ": " .. loc("[Backspace]") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
485 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
486 |
" " .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
487 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
488 |
loc("Health crates extend your time.") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
489 |
loc("Ammo is reset at the end of your turn.") .. "|" .. |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
490 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
491 |
"", 4, 4000 |
5720 | 492 |
) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
493 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
494 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
495 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
496 |
|
4872 | 497 |
function onNewTurn() |
5720 | 498 |
|
4872 | 499 |
stopMovement = false |
500 |
tumbleStarted = false |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
501 |
|
5720 | 502 |
-- randomly create new barrels mines on the map every turn (can be disabled by setting mine/barrels to 0 in scheme) |
503 |
for i = 0, barrelSpawn-1 do |
|
504 |
gear = AddGear(100, 100, gtExplosives, 0, 0, 0, 0) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
505 |
SetHealth(gear, 100) |
5720 | 506 |
if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then |
507 |
tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
508 |
end |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
509 |
end |
5720 | 510 |
for i = 0, mineSpawn-1 do |
511 |
gear = AddGear(100, 100, gtMine, 0, 0, 0, 0) |
|
512 |
if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then |
|
513 |
tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
514 |
end |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
515 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
516 |
|
5720 | 517 |
-- randomly spawn time extension crates / flamer fuel on the map |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
518 |
r = GetRandom(100) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
519 |
if r > 50 then |
5720 | 520 |
gear = SpawnHealthCrate(0, 0) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
521 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
522 |
r = GetRandom(100) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
523 |
if r > 70 then |
5720 | 524 |
gear = SpawnAmmoCrate(0, 0, amSkip) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
525 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
526 |
|
5720 | 527 |
HideTags() |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
528 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
529 |
--reset ammo counts |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
530 |
wepAmmo[0] = 2 |
5720 | 531 |
wepAmmo[1] = 1 |
532 |
wepAmmo[2] = 50 -- 50000 -- 50 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
533 |
wepIndex = 2 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
534 |
ChangeWeapon() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
535 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
536 |
roundKills = 0 |
5720 | 537 |
barrelsEaten = 0 |
538 |
minesEaten = 0 |
|
539 |
||
540 |
FollowGear(CurrentHedgehog) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
541 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
542 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
543 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
544 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
545 |
function DisableTumbler() |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
546 |
stopMovement = true |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
547 |
upOn = false |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
548 |
down = false |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
549 |
leftOn = false |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
550 |
rightOn = false |
5720 | 551 |
HideTags() |
4872 | 552 |
end |
553 |
||
554 |
function onGameTick() |
|
555 |
||
556 |
-- start the player tumbling with a boom once their turn has actually begun |
|
557 |
if tumbleStarted == false then |
|
558 |
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
559 |
--AddCaption(loc("Good to go!")) |
4872 | 560 |
tumbleStarted = true |
5720 | 561 |
TimeLeft = (TurnTime/1000) |
4872 | 562 |
AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
5720 | 563 |
SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new |
564 |
for i = 0, 3 do |
|
565 |
DrawTag(i) |
|
566 |
end |
|
4872 | 567 |
end |
568 |
end |
|
569 |
||
570 |
if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
|
571 |
||
5720 | 572 |
runOnGears(CheckProximity) -- crates |
4872 | 573 |
|
574 |
-- Calculate and display turn time |
|
575 |
TimeLeftCounter = TimeLeftCounter + 1 |
|
576 |
if TimeLeftCounter == 1000 then |
|
577 |
TimeLeftCounter = 0 |
|
578 |
TimeLeft = TimeLeft - 1 |
|
579 |
||
580 |
if TimeLeft >= 0 then |
|
5720 | 581 |
DrawTag(0) |
4872 | 582 |
end |
583 |
||
584 |
end |
|
585 |
||
586 |
if TimeLeft == 0 then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
587 |
DisableTumbler() |
4872 | 588 |
end |
589 |
||
590 |
-- handle movement based on IO |
|
591 |
moveTimer = moveTimer + 1 |
|
592 |
if moveTimer == 100 then -- 100 |
|
593 |
moveTimer = 0 |
|
594 |
||
5720 | 595 |
runOnflames(HandleLife) |
596 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
597 |
--------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
598 |
-- new trail code |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
599 |
--------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
600 |
-- the trail lets you know you have 5s left to pilot, akin to birdy feathers |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
601 |
if (TimeLeft <= 5) and (TimeLeft > 0) then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
602 |
tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
603 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
604 |
SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) ) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
605 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
606 |
-------------- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
607 |
|
4872 | 608 |
dx, dy = GetGearVelocity(CurrentHedgehog) |
609 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
610 |
dxlimit = 0.4*fMod |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
611 |
dylimit = 0.4*fMod |
4872 | 612 |
|
613 |
if dx > dxlimit then |
|
614 |
dx = dxlimit |
|
615 |
end |
|
616 |
if dy > dylimit then |
|
617 |
dy = dylimit |
|
618 |
end |
|
619 |
if dx < -dxlimit then |
|
620 |
dx = -dxlimit |
|
621 |
end |
|
622 |
if dy < -dylimit then |
|
623 |
dy = -dylimit |
|
624 |
end |
|
625 |
||
626 |
||
627 |
if leftOn == true then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
628 |
dx = dx - 0.1*fMod |
4872 | 629 |
end |
630 |
if rightOn == true then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
631 |
dx = dx + 0.1*fMod |
4872 | 632 |
end |
633 |
||
634 |
if upOn == true then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
635 |
dy = dy - 0.1*fMod |
4872 | 636 |
end |
637 |
if downOn == true then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
638 |
dy = dy + 0.1*fMod |
4872 | 639 |
end |
640 |
||
641 |
SetGearVelocity(CurrentHedgehog, dx, dy) |
|
642 |
||
643 |
end |
|
644 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
645 |
-- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
646 |
--flamer |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
647 |
-- |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
648 |
fireTimer = fireTimer + 1 |
5720 | 649 |
if fireTimer == 6 then -- 5 --10 |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
650 |
fireTimer = 0 |
4872 | 651 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
652 |
if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
653 |
|
5720 | 654 |
wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
655 |
AddCaption( |
|
656 |
loc("Flamer") .. ": " .. |
|
657 |
(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%", |
|
658 |
wepCol[2], |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
659 |
capgrpMessage2 |
5720 | 660 |
) |
661 |
DrawTag(3) |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
662 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
663 |
dx, dy = GetGearVelocity(CurrentHedgehog) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
664 |
shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0) |
4872 | 665 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
666 |
xdev = 1 + GetRandom(25) --15 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
667 |
xdev = xdev / 100 |
4872 | 668 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
669 |
r = GetRandom(2) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
670 |
if r == 1 then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
671 |
xdev = xdev*-1 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
672 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
673 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
674 |
ydev = 1 + GetRandom(25) --15 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
675 |
ydev = ydev / 100 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
676 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
677 |
r = GetRandom(2) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
678 |
if r == 1 then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
679 |
ydev = ydev*-1 |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
680 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
681 |
|
5720 | 682 |
--*13 --8 *-4 |
683 |
SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod)) --10 |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
684 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
685 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
686 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
687 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
688 |
-- |
4872 | 689 |
|
690 |
end |
|
691 |
||
692 |
||
693 |
end |
|
694 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
695 |
function isATrackedGear(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
696 |
if (GetGearType(gear) == gtExplosives) or |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
697 |
(GetGearType(gear) == gtMine) or |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
698 |
(GetGearType(gear) == gtCase) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
699 |
then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
700 |
return(true) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
701 |
else |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
702 |
return(false) |
4872 | 703 |
end |
704 |
end |
|
705 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
706 |
--[[function onGearDamage(gear, damage) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
707 |
if gear == CurrentHedgehog then |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
708 |
-- You are now tumbling |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
709 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
710 |
end]] |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
711 |
|
4872 | 712 |
function onGearAdd(gear) |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
713 |
|
5720 | 714 |
if GetGearType(gear) == gtFlame then |
715 |
||
716 |
trackFGear(gear) |
|
717 |
||
718 |
fGears = fGears +1 |
|
719 |
||
720 |
if fGears < 80 then |
|
721 |
setFGearValue(gear,"L",30) |
|
722 |
else |
|
723 |
setFGearValue(gear,"L",5) --3 |
|
724 |
end |
|
725 |
||
726 |
elseif isATrackedGear(gear) then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
727 |
trackGear(gear) |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
728 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
729 |
|
4872 | 730 |
end |
731 |
||
732 |
function onGearDelete(gear) |
|
733 |
||
5720 | 734 |
if GetGearType(gear) == gtFlame then |
735 |
trackFGearDeletion(gear) |
|
736 |
fGears = fGears -1 |
|
737 |
||
738 |
elseif isATrackedGear(gear) then |
|
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
739 |
trackDeletion(gear) |
5720 | 740 |
|
741 |
-- achievements? prototype |
|
742 |
elseif GetGearType(gear) == gtHedgehog then |
|
743 |
||
744 |
if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then |
|
745 |
||
746 |
roundKills = roundKills + 1 |
|
747 |
if roundKills == 2 then |
|
748 |
AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2) |
|
749 |
elseif roundKills == 3 then |
|
750 |
AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2) |
|
751 |
elseif roundKills >= 4 then |
|
752 |
AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2) |
|
753 |
end |
|
754 |
||
755 |
elseif gear == CurrentHedgehog then |
|
756 |
DisableTumbler() |
|
757 |
||
758 |
elseif gear ~= CurrentHedgehog then |
|
759 |
AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2) |
|
760 |
end |
|
761 |
||
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
762 |
end |
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
763 |
|
4872 | 764 |
if CurrentHedgehog ~= nil then |
765 |
FollowGear(CurrentHedgehog) |
|
766 |
end |
|
767 |
||
5720 | 768 |
end |
5598
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
769 |
|
265429f7ba85
- Updates to Tumbler gameplay mode [may still need a lil work]
mikade
parents:
5325
diff
changeset
|
770 |