Minor Cleanup

- Renamed SoundController
- Cleaned up spacings
- File endings
This commit is contained in:
2020-04-21 03:14:00 +02:00
parent 5cfe44bafe
commit d12d69f083
47 changed files with 203 additions and 245 deletions

View File

@@ -1,9 +1,10 @@
extends AnimatedSprite
func _ready():
play("place")
func _on_Hurtbox_area_entered(area):
SoundControler.pub_play_effect("res://Objects/Banana/Banane3.wav",3)
SoundControler.pub_play_effect("res://Objects/Banana/Banane3.wav", 3)
queue_free()

View File

@@ -1,15 +1,17 @@
extends StaticBody2D
export(int,1,10) var health = 1
export(int, 1, 10) var health = 1
var GreenDrop = 0.4
var BlueDrop = 0.5
var RedDrop = 0.8
var Heart = 0.2
func offset_vec():
var offset = 16
return Vector2((randf()-0.5)*offset, (randf()-0.5)*offset)
func _on_Hurtbox_area_entered(area):
health -= area.damage
if(health>0):
@@ -20,8 +22,8 @@ func _on_Hurtbox_area_entered(area):
var BlueRubies = load("res://Objects/Rubies/Blue.tscn")
var RedRubies = load("res://Objects/Rubies/Red.tscn")
var Hearts = load("res://Objects/Heart/Heart.tscn")
#index of ysort
# index of ysort
var world = get_tree().current_scene.get_node("YSort")
if(randf()<GreenDrop):
var green = GreenRubies.instance()
@@ -39,4 +41,3 @@ func _on_Hurtbox_area_entered(area):
var heart = Hearts.instance()
world.add_child(heart)
heart.global_position = global_position+offset_vec()

View File

@@ -1,10 +1,10 @@
extends StaticBody2D
# This is the decay script for the barrier
# TODO: please adjust it for actual gameplay
export (float, 0.5, 10.0) var decay_time = 1.5
func on_timer_timeout():
queue_free()

View File

@@ -1,12 +1,15 @@
extends StaticBody2D
func _sound_finished():
SoundControler.pub_play_effect("res://Objects/Bonfire/Bonfire.wav",3)
SoundControler.pub_play_effect("res://Objects/Bonfire/Bonfire.wav", 3)
func _ready():
SoundControler.pub_play_effect("res://Objects/Bonfire/Bonfire.wav",3)
SoundControler.pub_play_effect("res://Objects/Bonfire/Bonfire.wav", 3)
SoundControler._effect[3].volume_db = -20
SoundControler._effect[3].connect("finished",self,"_sound_finished")
SoundControler._effect[3].connect("finished", self, "_sound_finished")
func _on_Hurtbox_area_entered(area):
queue_free()

View File

@@ -1,11 +1,12 @@
extends Node2D
var CHANNEL = 2
#one sound will be chosen at random
export var SoundLibary :PoolStringArray=[]
# One walk sound will be chosen at random
func _on_Hurtbox_area_entered(area):
var sound = SoundLibary[rand_range(0,SoundLibary.size())]
SoundControler.pub_play_effect(sound,CHANNEL)
queue_free()

View File

@@ -1,9 +1,6 @@
extends Node2D
func _on_Hurtbox_area_entered(area):
SoundControler.pub_play_effect("res://Objects/Rubies/emerald3.wav",8)
queue_free()

View File

@@ -2,4 +2,4 @@ extends Node2D
func _on_Hurtbox_area_entered(area):
SoundControler.pub_play_effect("res://Objects/Slime/Schleim.wav",3)
SoundControler.pub_play_effect("res://Objects/Slime/Schleim.wav",3)

View File

@@ -6,10 +6,12 @@ var Minion = load("res://Boss/Minion.tscn")
var elapsedTime = 0.0
func offset_vec():
var offset = 16
return Vector2((randf()-0.5)*offset, (randf()-0.5)*offset)
func _physics_process(delta):
elapsedTime += delta
if(elapsedTime>=spawnRate):
@@ -30,6 +32,7 @@ func _on_Hurtbox_area_entered(area):
func _sound_finished():
SoundControler.pub_play_effect("res://Objects/Torch/Torch.wav",4)
func _ready():
SoundControler.pub_play_effect("res://Objects/Torch/Torch.wav",4)
SoundControler._effect[4].volume_db = -20

View File

@@ -1,5 +1,6 @@
extends Node2D
func _on_Hurtbox_area_entered(area):
$AnimatedSprite.play("clap")
SoundControler.pub_play_effect("res://Objects/Traps/Bear/Barenfalle.wav",3)

View File

@@ -9,6 +9,7 @@ func on_timer_timeout():
SoundControler.pub_stop_effect(4)
queue_free()
func _ready():
$Sprite.play("burn")
add_child(timer)
@@ -18,16 +19,12 @@ func _ready():
SoundControler.pub_play_effect("res://Objects/Traps/Flame/Fire.wav",5)
SoundControler._effect[5].volume_db = -20
SoundControler._effect[5].connect("finished",self,"_sound_finished")
func _on_Hitbox_body_entered(body):
if(body.get_name() == "Player"):
body.velocity*=-3
func _sound_finished():
SoundControler.pub_play_effect("res://Objects/Traps/Flame/Fire.wav",5)

View File

@@ -4,20 +4,23 @@ export(float, 0.1, 3.0) var time_to_recharge = 3.0
var time = Timer.new()
func _ready():
add_child(time)
$Sprite.play("out")
SoundControler.pub_play_effect("res://Objects/Traps/Spike/Spike6.wav",9)
$"Hitbox/CollisionShape2D".disabled = true
func on_timer_timeout():
$Sprite.play("out")
SoundControler.pub_play_effect("res://Objects/Traps/Spike/Spike6.wav",9)
time.stop()
func _on_Sprite_animation_finished():
if $Sprite.get_animation() == "default":
$"Hitbox/CollisionShape2D".disabled = false
$"Hitbox/CollisionShape2D".disabled = false
if $Sprite.get_animation() == "out":
$Sprite.play("default")
elif $Sprite.get_animation() == "in":
@@ -33,5 +36,3 @@ func _on_Hitbox_area_entered(area):
if($Sprite.get_animation()=="default"):
SoundControler.pub_play_effect("res://Objects/Traps/Spike/Spike6.wav",9)
$Sprite.play("in")