Added a new intro and main menu ambient sounds
This commit is contained in:
parent
ca6d5aa239
commit
ed35ac5f87
24 changed files with 62 additions and 22 deletions
|
@ -269,6 +269,7 @@ class CubeTubeGame < GameplayScene
|
||||||
Sound.play(@args, :drop)
|
Sound.play(@args, :drop)
|
||||||
if current_piece_colliding
|
if current_piece_colliding
|
||||||
@gameover = true
|
@gameover = true
|
||||||
|
Sound.play(@args, :train_stop2)
|
||||||
Music.stop(@args)
|
Music.stop(@args)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Intro < GameplayScene
|
||||||
def initialize(args, opts = {})
|
def initialize(args, opts = {})
|
||||||
super
|
super
|
||||||
|
|
||||||
@train_duration = 200
|
@train_duration = 190
|
||||||
@train_spline = [
|
@train_spline = [
|
||||||
[1.0, 0.25, 0, 0]
|
[1.0, 0.25, 0, 0]
|
||||||
]
|
]
|
||||||
|
@ -26,26 +26,34 @@ class Intro < GameplayScene
|
||||||
Scene.switch(args, :cube_tube, reset: true)
|
Scene.switch(args, :cube_tube, reset: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@start ||= args.state.tick_count
|
now = args.state.tick_count
|
||||||
|
|
||||||
|
if @start.zero? || @start.nil?
|
||||||
|
@start = now
|
||||||
|
Sound.play(args, :train_stop)
|
||||||
|
end
|
||||||
|
|
||||||
case @state
|
case @state
|
||||||
when 0
|
when 0
|
||||||
if (args.state.tick_count - @start) > 60
|
if (now - @start) > 60
|
||||||
@train_start = args.state.tick_count
|
@train_start = now
|
||||||
@state += 1
|
@state += 1
|
||||||
end
|
end
|
||||||
when 1
|
when 1
|
||||||
@train_pos = 1280 * args.easing.ease_spline(@train_start, args.state.tick_count, @train_duration, @train_spline)
|
@train_pos = 1280 * args.easing.ease_spline(@train_start, now, @train_duration, @train_spline)
|
||||||
if @train_pos <= 0
|
if @train_pos <= 0
|
||||||
@state += 1
|
@state += 1
|
||||||
@wait_start = args.state.tick_count
|
@wait_start = now
|
||||||
|
Sound.play(args, :chime)
|
||||||
end
|
end
|
||||||
when 2
|
when 2
|
||||||
if (args.state.tick_count - @wait_start) > 60
|
if (now - @wait_start) > 60
|
||||||
@leave_start = args.state.tick_count
|
@leave_start = now
|
||||||
@state += 1
|
@state += 1
|
||||||
|
Sound.play(args, :train_leave)
|
||||||
end
|
end
|
||||||
when 3
|
when 3
|
||||||
ease = args.easing.ease_spline(@leave_start, args.state.tick_count, @leave_duration, @leave_spline)
|
ease = args.easing.ease_spline(@leave_start, now, @leave_duration, @leave_spline)
|
||||||
@station_pos = @full_station_start_w * ease
|
@station_pos = @full_station_start_w * ease
|
||||||
|
|
||||||
@screen_on = true if ease > 0.75
|
@screen_on = true if ease > 0.75
|
||||||
|
@ -64,7 +72,7 @@ class Intro < GameplayScene
|
||||||
|
|
||||||
if @screen_on
|
if @screen_on
|
||||||
screen_s =
|
screen_s =
|
||||||
case (args.state.tick_count % 32)
|
case (now % 32)
|
||||||
when 0..7 then :screen_s1
|
when 0..7 then :screen_s1
|
||||||
when 8..15 then :screen_s2
|
when 8..15 then :screen_s2
|
||||||
when 16..23 then :screen_s3
|
when 16..23 then :screen_s3
|
||||||
|
|
|
@ -30,6 +30,16 @@ class MainMenu < MenuScene
|
||||||
# actual menu logic is handled by the MenuScene super class
|
# actual menu logic is handled by the MenuScene super class
|
||||||
super
|
super
|
||||||
|
|
||||||
|
Music.play(args, :ambience) if args.state.setting.music && Music.stopped(args)
|
||||||
|
@next_announcement ||= 0
|
||||||
|
if @next_announcement <= args.state.tick_count
|
||||||
|
next_sec = random(20..50)
|
||||||
|
@next_announcement = args.state.tick_count + (next_sec * 60)
|
||||||
|
sound = :"ambient#{random(1..6)}"
|
||||||
|
puts sound, Sound.for(sound).input
|
||||||
|
Sound.play(args, sound)
|
||||||
|
end
|
||||||
|
|
||||||
# additionally draw some labels with information about the game
|
# additionally draw some labels with information about the game
|
||||||
labels = []
|
labels = []
|
||||||
labels << label(
|
labels << label(
|
||||||
|
|
|
@ -3,9 +3,19 @@
|
||||||
|
|
||||||
# returns random val between min & max, inclusive
|
# returns random val between min & max, inclusive
|
||||||
# needs integers, use rand if you don't need min/max and don't care much
|
# needs integers, use rand if you don't need min/max and don't care much
|
||||||
def random(min, max)
|
def random(a, b = nil)
|
||||||
min = Integer(min)
|
min = 0
|
||||||
max = Integer(max)
|
max = 1
|
||||||
|
if a.is_a?(Range)
|
||||||
|
min = a.begin
|
||||||
|
max = a.last(1)[0]
|
||||||
|
elsif a.is_a?(Numeric) && b.is_a?(Numeric)
|
||||||
|
min = Integer(a)
|
||||||
|
max = Integer(b)
|
||||||
|
else
|
||||||
|
min = 0
|
||||||
|
max = a
|
||||||
|
end
|
||||||
rand((max + 1) - min) + min
|
rand((max + 1) - min) + min
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module Music
|
module Music
|
||||||
MUSIC = {
|
MUSIC = {
|
||||||
music1: SoundInstance.new({ path: 'music/music1.ogg', looping: true }),
|
music1: SoundInstance.new({ path: 'music/music1.ogg', looping: true }),
|
||||||
music2: SoundInstance.new({ path: 'music/music2.ogg', looping: true })
|
music2: SoundInstance.new({ path: 'music/music2.ogg', looping: true }),
|
||||||
|
ambience: SoundInstance.new({ path: 'music/ambience1.ogg', looping: true })
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
BIN
music/ambience1.ogg
Normal file
BIN
music/ambience1.ogg
Normal file
Binary file not shown.
|
@ -8,6 +8,16 @@ module Sound
|
||||||
drop: SoundInstance.new({ path: 'sounds/drop.wav' }),
|
drop: SoundInstance.new({ path: 'sounds/drop.wav' }),
|
||||||
move: SoundInstance.new({ path: 'sounds/move.wav' }),
|
move: SoundInstance.new({ path: 'sounds/move.wav' }),
|
||||||
move_deny: SoundInstance.new({ path: 'sounds/move_deny.wav' }),
|
move_deny: SoundInstance.new({ path: 'sounds/move_deny.wav' }),
|
||||||
rotate: SoundInstance.new({ path: 'sounds/rotate.wav' })
|
rotate: SoundInstance.new({ path: 'sounds/rotate.wav' }),
|
||||||
|
train_stop: SoundInstance.new({ path: 'sounds/train_stop.wav' }),
|
||||||
|
train_stop2: SoundInstance.new({ path: 'sounds/train_stop2.wav' }),
|
||||||
|
train_leave: SoundInstance.new({ path: 'sounds/train_leave.wav' }),
|
||||||
|
chime: SoundInstance.new({ path: 'sounds/please_stand_clear.wav' }),
|
||||||
|
ambient1: SoundInstance.new({ path: 'sounds/announcement.ogg', loop: false }),
|
||||||
|
ambient2: SoundInstance.new({ path: 'sounds/announcement2.ogg', loop: false }),
|
||||||
|
ambient3: SoundInstance.new({ path: 'sounds/announcement3.ogg', loop: false }),
|
||||||
|
ambient4: SoundInstance.new({ path: 'sounds/announcements.ogg', loop: false }),
|
||||||
|
ambient5: SoundInstance.new({ path: 'sounds/train_pass.ogg', loop: false }),
|
||||||
|
ambient6: SoundInstance.new({ path: 'sounds/train_pass2.ogg', loop: false })
|
||||||
}
|
}
|
||||||
end
|
end
|
BIN
sounds/announcement.ogg
Normal file
BIN
sounds/announcement.ogg
Normal file
Binary file not shown.
BIN
sounds/announcement2.ogg
Normal file
BIN
sounds/announcement2.ogg
Normal file
Binary file not shown.
BIN
sounds/announcement3.ogg
Normal file
BIN
sounds/announcement3.ogg
Normal file
Binary file not shown.
BIN
sounds/announcements.ogg
Normal file
BIN
sounds/announcements.ogg
Normal file
Binary file not shown.
BIN
sounds/please_stand_clear.wav
Normal file
BIN
sounds/please_stand_clear.wav
Normal file
Binary file not shown.
BIN
sounds/train_leave.wav
Normal file
BIN
sounds/train_leave.wav
Normal file
Binary file not shown.
BIN
sounds/train_pass.ogg
Normal file
BIN
sounds/train_pass.ogg
Normal file
Binary file not shown.
BIN
sounds/train_pass2.ogg
Normal file
BIN
sounds/train_pass2.ogg
Normal file
Binary file not shown.
BIN
sounds/train_stop.wav
Normal file
BIN
sounds/train_stop.wav
Normal file
Binary file not shown.
BIN
sounds/train_stop2.wav
Normal file
BIN
sounds/train_stop2.wav
Normal file
Binary file not shown.
BIN
wip-assets/sounds/ambience1.ogg
Normal file
BIN
wip-assets/sounds/ambience1.ogg
Normal file
Binary file not shown.
BIN
wip-assets/sounds/announcement.ogg
Normal file
BIN
wip-assets/sounds/announcement.ogg
Normal file
Binary file not shown.
BIN
wip-assets/sounds/announcement2.ogg
Normal file
BIN
wip-assets/sounds/announcement2.ogg
Normal file
Binary file not shown.
BIN
wip-assets/sounds/announcement3.ogg
Normal file
BIN
wip-assets/sounds/announcement3.ogg
Normal file
Binary file not shown.
BIN
wip-assets/sounds/announcements.ogg
Normal file
BIN
wip-assets/sounds/announcements.ogg
Normal file
Binary file not shown.
BIN
wip-assets/sounds/chime.wav
Normal file
BIN
wip-assets/sounds/chime.wav
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue