share/hedgewars/Data/Maps/Basketball/map.lua
author smxx
Mon, 15 Mar 2010 11:53:32 +0000
changeset 2999 30c4d62cd0c3
child 3000 2b9405b6dc5d
permissions -rw-r--r--
Engine: * Fixed reading localized strings longer than 255 bytes * Fixed weapon tooltip to stay inside visible area in short ammo menus * Allow maps to use their own map.lua file outside training mode (needs multiplayer testing) * Added example script to Basketball map showing clan scores * Fixed Shotgun and Bazooka trainings * Removed basketball script example
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2999
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     1
-- Hedgewars - Basketball for 2 Players
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     2
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     3
local caption = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     4
	["en"] = "Hedgewars-Basketball",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     5
	["de"] = "Hedgewars-Basketball"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     6
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     7
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     8
local subcaption = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
     9
	["en"] = "Not So Friendly Match",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    10
	["de"] = "Kein-so-Freundschaftsspiel"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    11
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    12
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    13
local goal = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    14
	["en"] = "Bat your opponents through the|baskets and out of the map!",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    15
	["de"] = "Schlage deine Widersacher durch|die Körbe und aus der Karte hinaus!"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    16
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    17
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    18
local scored = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    19
	["en"] = " scored a point!",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    20
	["de"] = " erhält einen Punkt!"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    21
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    22
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    23
local sscore = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    24
	["en"] = "Score",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    25
	["de"] = "Punktestand"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    26
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    27
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    28
local team = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    29
	["en"] = "Team"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    30
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    31
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    32
local drowning = {
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    33
	["en"] = "is out and",
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    34
	["de"] = "ist draußen und"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    35
	}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    36
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    37
local function loc(text)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    38
	if text == nil then return "**missing**"
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    39
	elseif text[L] == nil then return text["en"]
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    40
	else return text[L]
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    41
	end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    42
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    43
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    44
---------------------------------------------------------------
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    45
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    46
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    47
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    48
function onGameInit()
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    49
	GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfRandomOrder + gfLowGravity
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    50
	TurnTime = 20000
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    51
	CaseFreq = 0
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    52
	LandAdds = 0
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    53
	Explosives = 0
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    54
	Delay = 0
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    55
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    56
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    57
function onGameStart()
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    58
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    59
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    60
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    61
function onGameTick()
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    62
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    63
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    64
function onAmmoStoreInit()
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    65
	SetAmmo(amBaseballBat, 9, 0, 0)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    66
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    67
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    68
function onGearAdd(gear)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    69
end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    70
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    71
function onGearDelete(gear)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    72
	if GetGearType(gear) == gtHedgehog then
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    73
		local clan = GetHogClan(gear)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    74
		score[clan] = score[clan] + 1
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    75
		local s = loc(sscore) .. ": " .. score[0]
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    76
		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    77
		ShowMission(loc(caption), loc(subcaption), GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " " .. loc(scored) .. "| |" .. s, -amBaseballBat, 0)
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    78
	end
30c4d62cd0c3 Engine:
smxx
parents:
diff changeset
    79
end