cube-tube/app/scenes/paused.rb
Gordon Pedersen b05fb1e0db A bunch of polish
- lock delay
- wall kick tests
- an entirely new music track that changes per level
- Changes to how the music class works (especially when not passing a specific channel)
- New sound effects for getting a tetris, changing levels and game over
- Change piece colours to match the commonly accepted ones
I really should commit more often...
2023-05-08 09:35:52 +10:00

37 lines
945 B
Ruby

# frozen_string_literal: true
# This is the pause menu, triggered by a button press when the player wants a
# break from gameplay.
class PauseMenu < MenuScene
def initialize(args, opts = {})
menu_options = [
{
key: :resume,
on_select: ->(args) { Scene.pop(args) }
},
{
key: :settings,
on_select: ->(args) { Scene.push(args, :settings, reset: true, reset_on_pop: true) }
},
{
key: :return_to_main_menu,
on_select: ->(args) { Scene.switch(args, :main_menu, reset: true) }
}
]
if args.gtk.platform?(:desktop)
menu_options << {
key: :quit,
on_select: ->(args) { args.gtk.request_quit }
}
end
super args, opts, :paused, menu_options
end
# called every tick of the game loop
def tick(args)
super
Music.pause(args) unless Music.stopped?(args) || Music.paused?(args)
end
end