1 -- Hedgewars - Basketball for 2 Players |
|
2 |
|
3 local caption = { |
|
4 ["en"] = "Hedgewars-Basketball", |
|
5 ["de"] = "Hedgewars-Basketball" |
|
6 } |
|
7 |
|
8 local subcaption = { |
|
9 ["en"] = "2 Player Match", |
|
10 ["de"] = "2-Spieler-Turnier" |
|
11 } |
|
12 |
|
13 local goal = { |
|
14 ["en"] = "Bat your opponents through the|baskets and out of the map!", |
|
15 ["de"] = "Schlage deine Widersacher durch|die Körbe und aus der Karte hinaus!" |
|
16 } |
|
17 |
|
18 local scored = { |
|
19 ["en"] = " scored a point!", |
|
20 ["de"] = " haben gepunktet!" |
|
21 } |
|
22 |
|
23 local sscore = { |
|
24 ["en"] = "Score", |
|
25 ["de"] = "Punktestand" |
|
26 } |
|
27 |
|
28 local teams = {} |
|
29 teams[0] = { |
|
30 ["en"] = "The Hogville Wizards", |
|
31 ["de"] = "Die Igeldorf-Zauberer" |
|
32 } |
|
33 teams[1] = { |
|
34 ["en"] = "The Hogmore Ravens", |
|
35 ["de"] = "Die Igelmoor-Raben" |
|
36 } |
|
37 |
|
38 local hognames = {} |
|
39 hognames[0] = {"Michael", "Jason", "Mike", "Tom"} |
|
40 hognames[1] = {"Diego", "Sam", "Jay", "Hank"} |
|
41 |
|
42 -- To handle missing texts we define a small wrapper function that |
|
43 -- we'll use to retrieve text. |
|
44 local function loc(text) |
|
45 if text == nil then return "**missing**" |
|
46 elseif text[L] == nil then return text["en"] |
|
47 else return text[L] |
|
48 end |
|
49 end |
|
50 |
|
51 --------------------------------------------------------------- |
|
52 |
|
53 local hogs = {} |
|
54 hogs[0] = {nil, nil, nil, nil} |
|
55 hogs[1] = {nil, nil, nil, nil} |
|
56 |
|
57 function onGameInit() |
|
58 Seed = 0 |
|
59 GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfRandomOrder + gfLowGravity |
|
60 TurnTime = 15000 |
|
61 CaseFreq = 0 |
|
62 LandAdds = 0 |
|
63 Explosives = 0 |
|
64 Delay = 0 |
|
65 Map = "basketball" |
|
66 Theme = "Freeway" |
|
67 |
|
68 AddTeam(loc(teams[0]), 0xff0000, "Simple", "Island", "Default") |
|
69 hogs[0][1] = AddHog(hognames[0][1], 0, 1, "NoHat") |
|
70 hogs[0][2] = AddHog(hognames[0][2], 0, 1, "NoHat") |
|
71 hogs[0][3] = AddHog(hognames[0][3], 0, 1, "NoHat") |
|
72 hogs[0][4] = AddHog(hognames[0][4], 0, 1, "NoHat") |
|
73 AddTeam(loc(teams[1]), 0x0000ff, "Simple", "Island", "Default") |
|
74 hogs[1][1] = AddHog(hognames[1][1], 0, 1, "NoHat") |
|
75 hogs[1][2] = AddHog(hognames[1][2], 0, 1, "NoHat") |
|
76 hogs[1][3] = AddHog(hognames[1][3], 0, 1, "NoHat") |
|
77 hogs[1][4] = AddHog(hognames[1][4], 0, 1, "NoHat") |
|
78 end |
|
79 |
|
80 function onGameStart() |
|
81 ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0); |
|
82 end |
|
83 |
|
84 function onGameTick() |
|
85 end |
|
86 |
|
87 function onAmmoStoreInit() |
|
88 SetAmmo(amBaseballBat, 9, 0, 0) |
|
89 end |
|
90 |
|
91 function onGearAdd(gear) |
|
92 end |
|
93 |
|
94 local score = {0, 0} |
|
95 function onGearDelete(gear) |
|
96 if gear == hogs[0][1] or gear == hogs[0][2] or gear == hogs[0][3] or gear == hogs[0][4] then |
|
97 score[2] = score[2] + 1 |
|
98 ShowMission(loc(caption), loc(subcaption), loc(teams[1]) .. " " .. loc(scored) .. "|" .. loc(sscore) .. ": " .. score[1] .. " - " .. score[2], -amBaseballBat, 0); |
|
99 elseif gear == hogs[1][1] or gear == hogs[1][2] or gear == hogs[1][3] or gear == hogs[1][4] then |
|
100 score[1] = score[1] + 1 |
|
101 ShowMission(loc(caption), loc(subcaption), loc(teams[0]) .. " " .. loc(scored) .. "|" .. loc(sscore) .. ": " .. score[1] .. " - " .. score[2], -amBaseballBat, 0); |
|
102 end |
|
103 end |
|