1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-25 14:14:19 +00:00

idk funnies

This commit is contained in:
Steffo 2022-04-04 00:54:52 +02:00
parent 61396573a4
commit e058225247
Signed by: steffo
GPG key ID: 6965406171929D01
8 changed files with 77 additions and 38 deletions

View file

@ -1,7 +0,0 @@
extends KinematicBody2D
class_name FireExtinguisherEnemy
func _ready():
$AttractedToMovement.goal = get_tree().root.find_node("*/Fire")

View file

@ -44,11 +44,6 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://src/behaviours/movement/ErraticMovement.gd" "path": "res://src/behaviours/movement/ErraticMovement.gd"
}, { }, {
"base": "KinematicBody2D",
"class": "FireExtinguisherEnemy",
"language": "GDScript",
"path": "res://FireExtinguisherEnemy.gd"
}, {
"base": "Node", "base": "Node",
"class": "Flammable", "class": "Flammable",
"language": "GDScript", "language": "GDScript",
@ -117,7 +112,6 @@ _global_script_class_icons={
"Damaging": "", "Damaging": "",
"DropLoot": "", "DropLoot": "",
"ErraticMovement": "", "ErraticMovement": "",
"FireExtinguisherEnemy": "",
"Flammable": "", "Flammable": "",
"FourSidedSprite": "", "FourSidedSprite": "",
"FreeWhenShapeIsOffScreen": "", "FreeWhenShapeIsOffScreen": "",

View file

@ -1,11 +1,15 @@
extends Node extends Node
signal health_changed(value)
signal dead
export var health: int = 1 setget set_health, get_health export var health: int = 1 setget set_health, get_health
export var max_health: int = 1 export var max_health: int = 1
signal health_changed(value)
signal dead onready var parent: Node = get_parent()
func set_health(value): func set_health(value):
@ -13,6 +17,9 @@ func set_health(value):
emit_signal("health_changed", value) emit_signal("health_changed", value)
if health <= 0: if health <= 0:
emit_signal("dead") emit_signal("dead")
# WIP
parent.queue_free()
func get_health(): func get_health():
return health return health

View file

@ -25,4 +25,8 @@ func do_damage(to: Node):
damageable.health -= damage damageable.health -= damage
# Alas, destroy self # Alas, destroy self
if destroy_on_damage: if destroy_on_damage:
queue_free() parent.queue_free()
func do_damage_to_collider(collision: KinematicCollision2D):
do_damage(collision.collider)

View file

@ -13,3 +13,5 @@ collision_mask = 2
[node name="Ownership" parent="." instance=ExtResource( 2 )] [node name="Ownership" parent="." instance=ExtResource( 2 )]
[node name="Damaging" parent="." instance=ExtResource( 3 )] [node name="Damaging" parent="." instance=ExtResource( 3 )]
[connection signal="hit" from="BulletMovement" to="Damaging" method="do_damage_to_collider"]

View file

@ -1,10 +1,9 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://src/entities/enemies/EnemySnowmanLeft.png" type="Texture" id=1] [ext_resource path="res://src/entities/enemies/EnemySnowmanLeft.png" type="Texture" id=1]
[ext_resource path="res://src/behaviours/movement/ErraticMovement.tscn" type="PackedScene" id=2] [ext_resource path="res://src/behaviours/movement/ErraticMovement.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/behaviours/movement/AttractedToMovement.tscn" type="PackedScene" id=3] [ext_resource path="res://src/behaviours/movement/AttractedToMovement.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/entities/enemies/AbstractEnemy.tscn" type="PackedScene" id=4] [ext_resource path="res://src/entities/enemies/AbstractEnemy.tscn" type="PackedScene" id=4]
[ext_resource path="res://FireExtinguisherEnemy.gd" type="Script" id=5]
[ext_resource path="res://src/entities/enemies/EnemySnowmanBack.png" type="Texture" id=6] [ext_resource path="res://src/entities/enemies/EnemySnowmanBack.png" type="Texture" id=6]
[ext_resource path="res://src/entities/enemies/EnemySnowmanFront.png" type="Texture" id=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/entities/enemies/EnemySnowmanRight.png" type="Texture" id=8]
@ -38,7 +37,6 @@ animations = [ {
} ] } ]
[node name="ChaserEnemy" instance=ExtResource( 4 )] [node name="ChaserEnemy" instance=ExtResource( 4 )]
script = ExtResource( 5 )
[node name="Shape" type="CollisionShape2D" parent="." index="0"] [node name="Shape" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 ) shape = SubResource( 1 )

View file

@ -35,7 +35,7 @@ collision_mask = 4
[node name="Light" type="Light2D" parent="Flame"] [node name="Light" type="Light2D" parent="Flame"]
texture = ExtResource( 1 ) texture = ExtResource( 1 )
texture_scale = 0.5 texture_scale = 0.5
color = Color( 1, 0.607843, 0, 1 ) color = Color( 1, 0.792157, 0.392157, 1 )
[node name="Shape" type="CollisionShape2D" parent="Flame"] [node name="Shape" type="CollisionShape2D" parent="Flame"]
position = Vector2( 0, -20 ) position = Vector2( 0, -20 )

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2] [gd_scene load_steps=21 format=2]
[ext_resource path="res://src/mechanics/Background.tscn" type="PackedScene" id=1] [ext_resource path="res://src/mechanics/Background.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/mechanics/Darkness.tscn" type="PackedScene" id=2] [ext_resource path="res://src/mechanics/Darkness.tscn" type="PackedScene" id=2]
@ -7,11 +7,44 @@
[ext_resource path="res://src/mechanics/RNG.tscn" type="PackedScene" id=5] [ext_resource path="res://src/mechanics/RNG.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/levels/Game.gd" type="Script" id=6] [ext_resource path="res://src/levels/Game.gd" type="Script" id=6]
[ext_resource path="res://src/ui/TimeSurvived.tscn" type="PackedScene" id=7] [ext_resource path="res://src/ui/TimeSurvived.tscn" type="PackedScene" id=7]
[ext_resource path="res://src/mechanics/ScreenEdgeSpawner.tscn" type="PackedScene" id=8] [ext_resource path="res://src/entities/enemies/EnemySnowmanLeft.png" type="Texture" id=8]
[ext_resource path="res://src/entities/enemies/ChaserEnemy.tscn" type="PackedScene" id=9] [ext_resource path="res://src/behaviours/damage/Alliance.tscn" type="PackedScene" id=9]
[ext_resource path="res://src/behaviours/targeting/SetSpawnedGoalTo.tscn" type="PackedScene" id=10] [ext_resource path="res://src/entities/enemies/EnemySnowmanBack.png" type="Texture" id=10]
[ext_resource path="res://src/levels/PhaseOneMusic.gd" type="Script" id=11] [ext_resource path="res://src/levels/PhaseOneMusic.gd" type="Script" id=11]
[ext_resource path="res://src/behaviours/damage/Damageable.tscn" type="PackedScene" id=12]
[ext_resource path="res://src/entities/enemies/EnemySnowmanFront.png" type="Texture" id=13]
[ext_resource path="res://src/ui/HealthBar.tscn" type="PackedScene" id=14] [ext_resource path="res://src/ui/HealthBar.tscn" type="PackedScene" id=14]
[ext_resource path="res://src/behaviours/spawning/DropLoot.tscn" type="PackedScene" id=15]
[ext_resource path="res://src/entities/enemies/EnemySnowmanRight.png" type="Texture" id=16]
[ext_resource path="res://src/behaviours/graphics/FourSidedSprite.tscn" type="PackedScene" id=17]
[ext_resource path="res://src/behaviours/movement/AttractedToMovement.tscn" type="PackedScene" id=18]
[sub_resource type="CapsuleShape2D" id=1]
radius = 9.0
height = 10.0
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 8 ) ],
"loop": true,
"name": "left",
"speed": 5.0
}, {
"frames": [ ExtResource( 16 ) ],
"loop": true,
"name": "right",
"speed": 5.0
}, {
"frames": [ ExtResource( 10 ) ],
"loop": true,
"name": "up",
"speed": 5.0
}, {
"frames": [ ExtResource( 13 ) ],
"loop": true,
"name": "down",
"speed": 5.0
} ]
[node name="Game" type="Node2D"] [node name="Game" type="Node2D"]
script = ExtResource( 6 ) script = ExtResource( 6 )
@ -49,7 +82,7 @@ position = Vector2( 596, 268 )
[node name="Fire" parent="PhaseOne/Entities" instance=ExtResource( 3 )] [node name="Fire" parent="PhaseOne/Entities" instance=ExtResource( 3 )]
position = Vector2( 640, 320 ) position = Vector2( 640, 320 )
intensity = 1.0 intensity = 2.0
[node name="Pickups" type="Node" parent="PhaseOne/Entities"] [node name="Pickups" type="Node" parent="PhaseOne/Entities"]
@ -57,20 +90,29 @@ intensity = 1.0
[node name="Enemies" type="Node" parent="PhaseOne/Entities"] [node name="Enemies" type="Node" parent="PhaseOne/Entities"]
[node name="ScreenEdgeSpawner" parent="PhaseOne/Entities/Enemies" instance=ExtResource( 8 )] [node name="ChaserEnemy" type="KinematicBody2D" parent="PhaseOne/Entities/Enemies"]
spawning = ExtResource( 9 ) position = Vector2( 800, 307 )
bounds = Vector2( 1280, 640 ) scale = Vector2( 8, 8 )
period_secs = 1.0 collision_layer = 3
[node name="SetSpawnedGoalTo" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner" instance=ExtResource( 10 )] [node name="Shape" type="CollisionShape2D" parent="PhaseOne/Entities/Enemies/ChaserEnemy"]
goal_path = NodePath("../../../Fire") shape = SubResource( 1 )
[node name="ScreenEdgeSpawner2" parent="PhaseOne/Entities/Enemies" instance=ExtResource( 8 )] [node name="FourSidedSprite" parent="PhaseOne/Entities/Enemies/ChaserEnemy/Shape" instance=ExtResource( 17 )]
spawning = ExtResource( 9 ) frames = SubResource( 2 )
bounds = Vector2( 1280, 640 ) animation = "down"
period_secs = 1.0
[node name="SetSpawnedGoalTo" parent="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2" instance=ExtResource( 10 )] [node name="Alliance" parent="PhaseOne/Entities/Enemies/ChaserEnemy" instance=ExtResource( 9 )]
alliance = -1
[node name="Damageable" parent="PhaseOne/Entities/Enemies/ChaserEnemy" instance=ExtResource( 12 )]
health = 250
max_health = 250
[node name="DropLoot" parent="PhaseOne/Entities/Enemies/ChaserEnemy" instance=ExtResource( 15 )]
[node name="AttractedToMovement" parent="PhaseOne/Entities/Enemies/ChaserEnemy" instance=ExtResource( 18 )]
movement_per_second = 64.0
goal_path = NodePath("../../../PhaseOnePlayer") goal_path = NodePath("../../../PhaseOnePlayer")
[node name="UserInterface" type="CanvasLayer" parent="."] [node name="UserInterface" type="CanvasLayer" parent="."]
@ -91,5 +133,4 @@ margin_right = 640.0
margin_left = 14.0 margin_left = 14.0
[connection signal="intensity_changed" from="PhaseOne/Entities/Fire" to="PhaseOne/Music" method="_on_Fire_intensity_changed"] [connection signal="intensity_changed" from="PhaseOne/Entities/Fire" to="PhaseOne/Music" method="_on_Fire_intensity_changed"]
[connection signal="spawned" from="PhaseOne/Entities/Enemies/ScreenEdgeSpawner" to="PhaseOne/Entities/Enemies/ScreenEdgeSpawner/SetSpawnedGoalTo" method="set_goal"] [connection signal="moving_in_direction" from="PhaseOne/Entities/Enemies/ChaserEnemy/AttractedToMovement" to="PhaseOne/Entities/Enemies/ChaserEnemy/Shape/FourSidedSprite" method="turn"]
[connection signal="spawned" from="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2" to="PhaseOne/Entities/Enemies/ScreenEdgeSpawner2/SetSpawnedGoalTo" method="set_goal"]