share/hedgewars/Data/Scripts/Multiplayer/GaudyRacer.lua
author claymore
Fri, 08 Apr 2011 21:15:57 +0200
changeset 5127 b0b6f17a6a3c
parent 4872 6b2fb9f0054a
child 5325 261b79ba22b1
permissions -rw-r--r--
added Balanced Random Weapon gameplay script
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4872
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     2
------------------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     3
-- RACER
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     4
-- a crazy, map-independant racing script
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     5
-- by mikade
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     6
-----------------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     7
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     8
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
     9
--0.1: with apologies to tumbler
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    10
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    11
-- added tumbler movement system
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    12
-- added weapon systems
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    13
-- added timer to stop tumbler
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    14
-- added racer circle arrays
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    15
-- added changing of circs on contact
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    16
-- added a "track complete" etc
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    17
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    18
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    19
--0.2: for your racing convenience
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    20
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    21
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    22
-- added resurrection
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    23
-- added team tracking
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    24
-- added proper scoring (hopefully, finally)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    25
-- changed showmission icons to match feedback
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    26
-- changed circles to be netural colours, and then change to team col
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    27
-- cleaned up code
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    28
-- cleaned up gameplay: removing control on resurrect, trackcomplete, maxpointset etc
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    29
-- improved player feedback: race record, clan record, no record etc.
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    30
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    31
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    32
--0.3: user-requested features
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    33
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    34
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    35
-- hogs now start at the location of the first waypoint \o/
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    36
-- added sticky camera. Hog will no longer lose focus on explosions etc.
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    37
-- increased maximum complexity for tracks
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    38
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    39
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    40
--0.4: user-requested features
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    41
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    42
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    43
-- added movement trail
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    44
-- removed exploder weapon
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    45
-- removed mortar weapon
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    46
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    47
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    48
-- 0.5 gaudy feature experimentation
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    49
-----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    50
-- added a booster
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    51
-- added flame trail for booster
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    52
-- added and removed dx/dy on mortar launch
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    53
-- added and removed keypress-based mortar fire
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    54
-- changed mortar for a gtShell, probably more useful for tunneling
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    55
-- added dx/dy *2 shell fire
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    56
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    57
----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    58
-- 0.6 modesty / display mod
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    59
----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    60
-- author branding removed
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    61
-- version numbers removed
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    62
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    63
-----------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    64
-- SCRIPT BEGINS
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    65
-----------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    66
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    67
-- enable awesome translaction support so we can use loc() wherever we want
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    68
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    69
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    70
------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    71
-- Got Variables?
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    72
------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    73
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    74
local roundLimit = 3
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    75
local roundNumber = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    76
local firstClan = 10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    77
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    78
local versionNo = loc("v.06")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    79
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    80
--------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    81
-- hog and team tracking variales
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    82
--------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    83
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    84
local numhhs = 0 -- store number of hedgehogs
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    85
local hhs = {} -- store hedgehog gears
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    86
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    87
local numTeams --  store the number of teams in the game
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    88
local teamNameArr = {}	-- store the list of teams
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    89
local teamClan = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    90
local teamSize = {}	-- store how many hogs per team
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    91
local teamIndex = {} -- at what point in the hhs{} does each team begin
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    92
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    93
local teamComment = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    94
local teamScore = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    95
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    96
---------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    97
-- tumbler stuff
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    98
---------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
    99
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   100
local moveTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   101
local leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   102
local rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   103
local upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   104
local downOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   105
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   106
local shotsMax = 30	--10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   107
local shotsLeft = 10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   108
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   109
local TimeLeftCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   110
local TimeLeft = 60
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   111
local stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   112
local tumbleStarted = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   113
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   114
-------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   115
-- racer vars
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   116
--------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   117
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   118
local boosterOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   119
local boosterFuel = 75
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   120
local boosterPower = 0.3
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   121
local boosterTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   122
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   123
local bestClan = nil
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   124
local bestTime = nil
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   125
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   126
local gameBegun = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   127
local gameOver = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   128
local racerActive = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   129
local trackTime = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   130
local wpCheckCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   131
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   132
local wpCirc = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   133
local wpX = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   134
local wpY = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   135
local wpCol = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   136
local wpActive = {}
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   137
local wpRad = 75
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   138
local wpCount = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   139
local wpLimit = 20
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   140
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   141
-------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   142
-- general methods
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   143
-------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   144
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   145
function RebuildTeamInfo()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   146
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   147
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   148
	-- make a list of individual team names
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   149
	for i = 0, 7 do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   150
		teamNameArr[i] = " " -- = i
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   151
		teamSize[i] = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   152
		teamIndex[i] = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   153
		teamScore[i] = 100000
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   154
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   155
	numTeams = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   156
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   157
	for i = 0, (numhhs-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   158
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   159
		z = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   160
		unfinished = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   161
		while(unfinished == true) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   162
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   163
			newTeam = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   164
			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   165
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   166
			if tempHogTeamName == teamNameArr[z] then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   167
				newTeam = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   168
				unfinished = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   169
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   170
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   171
			z = z + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   172
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   173
			if z == TeamsCount then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   174
				unfinished = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   175
				if newTeam == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   176
					teamNameArr[numTeams] = tempHogTeamName
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   177
					numTeams = numTeams + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   178
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   179
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   180
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   181
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   182
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   183
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   184
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   185
	-- find out how many hogs per team, and the index of the first hog in hhs
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   186
	for i = 0, (numTeams-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   187
		for z = 0, (numhhs-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   188
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   189
				teamClan[i] = GetHogClan(hhs[z])
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   190
				if teamSize[i] == 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   191
					teamIndex[i] = z -- should give starting index
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   192
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   193
				teamSize[i] = teamSize[i] + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   194
				--add a pointer so this hog appears at i in hhs
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   195
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   196
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   197
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   198
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   199
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   200
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   201
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   202
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   203
-----------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   204
-- RACER METHODS
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   205
-----------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   206
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   207
function GetSpeed()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   208
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   209
	dx, dy = GetGearVelocity(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   210
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   211
	x = dx*dx
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   212
	y = dy*dy
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   213
	z = x+y
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   214
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   215
	z = z*100
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   216
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   217
	k = z%1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   218
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   219
	if k ~= 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   220
	 z = z - k
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   221
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   222
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   223
	return(z)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   224
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   225
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   226
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   227
function CheckWaypoints()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   228
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   229
	trackFinished = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   230
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   231
	for i = 0, (wpCount-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   232
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   233
		g1X, g1Y = GetGearPosition(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   234
		g2X, g2Y = wpX[i], wpY[i]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   235
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   236
		g1X = g1X - g2X
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   237
		g1Y = g1Y - g2Y
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   238
		dist = (g1X*g1X) + (g1Y*g1Y)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   239
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   240
		--if i == 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   241
		--	AddCaption(dist .. "/" .. (wpRad*wpRad) )
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   242
		--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   243
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   244
		if dist < (wpRad*wpRad) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   245
			--AddCaption("howdy")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   246
			wpActive[i] = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   247
			wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new				--GetClanColor(1)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   248
			SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 0, 10, 0, wpRad, 5, wpCol[i])
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   249
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   250
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   251
		if wpActive[i] == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   252
			trackFinished = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   253
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   254
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   255
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   256
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   257
	return(trackFinished)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   258
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   259
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   260
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   261
function AdjustScores()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   262
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   263
	--[[if bestTime == nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   264
		bestTime = 100000
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   265
		bestClan = 10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   266
		bestTimeComment = "N/A"
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   267
	else
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   268
		bestTimeComment = (bestTime/1000) ..loc("s")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   269
	end]]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   270
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   271
	if bestTime == nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   272
		bestTime = 100000
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   273
		bestClan = 10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   274
		bestTimeComment = "N/A"
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   275
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   276
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   277
	newScore = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   278
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   279
	-- update this clan's time if the new track is better
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   280
	for i = 0, (numTeams-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   281
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   282
			if trackTime < teamScore[i] then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   283
				teamScore[i] = trackTime
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   284
				newScore = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   285
			else
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   286
				newScore = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   287
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   288
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   289
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   290
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   291
	--bestTime = 100000
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   292
	--bestClan = 10
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   293
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   294
	-- find the best time out of those so far
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   295
	for i = 0, (numTeams-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   296
		if teamScore[i] < bestTime then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   297
			bestTime = teamScore[i]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   298
			bestClan = teamClan[i]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   299
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   300
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   301
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   302
	if bestTime ~= 100000 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   303
		bestTimeComment = (bestTime/1000) ..loc("s")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   304
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   305
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   306
	if newScore == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   307
		if trackTime == bestTime then -- best time of the race
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   308
			ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   309
		else	-- best time for the clan
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   310
			ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   311
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   312
	else -- not any kind of new score
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   313
		ShowMission(loc("RACER"), loc("TRACK COMPLETED"), loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" .. loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   314
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   315
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   316
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   317
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   318
function CheckForNewRound()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   319
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   320
	if GetHogClan(CurrentHedgehog) == firstClan then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   321
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   322
		roundNumber = roundNumber + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   323
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   324
		for i = 0, 7 do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   325
				if teamNameArr[i] ~= " " then				-- teamScore[teamClan[i]]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   326
					teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   327
				elseif teamNameArr[i] == " " then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   328
					teamComment[i] = "|"
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   329
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   330
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   331
		ShowMission(loc("RACER"), loc("STATUS UPDATE"), loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" .. loc("Best Team Times: ") .. "|" .. teamComment[0] .. teamComment[1] .. teamComment[2] .. teamComment[3] .. teamComment[4] .. teamComment[5] .. teamComment[6] .. teamComment[7], 0, 1600)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   332
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   333
		-- end game if its at round limit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   334
		if roundNumber == roundLimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   335
			for i = 0, (numhhs-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   336
				if GetHogClan(hhs[i]) ~= bestClan then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   337
					SetEffect(hhs[i], heResurrectable, false)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   338
					SetHealth(hhs[i],0)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   339
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   340
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   341
			gameOver = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   342
			TurnTimeLeft = 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   343
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   344
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   345
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   346
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   347
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   348
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   349
function DisableTumbler()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   350
	stopMovement = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   351
	upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   352
	down = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   353
	leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   354
	rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   355
	boosterOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   356
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   357
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   358
----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   359
-- GAME METHODS / EVENT HANDLERS
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   360
----------------------------------
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   361
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   362
function onGameInit()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   363
	--Theme = "Hell"
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   364
	--GameFlags
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   365
	--GameFlags = gfDisableWind
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   366
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   367
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   368
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   369
function onGameStart()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   370
	RebuildTeamInfo()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   371
	ShowMission(loc("RACER"), "", "", 4, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   372
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   373
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   374
function onHJump()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   375
	if (shotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then -- seems to not work with a hedgehog nil chek
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   376
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   377
		shotsLeft = shotsLeft - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   378
		morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtShell, 0, 0, 0, 1)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   379
		AddCaption(loc("Shots Left: ") .. shotsLeft)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   380
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   381
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   382
		-- based on player movement already
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   383
		CopyPV(CurrentHedgehog, morte) -- new addition
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   384
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   385
		--x2
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   386
		x,y = GetGearVelocity(morte)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   387
		x = x*2
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   388
		y = y*2
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   389
		SetGearVelocity(morte, x, y)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   390
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   391
		--- or based on keys?
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   392
		--[[x = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   393
		y = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   394
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   395
		launchPower = 0.5
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   396
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   397
		if leftOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   398
			x = x - launchPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   399
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   400
		if rightOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   401
			x = x + launchPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   402
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   403
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   404
		if upOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   405
			y = y - launchPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   406
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   407
		if downOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   408
			y = y + launchPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   409
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   410
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   411
		SetGearVelocity(morte, x, y)]]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   412
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   413
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   414
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   415
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   416
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   417
function onLJump()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   418
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   419
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   420
	if (wpCount < wpLimit) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (gameBegun == false) then -- seems to not work with a hedgehog nil chek
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   421
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   422
		wpX[wpCount] = GetX(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   423
		wpY[wpCount] = GetY(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   424
		wpCol[wpCount] = 0xffffffff
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   425
		wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   426
																		--100	  --0		--75	--wpCol[wpCount]
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   427
		SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 0, 10, 0, wpRad, 5, wpCol[wpCount])
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   428
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   429
		wpCount = wpCount + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   430
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   431
		AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   432
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   433
		if wpCount == wpLimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   434
			AddCaption(loc("Race complexity limit reached."))
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   435
			DisableTumbler()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   436
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   437
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   438
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   439
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   440
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   441
	if (boosterFuel > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (gameBegun == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   442
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   443
		if boosterOn == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   444
			boosterOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   445
		else
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   446
			boosterOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   447
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   448
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   449
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   450
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   451
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   452
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   453
function onLeft()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   454
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   455
		leftOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   456
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   457
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   458
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   459
function onRight()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   460
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   461
		rightOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   462
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   463
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   464
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   465
function onUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   466
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   467
		upOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   468
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   469
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   470
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   471
function onDown()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   472
	if (CurrentHedgehog ~= nil) and (stopMovement == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   473
		downOn = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   474
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   475
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   476
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   477
function onDownUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   478
	downOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   479
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   480
function onUpUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   481
	upOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   482
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   483
function onLeftUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   484
	leftOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   485
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   486
function onRightUp()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   487
	rightOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   488
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   489
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   490
function onNewTurn()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   491
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   492
	CheckForNewRound()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   493
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   494
	--if gameOver == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   495
		shotsLeft = shotsMax
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   496
		stopMovement = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   497
		tumbleStarted = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   498
		boosterOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   499
		boosterFuel = 75
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   500
		SetTag(AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1), boosterFuel)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   501
		--SetInputMask(band(0xFFFFFFFF, bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLeft+gmLJump+gmPrecise+gmRight+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon)))
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   502
		--AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   503
	--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   504
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   505
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   506
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   507
	-- Set the waypoints to unactive on new round
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   508
	for i = 0,(wpCount-1) do
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   509
		wpActive[i] = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   510
		wpCol[i] = 0xffffffff
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   511
		SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 0, 10, 0, wpRad, 5, wpCol[i])
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   512
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   513
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   514
	-- Handle Starting Stage of Game
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   515
	if (gameOver == false) and (gameBegun == false) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   516
		if wpCount >= 3 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   517
			gameBegun = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   518
			racerActive = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   519
			roundNumber = 0 -- 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   520
			firstClan = GetHogClan(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   521
			ShowMission(loc("RACER"), loc("GAME BEGUN!!!"), loc("Complete the track as fast as you can!"), 2, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   522
		else
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   523
			ShowMission(loc("RACER"), loc("NOT ENOUGH WAYPOINTS"), loc("Place more waypoints using [ENTER]"), 2, 4000)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   524
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   525
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   526
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   527
	if gameOver == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   528
		gameBegun = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   529
		stopMovement = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   530
		tumbleStarted = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   531
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   532
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   533
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   534
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   535
function onGameTick()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   536
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   537
	-- start the player tumbling with a boom once their turn has actually begun
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   538
	if tumbleStarted == false then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   539
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   540
			AddCaption("Good to go!")
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   541
			tumbleStarted = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   542
			racerActive = true
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   543
			trackTime = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   544
			TimeLeft = 60
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   545
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   546
			-- if the gamehas started put the player in the middle of the first
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   547
			--waypoint that was placed
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   548
			if gameBegun == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   549
				SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   550
				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   551
				FollowGear(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   552
			else -- otherwise just start him tumbling from wherever he is
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   553
				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   554
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   555
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   556
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   557
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   558
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   559
	-- has the player started his tumbling spree?
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   560
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   561
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   562
		--AddCaption(loc("Speed: ") .. GetSpeed())
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   563
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   564
		-- if the RACE has started, show tracktimes and keep tabs on waypoints
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   565
		if (racerActive == true) and (gameBegun == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   566
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   567
			trackTime = trackTime + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   568
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   569
			wpCheckCounter = wpCheckCounter + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   570
			if (wpCheckCounter == 100) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   571
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   572
				AddCaption(loc("Track Time: ") .. (trackTime/1000) .. loc("s") )
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   573
				wpCheckCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   574
				if (CheckWaypoints() == true) then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   575
					AdjustScores()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   576
					racerActive = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   577
					DisableTumbler()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   578
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   579
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   580
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   581
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   582
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   583
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   584
		if boosterOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   585
			boosterTimer = boosterTimer + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   586
			if boosterTimer == 150 then --200
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   587
				boosterTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   588
				boosterFuel = boosterFuel - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   589
				SetTag(AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1), boosterFuel)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   590
				if boosterFuel == 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   591
					boosterOn = false
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   592
				end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   593
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   594
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   595
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   596
		-- Calculate and display turn time
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   597
		TimeLeftCounter = TimeLeftCounter + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   598
		if TimeLeftCounter == 1000 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   599
			TimeLeftCounter = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   600
			TimeLeft = TimeLeft - 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   601
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   602
			if TimeLeft >= 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   603
				--TurnTimeLeft = TimeLeft
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   604
				--AddCaption(loc("Time Left: ") .. TimeLeft)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   605
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   606
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   607
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   608
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   609
		-- if the player has expended his tunbling time, stop him tumbling
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   610
		if TimeLeft == 0 then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   611
			DisableTumbler()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   612
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   613
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   614
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   615
		-- handle movement based on IO
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   616
		moveTimer = moveTimer + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   617
		if moveTimer == 100 then -- 100
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   618
			moveTimer = 0
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   619
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   620
			-- keep in mind gravity is acting on the hog
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   621
			-- so his down is more powerful than his up
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   622
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   623
			dx, dy = GetGearVelocity(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   624
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   625
			dxlimit = 0.4 --0.4
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   626
			dylimit = 0.4 --0.4
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   627
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   628
			if boosterOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   629
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   630
				--flame trail, now removed
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   631
				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   632
				--tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   633
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   634
				dxlimit = dxlimit + boosterPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   635
				dylimit = dylimit + boosterPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   636
			else
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   637
				tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   638
				g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   639
				SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   640
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   641
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   642
			if dx > dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   643
				dx = dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   644
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   645
			if dy > dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   646
				dy = dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   647
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   648
			if dx < -dxlimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   649
				dx = -dxlimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   650
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   651
			if dy < -dylimit then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   652
				dy = -dylimit
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   653
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   654
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   655
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   656
			dxPower = 0.1 --0.1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   657
			dyPower = 0.1 --0.1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   658
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   659
			if leftOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   660
				dx = dx - dxPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   661
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   662
			if rightOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   663
				dx = dx + dxPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   664
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   665
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   666
			if upOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   667
				dy = dy - dyPower -- -0.1 -- new addition
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   668
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   669
			if downOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   670
				dy = dy + dyPower
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   671
			end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   672
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   673
			--if leftOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   674
			--	dx = dx - 0.04
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   675
			--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   676
			--if rightOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   677
			--	dx = dx + 0.04
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   678
			--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   679
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   680
			--if upOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   681
			--	dy = dy - 0.1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   682
			--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   683
			--if downOn == true then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   684
			--	dy = dy + 0.06
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   685
			--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   686
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   687
			SetGearVelocity(CurrentHedgehog, dx, dy)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   688
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   689
		end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   690
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   691
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   692
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   693
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   694
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   695
function onGearDamage(gear, damage)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   696
	--if gear == CurrentHedgehog then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   697
		-- You are now tumbling
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   698
	--end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   699
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   700
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   701
function onGearResurrect(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   702
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   703
	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   704
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   705
	-- if the player stops and "dies" or flies into water, stop him tumbling
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   706
	if gear == CurrentHedgehog then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   707
		DisableTumbler()
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   708
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   709
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   710
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   711
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   712
function onGearAdd(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   713
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   714
	if GetGearType(gear) == gtHedgehog then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   715
		hhs[numhhs] = gear
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   716
		numhhs = numhhs + 1
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   717
		SetEffect(gear, heResurrectable, true)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   718
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   719
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   720
end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   721
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   722
function onGearDelete(gear)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   723
	--not needed today, yet
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   724
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   725
	--sticky camera
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   726
	if CurrentHedgehog ~= nil then
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   727
		FollowGear(CurrentHedgehog)
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   728
	end
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   729
6b2fb9f0054a Two new gameplay modes: Tumbler and Racer.
mikade
parents:
diff changeset
   730
end