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)
|
||||
if current_piece_colliding
|
||||
@gameover = true
|
||||
Sound.play(@args, :train_stop2)
|
||||
Music.stop(@args)
|
||||
end
|
||||
else
|
||||
|
|
|
@ -5,7 +5,7 @@ class Intro < GameplayScene
|
|||
def initialize(args, opts = {})
|
||||
super
|
||||
|
||||
@train_duration = 200
|
||||
@train_duration = 190
|
||||
@train_spline = [
|
||||
[1.0, 0.25, 0, 0]
|
||||
]
|
||||
|
@ -26,26 +26,34 @@ class Intro < GameplayScene
|
|||
Scene.switch(args, :cube_tube, reset: true)
|
||||
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
|
||||
when 0
|
||||
if (args.state.tick_count - @start) > 60
|
||||
@train_start = args.state.tick_count
|
||||
if (now - @start) > 60
|
||||
@train_start = now
|
||||
@state += 1
|
||||
end
|
||||
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
|
||||
@state += 1
|
||||
@wait_start = args.state.tick_count
|
||||
@wait_start = now
|
||||
Sound.play(args, :chime)
|
||||
end
|
||||
when 2
|
||||
if (args.state.tick_count - @wait_start) > 60
|
||||
@leave_start = args.state.tick_count
|
||||
if (now - @wait_start) > 60
|
||||
@leave_start = now
|
||||
@state += 1
|
||||
Sound.play(args, :train_leave)
|
||||
end
|
||||
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
|
||||
|
||||
@screen_on = true if ease > 0.75
|
||||
|
@ -64,7 +72,7 @@ class Intro < GameplayScene
|
|||
|
||||
if @screen_on
|
||||
screen_s =
|
||||
case (args.state.tick_count % 32)
|
||||
case (now % 32)
|
||||
when 0..7 then :screen_s1
|
||||
when 8..15 then :screen_s2
|
||||
when 16..23 then :screen_s3
|
||||
|
|
|
@ -30,6 +30,16 @@ class MainMenu < MenuScene
|
|||
# actual menu logic is handled by the MenuScene super class
|
||||
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
|
||||
labels = []
|
||||
labels << label(
|
||||
|
|
|
@ -3,9 +3,19 @@
|
|||
|
||||
# returns random val between min & max, inclusive
|
||||
# needs integers, use rand if you don't need min/max and don't care much
|
||||
def random(min, max)
|
||||
min = Integer(min)
|
||||
max = Integer(max)
|
||||
def random(a, b = nil)
|
||||
min = 0
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
module Music
|
||||
MUSIC = {
|
||||
music1: SoundInstance.new({ path: 'music/music1.ogg', looping: true }),
|
||||
music2: SoundInstance.new({ path: 'music/music2.ogg', looping: true })
|
||||
music1: SoundInstance.new({ path: 'music/music1.ogg', looping: true }),
|
||||
music2: SoundInstance.new({ path: 'music/music2.ogg', looping: true }),
|
||||
ambience: SoundInstance.new({ path: 'music/ambience1.ogg', looping: true })
|
||||
}
|
||||
end
|
||||
|
|
BIN
music/ambience1.ogg
Normal file
BIN
music/ambience1.ogg
Normal file
Binary file not shown.
|
@ -2,12 +2,22 @@
|
|||
|
||||
module Sound
|
||||
SOUNDS = {
|
||||
menu: SoundInstance.new({ path: 'sounds/menu.wav' }),
|
||||
select: SoundInstance.new({ path: 'sounds/select.wav' }),
|
||||
clear: SoundInstance.new({ path: 'sounds/clear.wav' }),
|
||||
drop: SoundInstance.new({ path: 'sounds/drop.wav' }),
|
||||
move: SoundInstance.new({ path: 'sounds/move.wav' }),
|
||||
move_deny: SoundInstance.new({ path: 'sounds/move_deny.wav' }),
|
||||
rotate: SoundInstance.new({ path: 'sounds/rotate.wav' })
|
||||
menu: SoundInstance.new({ path: 'sounds/menu.wav' }),
|
||||
select: SoundInstance.new({ path: 'sounds/select.wav' }),
|
||||
clear: SoundInstance.new({ path: 'sounds/clear.wav' }),
|
||||
drop: SoundInstance.new({ path: 'sounds/drop.wav' }),
|
||||
move: SoundInstance.new({ path: 'sounds/move.wav' }),
|
||||
move_deny: SoundInstance.new({ path: 'sounds/move_deny.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
|
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