1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-21 20:24:20 +00:00

💥 another bundle of quick changes

This commit is contained in:
Steffo 2022-04-04 16:53:43 +02:00
parent 029dcf450c
commit afc1a8b4bd
Signed by: steffo
GPG key ID: 6965406171929D01
10 changed files with 51 additions and 52 deletions

View file

@ -1,39 +0,0 @@
extends Node
export var bullet: PackedScene
export var bullet_container_node_path: String
onready var bullet_container_node: Node = get_node(bullet_container_node_path)
onready var source: Node2D = get_parent()
var _timer : Timer = null
func _ready():
_timer = Timer.new()
add_child(_timer)
_timer.set_wait_time(0.3)
_timer.set_one_shot(true)
_timer.start()
func _process(_delta):
print(_timer.get_time_left())
if Input.is_action_just_pressed("player_shoot") and _timer.get_time_left()==0:
shoot()
#restart timer
_timer.set_wait_time(0.3)
_timer.set_one_shot(true)
_timer.start()
func shoot():
var new_bullet = bullet.instance()
new_bullet.set_position(source.global_position)
bullet_container_node.add_child(new_bullet)
var rotation = new_bullet.get_angle_to(source.get_global_mouse_position())
new_bullet.set_rotation(rotation)
new_bullet.get_node("Ownership").entity_owner = source
new_bullet.add_collision_exception_with(source)

View file

@ -3,8 +3,8 @@ class_name AttractedToMovement
signal moving_in_direction(direction)
signal touching_goal
signal goal_reached
signal touching_goal(who)
signal goal_reached(who)
export var movement_per_second: float
@ -24,9 +24,9 @@ func move():
for slide_no in parent.get_slide_count():
var slide = parent.get_slide_collision(slide_no)
if slide.collider == goal:
emit_signal("touching_goal")
emit_signal("touching_goal", self)
if not _goal_reached_triggered:
emit_signal("goal_reached")
emit_signal("goal_reached", self)
_goal_reached_triggered = true

View file

@ -0,0 +1,13 @@
extends Node
signal goal_reached(who)
func set_consequences(node):
var movement = node.get_node("AttractedToMovement")
movement.connect("goal_reached", self, "_on_goal_reached")
func _on_goal_reached(who):
emit_signal("goal_reached", who)

View file

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

View file

@ -12,10 +12,12 @@ export var lit_damage: int = 5
func _on_Flammable_caught_fire():
$Shape/Sprite.texture = lit_texture
$Damaging.damage = lit_damage
$Damaging.destroy_on_damage = false
$Light.visible = true
func _on_Flammable_extinguished_fire():
$Shape/Sprite.texture = dim_texture
$Damaging.damage = dim_damage
$Damaging.destroy_on_damage = true
$Light.visible = false

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=13 format=2]
[ext_resource path="res://src/entities/enemies/EnemySnowmanLeft.png" type="Texture" id=1]
[ext_resource path="res://src/pickups/BranchPickup.tscn" type="PackedScene" id=2]
@ -9,6 +9,7 @@
[ext_resource path="res://src/entities/enemies/EnemySnowmanFront.png" type="Texture" id=7]
[ext_resource path="res://src/entities/enemies/EnemySnowmanRight.png" type="Texture" id=8]
[ext_resource path="res://src/behaviours/graphics/FourSidedSprite.tscn" type="PackedScene" id=9]
[ext_resource path="res://src/sounds/Death.mp3" type="AudioStream" id=10]
[sub_resource type="CapsuleShape2D" id=1]
radius = 9.0
@ -52,4 +53,9 @@ loot_weights = [ 1.0, 1.0, 0.1 ]
[node name="AttractedToMovement" parent="." index="4" instance=ExtResource( 3 )]
[node name="MeltSound" parent="." index="5"]
stream = ExtResource( 10 )
[connection signal="dead" from="Damageable" to="DropLoot" method="create_drop"]
[connection signal="dead" from="Damageable" to="MeltSound" method="_on_Damageable_dead"]
[connection signal="moving_in_direction" from="AttractedToMovement" to="Shape/FourSidedSprite" method="turn"]

View file

@ -5,6 +5,8 @@ export var intensity: float = 1.0 setget set_intensity
export var change_per_second: float = - 1.0 / 60.0
export var min_intensity: float = 0
export var max_intensity: float = INF
export var enemy_touch_penalty = 0.1
signal intensity_changed(value)
signal intensity_at_max
@ -47,3 +49,9 @@ func _on_Flame_body_entered(body: PhysicsBody2D):
var flammable = body.get_node("Flammable")
if flammable != null:
flammable.catch_fire()
func _on_Enemy_goal_reached(who):
intensity -= enemy_touch_penalty
# Melt
who.queue_free()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=2]
[gd_scene load_steps=22 format=2]
[ext_resource path="res://src/mechanics/Background.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/mechanics/Darkness.tscn" type="PackedScene" id=2]
@ -16,6 +16,7 @@
[ext_resource path="res://src/entities/enemies/ChaserEnemy.tscn" type="PackedScene" id=14]
[ext_resource path="res://src/behaviours/targeting/SetSpawnedGoalTo.tscn" type="PackedScene" id=15]
[ext_resource path="res://src/pickups/BranchPickup.tscn" type="PackedScene" id=16]
[ext_resource path="res://src/behaviours/targeting/SetGoalReachedConsequences.tscn" type="PackedScene" id=17]
[ext_resource path="res://src/music/BaseDrum.mp3" type="AudioStream" id=19]
[ext_resource path="res://src/music/BaseBell.mp3" type="AudioStream" id=20]
[ext_resource path="res://src/music/BaseChoir.mp3" type="AudioStream" id=21]
@ -113,6 +114,8 @@ period_secs = 0.5
[node name="SetSpawnedGoalTo" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner" instance=ExtResource( 15 )]
goal_path = NodePath("../../../Fire")
[node name="SetGoalReachedConsequences" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner" instance=ExtResource( 17 )]
[node name="ScreenEdgeSpawner2" parent="PhaseOne/Entities/Enemies" instance=ExtResource( 13 )]
scale = Vector2( 0.998195, 1 )
spawning = ExtResource( 14 )
@ -122,6 +125,8 @@ period_secs = 0.5
[node name="SetSpawnedGoalTo" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2" instance=ExtResource( 15 )]
goal_path = NodePath("../../../PhaseOnePlayer")
[node name="SetGoalReachedConsequences" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2" instance=ExtResource( 17 )]
[node name="UserInterface" type="CanvasLayer" parent="."]
[node name="TheDarkNightUI" parent="UserInterface" instance=ExtResource( 8 )]
@ -178,5 +183,6 @@ texture = ExtResource( 12 )
[connection signal="intensity_changed" from="PhaseOne/Entities/Fire" to="PhaseOne/Music" method="_on_Fire_intensity_changed"]
[connection signal="intensity_reached_min" from="PhaseOne/Entities/Fire" to="." method="_on_Fire_intensity_reached_min"]
[connection signal="spawned" from="PhaseOne/Entities/Enemies/ScreenEdgeSpawner" to="PhaseOne/Entities/Enemies/ScreenEdgeSpawner/SetSpawnedGoalTo" method="set_goal"]
[connection signal="goal_reached" from="PhaseOne/Entities/Enemies/ScreenEdgeSpawner/SetGoalReachedConsequences" to="PhaseOne/Entities/Fire" method="_on_Enemy_goal_reached"]
[connection signal="spawned" from="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2" to="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2/SetSpawnedGoalTo" method="set_goal"]
[connection signal="pressed" from="UserInterface/TheDarkNightUI/Panel/MuteButton" to="PhaseOne/Music" method="_on_MuteButton_pressed"]

View file

@ -15,7 +15,8 @@ func _ready():
func set_duration(value):
$Duration.wait_time = value
if value > 0:
$Duration.wait_time = value
func get_duration():
return $Duration.wait_time
@ -26,7 +27,8 @@ func _on_Duration_timeout():
func set_despawn(value):
$Despawn.wait_time = value
if value > 0:
$Despawn.wait_time = value
func get_despawn():
return $Despawn.wait_time

View file

@ -8,11 +8,6 @@ onready var pickup: Area2D = get_parent()
var active = false
func _ready():
# warning-ignore: RETURN_VALUE_DISCARDED
pickup.connect("picked_up", self, "_on_picked_up")
func _on_picked_up():
active = true