-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.rb
109 lines (96 loc) · 2.95 KB
/
main.rb
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Encoding: UTF-8
# #
# JAM ARCADE #
# 2021 Gosu Game Jam #
# #
# #
# require "gosu"
require_relative 'chingu/chingu'
require_relative 'chingu/resurrection'
require_relative 'master'
require_relative 'calm/loader'
require_relative 'butterfly/loader'
require_relative 'peeve/loader'
require_relative 'boxes/loader'
require_relative 'relax/loader'
require_relative 'bricks/loader'
require_relative 'penguin/loader'
require_relative 'scheduler/loader'
module Colors # colors
White = Gosu::Color::WHITE
Black = Gosu::Color::BLACK
Dark_Orange = Gosu::Color.new(0xFFCC3300)
Blue_Laser = Gosu::Color.new(0xFF86EFFF)
end
class Arcade < Chingu::Window
# trait :debug => true
def initialize
super(1100, 700, true) #640, 480
self.caption = " JAM ARCADE"
self.input = { :esc => :pop, # global controls
:p => Pause, # Pause not working
:g => :gamestate_logger,
:r => Resurrection,
:z => Calm,
:v => ButterflySurfer,
:x => Peeve,
:b => Boxes,
:c => :relax,
:n => SchedulerGame::Window,
:m => BricksGame,
:k => PenguinGame
}
# retrofy
end
def setup
# push_game_state(MasterMenu)
push_game_state(Resurrection)
end
def gamestate_logger
puts(current_game_state)
end
def pop
if current_game_state.to_s != 'MasterMenu'
push_game_state(MasterMenu)
else
exit
end
end
def relax
push_game_state(Opening1)
end
def pause_game
if current_game_state.to_s != Pause
push_game_state(Pause)
end
end
end
#
# PAUSE GAMESTATE
# press 'P' to pause (currently doesn't work)
class Pause < Chingu::GameState
def setup #(options = {})
# super
@title = Chingu::Text.create(:text=>"PAUSED (press 'P' to un-pause)", :y=>110, :size=>30, :color => Colors::White, :zorder=>1000 )
@title.x = 400 - @title.width/2
@title2 = Chingu::Text.create(:text=>"PAUSED (press 'P' to un-pause)", :y=>110 + 3, :size=>30, :color => Colors::Black, :zorder=>900 )
@title2.x = 400 - @title.width/2 + 3
self.input = { :p => :un_pause, :r => :reset, :n => :next }
# $music.pause
end
def un_pause
# $music.play
pop_game_state(:setup => false) # Return the previous game state, dont call setup()
end
def reset # pressing 'r' resets the gamestate
pop_game_state(:setup => true)
end
def next
push_game_state(Introduction)
end
def draw
previous_game_state.draw # Draw prev game state onto screen (in this case our level)
super # Draw game objects in current game state, this includes Chingu::Texts
end
end
Arcade.new.show # if __FILE__ == $0