Enhance game over scene: implement GameOver class with options for retry and main menu, add background image, and handle mouse and keyboard interactions.
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
class LorentzField
|
||||
BASE_TIME = 25 # Base time for the field to be active in seconds
|
||||
|
||||
def initialize
|
||||
def initialize(bus)
|
||||
@bus = bus
|
||||
@time = 0
|
||||
@active = false
|
||||
@font = Gosu::Font.new(24, name: "assets/fonts/tn.ttf")
|
||||
|
||||
$bus.on(:lorentz_field?) do
|
||||
@bus.on(:lorentz_field?) do
|
||||
next @active
|
||||
end
|
||||
|
||||
$bus.on(:lorentz_field) do
|
||||
@bus.on(:lorentz_field) do
|
||||
if @active
|
||||
t = @time
|
||||
remaining = BASE_TIME - t
|
||||
@@ -33,10 +34,10 @@ class LorentzField
|
||||
|
||||
def attack(_direction)
|
||||
return if @active
|
||||
$bus.emit(:consume, :lorentz_field, 1)
|
||||
@bus.emit(:consume, :lorentz_field, 1)
|
||||
@active = true
|
||||
@time = 0
|
||||
$bus.emit(:lorentz_field!, true)
|
||||
@bus.emit(:lorentz_field!, true)
|
||||
end
|
||||
|
||||
def update(dt)
|
||||
@@ -46,7 +47,7 @@ class LorentzField
|
||||
if @time >= BASE_TIME
|
||||
@time = 0
|
||||
@active = false
|
||||
$bus.emit(:lorentz_field!, false)
|
||||
@bus.emit(:lorentz_field!, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user