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

@@ -4,10 +4,10 @@ const EFFECT_LAYERS:int = 20
var _effect: Array = [] var _effect: Array = []
var _music: AudioStreamPlayer var _music: AudioStreamPlayer
#Playback Options # Playback Options
var _loop: bool = true var _loop: bool = true
#Settings that should be put into an Options script # Settings that should be put into an Options script
var _music_volume:int = -12 var _music_volume:int = -12
var _effects_volume:int = -12 var _effects_volume:int = -12
@@ -26,44 +26,50 @@ func _ready() -> void:
_effect[i].connect("finished", self, "sig_effect_finished") _effect[i].connect("finished", self, "sig_effect_finished")
add_child(_effect[i]) add_child(_effect[i])
func pub_play_music(path:String,should_loop:bool=true)-> void: func pub_play_music(path:String,should_loop:bool=true)-> void:
var stream = load(path) var stream = load(path)
#AudioServer.set_bus_mute(1, true) # AudioServer.set_bus_mute(1, true)
_music.stop() _music.stop()
_music.stream = stream _music.stream = stream
_music.play() _music.play()
_loop=should_loop _loop=should_loop
func pub_play_effect(path:String,channel:int=0)-> void: func pub_play_effect(path:String,channel:int=0)-> void:
var stream = load(path) var stream = load(path)
#AudioServer.set_bus_mute(1, true) # AudioServer.set_bus_mute(1, true)
_effect[channel].stop() _effect[channel].stop()
_effect[channel].stream = stream _effect[channel].stream = stream
_effect[channel].play() _effect[channel].play()
func pub_stop_music()-> void: func pub_stop_music()-> void:
_music.stop() _music.stop()
func pub_stop_effect(channel:int)-> void: func pub_stop_effect(channel:int)-> void:
_effect[channel].stop() _effect[channel].stop()
func pub_stop_effects()-> void: func pub_stop_effects()-> void:
for i in range(0,EFFECT_LAYERS): for i in range(0,EFFECT_LAYERS):
_effect[i].stop() _effect[i].stop()
func pub_stop_all() -> void: func pub_stop_all() -> void:
pub_stop_music() pub_stop_music()
pub_stop_effects() pub_stop_effects()
func sig_music_finished() -> void: func sig_music_finished() -> void:
#AudioServer.set_bus_mute(1, false) # AudioServer.set_bus_mute(1, false)
if _loop : if _loop :
_music.stop() _music.stop()
_music.play() _music.play()
pass pass
func sig_effect_finished() -> void: func sig_effect_finished() -> void:
#AudioServer.set_bus_mute(1, false) # AudioServer.set_bus_mute(1, false)
pass pass

View File

@@ -27,6 +27,7 @@ var movementState = moveState.MOVE
var damage_per_second := 0.0 var damage_per_second := 0.0
var totaldamage := 0.0 var totaldamage := 0.0
func _debug_update(): func _debug_update():
debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n" debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n"

View File

@@ -14,12 +14,15 @@ var totaldamage := 0.0
var rollvector = Vector2.ZERO var rollvector = Vector2.ZERO
func _debug_update(): func _debug_update():
debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n" debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n"
func _ready(): func _ready():
grid = get_tree().current_scene.get_node("Grid") grid = get_tree().current_scene.get_node("Grid")
# IMPORTANT: If you are using move_and_slide don't multiply by delta # IMPORTANT: If you are using move_and_slide don't multiply by delta
# Godots physics system does that internally # Godots physics system does that internally
# In move_and_collide(...) you have to multiply by delta. # In move_and_collide(...) you have to multiply by delta.
@@ -27,6 +30,7 @@ func move():
move_and_slide(velocity) move_and_slide(velocity)
_animate(velocity) _animate(velocity)
func _physics_process(delta): func _physics_process(delta):
totaldamage += damage_per_second * delta totaldamage += damage_per_second * delta
player_stats.speed += 10 * delta player_stats.speed += 10 * delta
@@ -55,6 +59,7 @@ func _on_Hurtbox_area_entered(area):
func _on_Hurtbox_area_exited(area): func _on_Hurtbox_area_exited(area):
damage_per_second -= area.damage damage_per_second -= area.damage
# API Interface for ai_hero # API Interface for ai_hero
func run(direction, delta): func run(direction, delta):
direction = direction.normalized() direction = direction.normalized()
@@ -66,6 +71,7 @@ func run(direction, delta):
else: else:
pass pass
func _animate(vec): func _animate(vec):
match get_nearest_diretion(vec): match get_nearest_diretion(vec):
"up": "up":
@@ -82,8 +88,6 @@ func _animate(vec):
$Sprite.play("right") $Sprite.play("right")
func get_nearest_diretion(vec): func get_nearest_diretion(vec):
var directions = { var directions = {
"up": Vector2(0, -1.1), "up": Vector2(0, -1.1),

View File

@@ -1,5 +1,6 @@
extends Panel extends Panel
func _on_SlimeBoss_state_changed(new_state_name): func _on_SlimeBoss_state_changed(new_state_name):
$VBoxContainer/State.text = new_state_name $VBoxContainer/State.text = new_state_name

View File

@@ -16,14 +16,15 @@ var time_passed := 0.0
var offset var offset
export(float, 0, 42.0) var refresh_rate = 0.4 export(float, 0, 42.0) var refresh_rate = 0.4
func _point_coors(point : Vector2): func _point_coors(point : Vector2):
return 14*point.y+point.x return 14*point.y+point.x
func _ready(): func _ready():
var walls = get_tree().current_scene.get_node("FloorTileMap") var walls = get_tree().current_scene.get_node("FloorTileMap")
offset = walls.global_position offset = walls.global_position
for x in range(14): for x in range(14):
object_grid.push_back([]) object_grid.push_back([])
prio_grid.push_back([]) prio_grid.push_back([])
@@ -31,7 +32,6 @@ func _ready():
object_grid[x].push_back([Kind.FIELD]) object_grid[x].push_back([Kind.FIELD])
prio_grid[x].push_back([Kind.TERMINAL_SYMBOL]) prio_grid[x].push_back([Kind.TERMINAL_SYMBOL])
for tile in walls.get_used_cells(): for tile in walls.get_used_cells():
if(is_in_coord(tile)): if(is_in_coord(tile)):
object_grid[tile.x][tile.y][0] = Kind.WALL object_grid[tile.x][tile.y][0] = Kind.WALL
@@ -45,7 +45,7 @@ func _ready():
var Index = _point_coors(Vector2(x,y)) var Index = _point_coors(Vector2(x,y))
aStar_node.add_point(Index, Vector3(x,y,0.0)) aStar_node.add_point(Index, Vector3(x,y,0.0))
#add points straight # add points straight
for point in walkableCells: for point in walkableCells:
var point_index = _point_coors(point) var point_index = _point_coors(point)
@@ -64,7 +64,7 @@ func _ready():
continue continue
aStar_node.connect_points(point_index, point_relative_index, true) aStar_node.connect_points(point_index, point_relative_index, true)
#diagonal # diagonal
for point in walkableCells: for point in walkableCells:
var point_index = _point_coors(point) var point_index = _point_coors(point)
@@ -100,6 +100,7 @@ func recalculate_path():
var end_index = _point_coors(path_end_position) var end_index = _point_coors(path_end_position)
_point_path = aStar_node.get_point_path(start_index, end_index) _point_path = aStar_node.get_point_path(start_index, end_index)
func _reset_grids(): func _reset_grids():
for x in range(14): for x in range(14):
for y in range(7): for y in range(7):
@@ -128,6 +129,7 @@ func _pixel_to_grid_coords(pixel : Vector2) -> Vector2:
new_coords.y = floor((pixel.y-offset.y) / 32.0) new_coords.y = floor((pixel.y-offset.y) / 32.0)
return new_coords return new_coords
func get_nearest(position, kind): func get_nearest(position, kind):
var list = [] var list = []
for x in range(14): for x in range(14):
@@ -147,6 +149,7 @@ func get_nearest(position, kind):
mini = i mini = i
return list[mini] return list[mini]
func get_fields_around(point): func get_fields_around(point):
var points_relative_str = PoolVector2Array([ var points_relative_str = PoolVector2Array([
Vector2(point.x + 1, point.y + 1), Vector2(point.x + 1, point.y + 1),
@@ -202,6 +205,7 @@ func _update_grid():
scale = 0 scale = 0
aStar_node.set_point_weight_scale(index, scale) aStar_node.set_point_weight_scale(index, scale)
func _physics_process(delta): func _physics_process(delta):
if(time_passed > refresh_rate): if(time_passed > refresh_rate):
time_passed -= refresh_rate time_passed -= refresh_rate
@@ -225,7 +229,6 @@ func _set_path_start_position(value : Vector2):
path_start_position = value path_start_position = value
func _set_path_end_position(value : Vector2): func _set_path_end_position(value : Vector2):
if value in obstacles: if value in obstacles:
return return

View File

@@ -26,10 +26,12 @@ export(String, FILE, "*.tscn,*.scn") var scene_to_load = ""
func _ready(): func _ready():
next() next()
func _physics_process(delta): func _physics_process(delta):
if Input.is_action_just_pressed("dialogue_advance"): if Input.is_action_just_pressed("dialogue_advance"):
next() next()
func next(): func next():
finished_indicator.modulate = Color(1, 1, 1, 0) finished_indicator.modulate = Color(1, 1, 1, 0)
cur_line += 1 cur_line += 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Xbox 360 Controller Black Updated.png-0754ef5441fb7e2eb74845b4b0197cb7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menus/ControlIcons/Xbox 360 Controller Black Updated.png"
dest_files=[ "res://.import/Xbox 360 Controller Black Updated.png-0754ef5441fb7e2eb74845b4b0197cb7.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Xbox 360 Controller Updated.png-a803c74089c07cfc25b62a4b31dba239.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menus/ControlIcons/Xbox 360 Controller Updated.png"
dest_files=[ "res://.import/Xbox 360 Controller Updated.png-a803c74089c07cfc25b62a4b31dba239.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -12,7 +12,8 @@ func _process(delta):
func _ready(): func _ready():
SoundControler.pub_play_music("res://Menus/Credits/Chad_Crouch_-_Algorithms.ogg",false) SoundControler.pub_play_music("res://Menus/Credits/Chad_Crouch_-_Algorithms.ogg", false)
func _on_AnimationPlayer_animation_finished(anim_name): func _on_AnimationPlayer_animation_finished(anim_name):
SoundControler.pub_stop_music() SoundControler.pub_stop_music()

View File

@@ -14,6 +14,7 @@ onready var animation_player = $AnimationPlayer
var first_action = true var first_action = true
func _physics_process(delta): func _physics_process(delta):
if Input.is_action_just_pressed("skip"): if Input.is_action_just_pressed("skip"):
if(first_action): if(first_action):
@@ -22,6 +23,7 @@ func _physics_process(delta):
first_action != first_action first_action != first_action
next() next()
func set_dialogue_identifier(val): func set_dialogue_identifier(val):
dialogue_identifier = val dialogue_identifier = val
_dialogue = dialogues.get_dialogue(val) _dialogue = dialogues.get_dialogue(val)

View File

@@ -16,5 +16,6 @@ func _ready():
"Boss: We'll see about that!" "Boss: We'll see about that!"
]) ])
func get_dialogue(id): func get_dialogue(id):
return _dialogues[id] return _dialogues[id]

View File

@@ -15,11 +15,13 @@ enum cards {
EMPTY EMPTY
} }
func _ready(): func _ready():
update_cards() update_cards()
export var ObjectParent:NodePath export var ObjectParent:NodePath
func update_cards(): func update_cards():
var index = 0 var index = 0
while index < 5 and usedCards[index] != cards.EMPTY: while index < 5 and usedCards[index] != cards.EMPTY:
@@ -49,7 +51,6 @@ func update_cards():
for i in range(index): for i in range(index):
newchild[i].set_begin(cardPositions[i]) newchild[i].set_begin(cardPositions[i])
for i in range(index): for i in range(index):
newchild[i].margin_bottom = newchild[i].margin_top+32 newchild[i].margin_bottom = newchild[i].margin_top+32
newchild[i].margin_right = newchild[i].margin_left+32 newchild[i].margin_right = newchild[i].margin_left+32

View File

@@ -4,8 +4,9 @@ const Grid = preload("res://Maps/Grid.gd")
onready var grid = get_tree().current_scene.get_node("Grid") onready var grid = get_tree().current_scene.get_node("Grid")
onready var ysort = get_tree().current_scene.get_node("YSort") onready var ysort = get_tree().current_scene.get_node("YSort")
#DropZone
#stuff can be dropped here # DropZone
# Stuff can be dropped here
func can_drop_data(_pos, data): func can_drop_data(_pos, data):
return typeof(data) == typeof(PackedScene) return typeof(data) == typeof(PackedScene)
@@ -14,7 +15,7 @@ func get_nearest_grid_pos(position, scale = 1):
return Vector2(round(position.x / 32.0) * scale, round(position.y / 32.0) * scale) return Vector2(round(position.x / 32.0) * scale, round(position.y / 32.0) * scale)
#what is to be done when data is dropped # What is to be done when data is dropped
func drop_data(_pos, data:PackedScene): func drop_data(_pos, data:PackedScene):
var new_pos = get_nearest_grid_pos(_pos) var new_pos = get_nearest_grid_pos(_pos)
if grid.object_grid[new_pos.x - 1][new_pos.y - 1].back() == Grid.Kind.FIELD: if grid.object_grid[new_pos.x - 1][new_pos.y - 1].back() == Grid.Kind.FIELD:

View File

@@ -7,7 +7,8 @@ export var DeleteOnGrab:bool = false
var card_level = 0 var card_level = 0
#if a drag is initiated here
# if a drag is initiated here
func get_drag_data(_pos): func get_drag_data(_pos):
if (canNotPlace): if (canNotPlace):
return null return null

View File

@@ -3,10 +3,12 @@ extends Node2D
export(String, FILE, "*.tscn,*.scn") var restart_scene = "" export(String, FILE, "*.tscn,*.scn") var restart_scene = ""
export(String, FILE, "*.tscn,*.scn") var title_screen = "" export(String, FILE, "*.tscn,*.scn") var title_screen = ""
func _on_Restart_pressed(): func _on_Restart_pressed():
get_tree().change_scene(restart_scene) get_tree().change_scene(restart_scene)
SoundControler.pub_stop_effects() SoundControler.pub_stop_effects()
func _on_TitleScreen_pressed(): func _on_TitleScreen_pressed():
get_tree().change_scene(title_screen) get_tree().change_scene(title_screen)
SoundControler.pub_stop_effects() SoundControler.pub_stop_effects()

View File

@@ -8,11 +8,11 @@ var showCards = true
var shownCards = [] var shownCards = []
var allowChoosCards = false var allowChoosCards = false
func _ready(): func _ready():
DrNDr = get_tree().current_scene.get_node("CanvasLayer").get_node("DragNDropUI") DrNDr = get_tree().current_scene.get_node("CanvasLayer").get_node("DragNDropUI")
func starting(): func starting():
shownCards = [] shownCards = []
if (showCards): if (showCards):
@@ -74,6 +74,7 @@ func starting():
else: else:
pass pass
func _input(event): func _input(event):
if((event is InputEventMouseButton) && allowChoosCards): if((event is InputEventMouseButton) && allowChoosCards):
for card in range(3): for card in range(3):
@@ -98,5 +99,3 @@ func _input(event):
func _on_Button_pressed(): func _on_Button_pressed():
Engine.time_scale=1 Engine.time_scale=1
self.hide() self.hide()
pass # Replace with function body.

View File

@@ -2,15 +2,19 @@ extends AnimatedSprite
onready var timer = $Timer onready var timer = $Timer
func _ready(): func _ready():
timer.connect("timeout", self, "_timeout") timer.connect("timeout", self, "_timeout")
func start(): func start():
timer.set_wait_time(0.25) timer.set_wait_time(0.25)
timer.start() timer.start()
func _timeout(): func _timeout():
play("begin") play("begin")
func _animation_finished(): func _animation_finished():
play("loop") play("loop")

View File

@@ -11,11 +11,13 @@ onready var startup= $Startup
var finished_once := false var finished_once := false
func _ready(): func _ready():
startup.start() startup.start()
animation_player.play("__INIT__") animation_player.play("__INIT__")
SoundControler.pub_play_music("res://Menus/Sounds/menu_theme.ogg", false) SoundControler.pub_play_music("res://Menus/Sounds/menu_theme.ogg", false)
func _process(_delta): func _process(_delta):
if not finished_once and Input.is_action_just_pressed("skip"): if not finished_once and Input.is_action_just_pressed("skip"):
startup.animation = "loop" startup.animation = "loop"
@@ -29,5 +31,6 @@ func _process(_delta):
animation_player.play("show_buttons") animation_player.play("show_buttons")
finished_once = true finished_once = true
func _exit_tree(): func _exit_tree():
SoundControler.pub_stop_music() SoundControler.pub_stop_music()

View File

@@ -5,6 +5,7 @@ export(String, FILE, "*.tscn,*.scn") var scene_to_load = ""
export(bool) var quit = false export(bool) var quit = false
var ignore_once = false var ignore_once = false
func _pressed(): func _pressed():
SoundControler.pub_play_effect("res://Menus/Sounds/menu_option_select.ogg",0) SoundControler.pub_play_effect("res://Menus/Sounds/menu_option_select.ogg",0)
if quit: if quit:
@@ -18,7 +19,6 @@ func _on_TitleScreenButton_mouse_entered():
grab_focus() grab_focus()
func _on_TitleScreenButton_focus_entered(): func _on_TitleScreenButton_focus_entered():
if not ignore_once: if not ignore_once:
SoundControler.pub_play_effect("res://Menus/Sounds/menu_focus_change.ogg",0) SoundControler.pub_play_effect("res://Menus/Sounds/menu_focus_change.ogg",0)

View File

@@ -8,6 +8,7 @@ func _on_Restart_pressed():
get_tree().change_scene(restart_scene) get_tree().change_scene(restart_scene)
SoundControler.pub_stop_effects() SoundControler.pub_stop_effects()
func _on_TitleScreen_pressed(): func _on_TitleScreen_pressed():
get_tree().change_scene(title_screen) get_tree().change_scene(title_screen)
SoundControler.pub_stop_effects() SoundControler.pub_stop_effects()

View File

@@ -1,9 +1,10 @@
extends AnimatedSprite extends AnimatedSprite
func _ready(): func _ready():
play("place") play("place")
func _on_Hurtbox_area_entered(area): 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() queue_free()

View File

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

View File

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

View File

@@ -1,12 +1,15 @@
extends StaticBody2D extends StaticBody2D
func _sound_finished(): 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(): 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].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): func _on_Hurtbox_area_entered(area):
queue_free() queue_free()

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
extends Node2D extends Node2D
func _on_Hurtbox_area_entered(area): func _on_Hurtbox_area_entered(area):
$AnimatedSprite.play("clap") $AnimatedSprite.play("clap")
SoundControler.pub_play_effect("res://Objects/Traps/Bear/Barenfalle.wav",3) 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) SoundControler.pub_stop_effect(4)
queue_free() queue_free()
func _ready(): func _ready():
$Sprite.play("burn") $Sprite.play("burn")
add_child(timer) add_child(timer)
@@ -20,8 +21,6 @@ func _ready():
SoundControler._effect[5].connect("finished",self,"_sound_finished") SoundControler._effect[5].connect("finished",self,"_sound_finished")
func _on_Hitbox_body_entered(body): func _on_Hitbox_body_entered(body):
if(body.get_name() == "Player"): if(body.get_name() == "Player"):
body.velocity*=-3 body.velocity*=-3
@@ -29,5 +28,3 @@ func _on_Hitbox_body_entered(body):
func _sound_finished(): func _sound_finished():
SoundControler.pub_play_effect("res://Objects/Traps/Flame/Fire.wav",5) SoundControler.pub_play_effect("res://Objects/Traps/Flame/Fire.wav",5)

View File

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

View File

@@ -1 +0,0 @@
extends Node

View File

@@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Overlap/Mechanics/Mechanics.gd" type="Script" id=1]
[node name="Core" type="Node"]
script = ExtResource( 1 )

View File

@@ -39,6 +39,3 @@ func go_to_next_state_in_sequence():
state_active = get_child(new_state_index) state_active = get_child(new_state_index)
state_active.enter() state_active.enter()

View File

@@ -26,5 +26,3 @@ func set_speed(value):
speed = 0.0 speed = 0.0
else: else:
speed = value speed = value

View File

@@ -62,7 +62,7 @@ config/icon="res://icon.png"
[autoload] [autoload]
SoundControler="*res://Autoloads/SoundControler.gd" SoundControler="*res://Autoloads/SoundController.gd"
Steering="*res://Autoloads/Steering.gd" Steering="*res://Autoloads/Steering.gd"
Globals="*res://Autoloads/Globals.gd" Globals="*res://Autoloads/Globals.gd"