-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.pyxl
66 lines (53 loc) · 2.65 KB
/
Menu.pyxl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Menu
════════════════════════════════════════════════════════════════════════
const CHOICE = {HUMAN:0, ONLINE:1, AI:2, LUCKY:3}
let currentChoice = CHOICE.HUMAN
def GetMenuTextColor(menu):
if currentChoice == menu:
return rgb(1,1,0)
else if menu == CHOICE.ONLINE:
return rgb(0.1,0.1,0.1)
else:
return rgb(1,1,1)
def GetWinnerColor():
if gLastWinner == 1:
return p1Color
else if gLastWinner == 2:
return p2Color
else:
return rgb(1,1,1)
play_sound(GameMusic, true)
enter
────────────────────────────────────────────────────────────────────────
currentChoice = CHOICE.HUMAN
gLuckyMode = 0
gAIMode = 0
frame
────────────────────────────────────────────────────────────────────────
draw_text(testfont, "PORTAL PONG", xy(SCREEN_SIZE.x/2, SCREEN_SIZE.y/2 - 30), rgb(1,1,1), ∅, ∅, "center", "center")
draw_text(font, "Human vs Human", xy(SCREEN_SIZE.x/2, SCREEN_SIZE.y/2 + 20), GetMenuTextColor(CHOICE.HUMAN), ∅, ∅, "center", "center")
draw_text(font, "Human vs Human Online", xy(SCREEN_SIZE.x/2, SCREEN_SIZE.y/2 + 40), GetMenuTextColor(CHOICE.ONLINE), ∅, ∅, "center", "center")
draw_text(font, "Human vs AI", xy(SCREEN_SIZE.x/2, SCREEN_SIZE.y/2 + 60), GetMenuTextColor(CHOICE.AI), ∅, ∅, "center", "center")
draw_text(font, "Lucky Mode", xy(SCREEN_SIZE.x/2, SCREEN_SIZE.y/2 + 80), GetMenuTextColor(CHOICE.LUCKY), ∅, ∅, "center", "center")
if gLastWinner ≠ 0:
let xOffset = -120
if 2 == gLastWinner: xOffset *= -1
draw_text(
font
, "Last winner : " + format_number(gLastWinner, "") + " (" + format_number(gLastP1Score, "") + "-" + format_number(gLastP2Score, "") + ")"
, xy(SCREEN_SIZE.x/2 + xOffset, SCREEN_SIZE.y/2 + 80)
, GetWinnerColor()
, ∅, ∅, "center", "center"
)
if 0 ≠ joy.yy:
currentChoice = clamp(currentChoice + joy.yy, 0, 3)
if currentChoice == 1: currentChoice += joy.yy
else if joy.bb:
if CHOICE.LUCKY == currentChoice:
gLuckyMode = 1
else if CHOICE.ONLINE == currentChoice:
//TODO - check is currently hosting + someone joined for P2
// + something todo for P2 inputs ?
else if CHOICE.AI == currentChoice:
gAIMode = 1
push_mode(Play)