forked from team-sg/hero-mark-2
fed the game some death juice
This commit is contained in:
parent
f4dda0ab1b
commit
5678971fff
4 changed files with 49 additions and 7 deletions
BIN
audio/sounds/gover.wav
Normal file
BIN
audio/sounds/gover.wav
Normal file
Binary file not shown.
23
audio/sounds/gover.wav.import
Normal file
23
audio/sounds/gover.wav.import
Normal file
|
@ -0,0 +1,23 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/gover.wav-fb994db7cb276d7598aad5c659b45fb3.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/sounds/gover.wav"
|
||||
dest_files=[ "res://.import/gover.wav-fb994db7cb276d7598aad5c659b45fb3.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
5
game.gd
5
game.gd
|
@ -34,6 +34,7 @@ const a_sword = preload("res://audio/sounds/sword.ogg")
|
|||
const a_doublejump = preload("res://audio/sounds/a_bree.wav")
|
||||
const a_shoot = preload("res://audio/sounds/a_egg_shoot.ogg")
|
||||
const a_die = preload("res://audio/sounds/die.wav")
|
||||
const a_gover = preload("res://audio/sounds/gover.wav")
|
||||
#Objects
|
||||
const block_text = preload("res://objects/hud/blocktext.tscn")
|
||||
const pause_screen = preload("res://objects/hud/pause_screen.tscn")
|
||||
|
@ -118,6 +119,10 @@ func restart_level():
|
|||
Game.arrows = 0
|
||||
Game.lives = 2
|
||||
Game.ac_climb.stop()
|
||||
Game.ac_die.stop()
|
||||
Engine.time_scale = 1.0
|
||||
for tween in get_tree().get_processed_tweens():
|
||||
tween.kill()
|
||||
Game.change_map(load(Game.get_map().filename))
|
||||
|
||||
#Freeze frame
|
||||
|
|
|
@ -12,7 +12,7 @@ onready var dust_particles = $DustParticles
|
|||
#Map
|
||||
onready var map = get_owner()
|
||||
##States
|
||||
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT}
|
||||
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT,INACTIVE}
|
||||
var current_state = State.IDLE
|
||||
##Runtime
|
||||
var axis = Vector2.ZERO #Current direction being held
|
||||
|
@ -41,6 +41,8 @@ func _physics_process(delta):
|
|||
#Check ladder
|
||||
check_ladder()
|
||||
match current_state:
|
||||
State.INACTIVE:
|
||||
return
|
||||
State.IDLE:
|
||||
_process_idle()
|
||||
continue
|
||||
|
@ -69,7 +71,8 @@ func _physics_process(delta):
|
|||
_process_shoot()
|
||||
|
||||
#Gravity
|
||||
if current_state != State.CLIMB: velocity.y += gravity
|
||||
if current_state != State.CLIMB:
|
||||
velocity.y += gravity
|
||||
#Cut y velocity when hitting ceiling
|
||||
if is_on_ceiling():
|
||||
current_state = State.FALL
|
||||
|
@ -251,14 +254,25 @@ func die():
|
|||
new_particles.global_position = global_position
|
||||
new_particles.emitting = true
|
||||
sprite.visible = false
|
||||
Game.play_sound(Game.a_die,Game.ac_die)
|
||||
yield(Game.freeze_frame(0.3), "timeout")
|
||||
position = Game.respawn_point
|
||||
sprite.visible = true
|
||||
current_state = State.IDLE
|
||||
Game.lives -= 1
|
||||
if Game.lives < 0:
|
||||
new_particles.amount = 64
|
||||
new_particles.lifetime = 0.45
|
||||
new_particles.speed_scale = 1.5
|
||||
current_state = State.INACTIVE
|
||||
Game.play_sound(Game.a_gover, Game.ac_die)
|
||||
var time_tween = get_tree().create_tween()
|
||||
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
||||
Game.ac_music.stop()
|
||||
yield(time_tween, "finished")
|
||||
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
||||
Game.call_deferred("restart_level")
|
||||
else:
|
||||
Game.play_sound(Game.a_die, Game.ac_die)
|
||||
yield(Game.freeze_frame(0.3), "timeout")
|
||||
position = Game.respawn_point
|
||||
current_state = State.IDLE
|
||||
sprite.visible = true
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
#Return to idle after slash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue