All audio stuff moved to audio autoload and removed game.tscn in favor of just game.gd
This commit is contained in:
parent
30cfad6e7e
commit
e1a30188a6
21 changed files with 134 additions and 97 deletions
|
@ -125,7 +125,7 @@ func _process_idle_walk():
|
|||
check_jump()
|
||||
#Goto Sword
|
||||
if Debug.allow_sword && Input.is_action_just_pressed("sword"):
|
||||
Game.play_sound(Game.a_sword,Game.ac_jump)
|
||||
Audio.play_sound(Audio.a_sword,Audio.ac_jump)
|
||||
current_state = State.SWORD
|
||||
return
|
||||
#Goto Shoot
|
||||
|
@ -164,25 +164,25 @@ func _process_climb():
|
|||
position.y += axis.y * 0.65
|
||||
#Sound
|
||||
if axis.y == -1:
|
||||
if Game.ac_climb.get_stream() != Game.a_climb_up: Game.play_sound(Game.a_climb_up,Game.ac_climb)
|
||||
if Audio.ac_climb.get_stream() != Audio.a_climb_up: Audio.play_sound(Audio.a_climb_up,Audio.ac_climb)
|
||||
if axis.y == 1:
|
||||
if Game.ac_climb.get_stream() != Game.a_climb_down: Game.play_sound(Game.a_climb_down,Game.ac_climb)
|
||||
if axis.y == 0: Game.ac_climb.set_stream(null)
|
||||
if Audio.ac_climb.get_stream() != Audio.a_climb_down: Audio.play_sound(Audio.a_climb_down,Audio.ac_climb)
|
||||
if axis.y == 0: Audio.ac_climb.set_stream(null)
|
||||
#Manual Jump,, only works when holding neutral or away from ladder
|
||||
if axis.x != sprite.scale.x && Input.is_action_just_pressed("jump"):
|
||||
position.x -= sprite.scale.x * 3
|
||||
velocity.y = -jump_force
|
||||
anims.set_speed_scale(1)
|
||||
current_state = State.FALL
|
||||
Game.ac_climb.set_stream(null)
|
||||
Audio.ac_climb.set_stream(null)
|
||||
return
|
||||
if climb_ray.get_collider() == null:
|
||||
if axis.y == -1:
|
||||
#Auto Jump
|
||||
velocity.y = -jump_force
|
||||
Game.play_sound(Game.a_jump,Game.ac_jump)
|
||||
Audio.play_sound(Audio.a_jump,Audio.ac_jump)
|
||||
#Auto dismount
|
||||
Game.ac_climb.set_stream(null)
|
||||
Audio.ac_climb.set_stream(null)
|
||||
current_state = State.FALL
|
||||
return
|
||||
#Side dismount
|
||||
|
@ -190,7 +190,7 @@ func _process_climb():
|
|||
position.x -= sprite.scale.x * 3
|
||||
current_state = State.FALL
|
||||
anims.set_speed_scale(1)
|
||||
Game.ac_climb.set_stream(null)
|
||||
Audio.ac_climb.set_stream(null)
|
||||
return
|
||||
|
||||
|
||||
|
@ -217,7 +217,7 @@ func _process_transport(delta):
|
|||
position += transport_direction * transport_speed * delta
|
||||
|
||||
func spawn_arrow():
|
||||
Game.play_sound(Game.a_shoot,Game.ac_jump)
|
||||
Audio.play_sound(Audio.a_shoot,Audio.ac_jump)
|
||||
var arrow = ArrowProjectile.instance()
|
||||
arrow.global_position = Vector2(
|
||||
global_position.x + arrowpos.x * sprite.scale.x,
|
||||
|
@ -231,7 +231,7 @@ func check_jump():
|
|||
if Input.is_action_just_pressed("jump"):
|
||||
#Detach ladder
|
||||
if current_state == State.CLIMB:
|
||||
Game.ac_climb.set_stream(null) # stop climb sound
|
||||
Audio.ac_climb.set_stream(null) # stop climb sound
|
||||
position.x -= sprite.scale.x * 3
|
||||
else:
|
||||
dust_particles.restart()
|
||||
|
@ -242,7 +242,7 @@ func check_jump():
|
|||
velocity.y = 0
|
||||
jump_pressure = 0
|
||||
current_state = State.JUMP
|
||||
Game.play_sound(Game.a_jump,Game.ac_jump)
|
||||
Audio.play_sound(Audio.a_jump,Audio.ac_jump)
|
||||
anims.play("jump")
|
||||
velocity.y = -jump_force
|
||||
move(walk_speed,0,true)
|
||||
|
@ -251,7 +251,7 @@ func check_double_jump():
|
|||
if is_on_floor():
|
||||
check_jump()
|
||||
if Input.is_action_just_pressed("jump") && can_doublejump:
|
||||
Game.play_sound(Game.a_doublejump,Game.ac_jump)
|
||||
Audio.play_sound(Audio.a_doublejump,Audio.ac_jump)
|
||||
can_doublejump = false
|
||||
velocity.y = -doublejump_force
|
||||
anims.play("doublejump")
|
||||
|
@ -300,7 +300,7 @@ func exit_transport():
|
|||
|
||||
func die():
|
||||
if can_die:
|
||||
Game.ac_climb.set_stream(null) # stop climbing sound\
|
||||
Audio.ac_climb.set_stream(null) # stop climbing sound\
|
||||
#If the player is already dead, don't kill them again
|
||||
if current_state == State.INACTIVE:
|
||||
return
|
||||
|
@ -319,11 +319,11 @@ func die():
|
|||
new_particles.lifetime = 0.45
|
||||
new_particles.speed_scale = 1.5
|
||||
current_state = State.INACTIVE # Set to state where player is not controllable
|
||||
Game.play_sound(Game.a_gover, Game.ac_die)
|
||||
Audio.play_sound(Audio.a_gover, Audio.ac_die)
|
||||
#Slow down time
|
||||
var time_tween = get_tree().create_tween()
|
||||
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
||||
Game.ac_music.stream_paused = true
|
||||
Audio.ac_music.stream_paused = true
|
||||
yield(time_tween, "finished") #Resume from freeze frame
|
||||
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
||||
Game.call_deferred("restart_level")
|
||||
|
@ -331,7 +331,7 @@ func die():
|
|||
#Die
|
||||
Game.lives -= 1
|
||||
Game.deaths += 1
|
||||
Game.play_sound(Game.a_die, Game.ac_die)
|
||||
Audio.play_sound(Audio.a_die, Audio.ac_die)
|
||||
yield(Game.freeze_frame(0.3), "timeout")
|
||||
#Reduce points if playing in infinite lives mode
|
||||
if Game.use_lives == false && Game.lives < 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue