mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-23 05:04:19 +00:00
what is going on
This commit is contained in:
parent
e1164b3871
commit
3fae0fb808
19 changed files with 48 additions and 110 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -2,8 +2,6 @@
|
|||
"files.exclude": {
|
||||
"**/*.import": true,
|
||||
"**/*.png": true,
|
||||
"**/*.tscn": true,
|
||||
"**/*.tres": true,
|
||||
"**/*.godot": true,
|
||||
"**/*.kra": true,
|
||||
"**/*.mp3": true,
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Node",
|
||||
"class": "Alliance",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/Alliance.gd"
|
||||
}, {
|
||||
"base": "KinematicBody2D",
|
||||
"class": "Arrow",
|
||||
"language": "GDScript",
|
||||
|
@ -90,11 +85,6 @@ _global_script_classes=[ {
|
|||
"path": "res://src/levels/ui/MuteButton.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Ownership",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/Ownership.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "PathMovement",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/movement/PathMovement.gd"
|
||||
|
@ -160,7 +150,6 @@ _global_script_classes=[ {
|
|||
"path": "res://src/Utils.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Alliance": "",
|
||||
"Arrow": "",
|
||||
"AttractedToMovement": "",
|
||||
"BulletMovement": "",
|
||||
|
@ -176,7 +165,6 @@ _global_script_class_icons={
|
|||
"FreeWhenShapeIsOffScreen": "",
|
||||
"Music": "",
|
||||
"MuteButton": "",
|
||||
"Ownership": "",
|
||||
"PathMovement": "",
|
||||
"PlayerMovement": "",
|
||||
"RNG": "",
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
extends Node
|
||||
class_name Alliance
|
||||
|
||||
|
||||
signal alliance_changed(origin, value)
|
||||
|
||||
|
||||
enum AllianceKind {
|
||||
ENEMY = -1,
|
||||
NONE = 0,
|
||||
PLAYER = 1,
|
||||
}
|
||||
|
||||
|
||||
export(AllianceKind) var alliance setget set_alliance
|
||||
|
||||
|
||||
func set_alliance(value):
|
||||
alliance = value
|
||||
emit_signal("alliance_changed", self, value)
|
||||
|
||||
|
||||
static func discover(node):
|
||||
var alliance_node = node.get_node("Alliance")
|
||||
if alliance_node != null:
|
||||
return alliance_node.alliance
|
||||
else:
|
||||
return AllianceKind.NONE
|
||||
|
||||
|
||||
static func discover_and_compare(first, second):
|
||||
return discover(first) == discover(second)
|
|
@ -1,9 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/damage/Alliance.gd" type="Script" id=1]
|
||||
|
||||
[node name="Alliance" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_description_": "Determines the friendliness of the parent node to the player."
|
||||
}
|
|
@ -14,15 +14,6 @@ onready var parent = get_parent()
|
|||
|
||||
|
||||
func do_damage(to, multiplier):
|
||||
# Should alliances be considered?
|
||||
if not friendly_fire:
|
||||
# Find the owner of this bullet
|
||||
var bullet_owner = Ownership.discover(parent)
|
||||
# Check if the bullet should do damage
|
||||
var same_alliance = Alliance.discover_and_compare(bullet_owner, to)
|
||||
if same_alliance and not friendly_fire:
|
||||
return
|
||||
|
||||
# Check if it is possible to damage the collider
|
||||
var damageable = to.get_node("Damageable")
|
||||
if damageable == null:
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
extends Node
|
||||
class_name Ownership
|
||||
|
||||
|
||||
var entity_owner = null
|
||||
|
||||
|
||||
static func discover(node):
|
||||
var ownership_node = node.get_node("Ownership")
|
||||
if ownership_node != null:
|
||||
return ownership_node.entity_owner
|
||||
else:
|
||||
return null
|
|
@ -1,9 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/damage/Ownership.gd" type="Script" id=1]
|
||||
|
||||
[node name="Ownership" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_description_": "Determines which node \"owns\" the parent instance, allowing for Alliance comparisions."
|
||||
}
|
|
@ -21,7 +21,6 @@ func shoot(angle):
|
|||
container.add_child(node)
|
||||
node.set_position(parent.global_position)
|
||||
node.set_rotation(angle + angle_offset)
|
||||
node.get_node("Ownership").entity_owner = parent
|
||||
node.add_collision_exception_with(parent)
|
||||
$Sound.play()
|
||||
$Cooldown.start()
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/damage/Damageable.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/behaviours/damage/Alliance.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="AbstractEntity" type="KinematicBody2D"]
|
||||
collision_layer = 3
|
||||
|
||||
[node name="Alliance" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Damageable" parent="." instance=ExtResource( 1 )]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/movement/BulletMovement.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/behaviours/damage/Ownership.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/behaviours/damage/Damaging.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/behaviours/damage/Damaging.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/behaviours/damage/Damageable.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="AbstractBullet" type="KinematicBody2D"]
|
||||
collision_layer = 4
|
||||
|
@ -10,9 +10,7 @@ collision_mask = 2
|
|||
|
||||
[node name="BulletMovement" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Ownership" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Damaging" parent="." instance=ExtResource( 3 )]
|
||||
destroy_after_damage = true
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[connection signal="collided" from="BulletMovement" to="Damaging" method="_on_BulletMovement_collided"]
|
||||
|
|
|
@ -3,19 +3,30 @@ class_name Arrow
|
|||
|
||||
|
||||
export(Texture) var dim_texture
|
||||
export(int) var dim_damage
|
||||
export(float) var dim_damage
|
||||
export(bool) var dim_piercing
|
||||
|
||||
export(Texture) var lit_texture
|
||||
export(int) var lit_damage
|
||||
export(float) var lit_damage
|
||||
export(bool) var lit_piercing
|
||||
|
||||
|
||||
func _ready():
|
||||
$Shape/Sprite.texture = dim_texture
|
||||
$Damaging.damage = dim_damage
|
||||
$Damaging.destroy_after_damage = not dim_piercing
|
||||
$Light.visible = false
|
||||
|
||||
|
||||
func _on_Flammable_caught_fire(_origin):
|
||||
$Shape/Sprite.texture = lit_texture
|
||||
$Damaging.damage = lit_damage
|
||||
$Damaging.destroy_after_damage = not lit_piercing
|
||||
$Light.visible = true
|
||||
|
||||
|
||||
func _on_Flammable_extinguished_fire(_origin):
|
||||
$Shape/Sprite.texture = dim_texture
|
||||
$Damaging.damage = dim_damage
|
||||
$Damaging.destroy_after_damage = not dim_piercing
|
||||
$Light.visible = false
|
||||
|
|
|
@ -14,9 +14,10 @@ extents = Vector2( 6, 1.5 )
|
|||
[node name="Arrow" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 3 )
|
||||
dim_texture = ExtResource( 2 )
|
||||
dim_damage = -10
|
||||
dim_damage = -10.0
|
||||
lit_texture = ExtResource( 7 )
|
||||
lit_damage = -10
|
||||
lit_piercing = true
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
@ -29,14 +30,14 @@ texture = ExtResource( 2 )
|
|||
[node name="BulletMovement" parent="." index="1"]
|
||||
movement_per_second = 400.0
|
||||
|
||||
[node name="Light" type="Light2D" parent="." index="4"]
|
||||
[node name="Light" type="Light2D" parent="." index="3"]
|
||||
visible = false
|
||||
position = Vector2( 5, 0 )
|
||||
texture = ExtResource( 5 )
|
||||
texture_scale = 0.02
|
||||
color = Color( 1, 0.607843, 0, 1 )
|
||||
|
||||
[node name="Flammable" parent="." index="5" instance=ExtResource( 4 )]
|
||||
[node name="Flammable" parent="." index="4" instance=ExtResource( 4 )]
|
||||
|
||||
[connection signal="caught_fire" from="Flammable" to="." method="_on_Flammable_caught_fire"]
|
||||
[connection signal="extinguished_fire" from="Flammable" to="." method="_on_Flammable_extinguished_fire"]
|
||||
|
|
5
src/entities/enemies/ChaserEnemy.gd
Normal file
5
src/entities/enemies/ChaserEnemy.gd
Normal file
|
@ -0,0 +1,5 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
|
||||
func _on_AttractedToMovement_collided(_origin, collision):
|
||||
$Damaging.do_damage(collision.collider, 1)
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=2]
|
||||
[gd_scene load_steps=14 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,8 @@
|
|||
[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/entities/enemies/ChaserEnemy.gd" type="Script" id=10]
|
||||
[ext_resource path="res://src/behaviours/damage/Damaging.gd" type="Script" id=11]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 9.0
|
||||
|
@ -38,6 +40,8 @@ animations = [ {
|
|||
} ]
|
||||
|
||||
[node name="ChaserEnemy" instance=ExtResource( 4 )]
|
||||
collision_mask = 3
|
||||
script = ExtResource( 10 )
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
@ -51,9 +55,15 @@ max_health = 10.0
|
|||
health = 10.0
|
||||
|
||||
[node name="DropLoot" parent="." index="3"]
|
||||
loot_types = [ null, ExtResource( 2 ), ExtResource( 5 ) ]
|
||||
loot_weights = [ 1.0, 1.0, 0.1 ]
|
||||
loot_types = [ ExtResource( 2 ), ExtResource( 5 ) ]
|
||||
loot_weights = [ 95.0, 5.0 ]
|
||||
|
||||
[node name="AttractedToMovement" parent="." index="5" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Damaging" type="Node" parent="." index="6"]
|
||||
script = ExtResource( 11 )
|
||||
damage = 20.0
|
||||
destroy_after_damage = true
|
||||
|
||||
[connection signal="collided" from="AttractedToMovement" to="." method="_on_AttractedToMovement_collided"]
|
||||
[connection signal="moved_in_direction" from="AttractedToMovement" to="Shape/FourSidedSprite" method="_on_AttractedToMovement_moved_in_direction"]
|
||||
|
|
|
@ -64,7 +64,7 @@ position = Vector2( 0, -12 )
|
|||
z_index = 1
|
||||
frames = SubResource( 4 )
|
||||
animation = "v1"
|
||||
frame = 1
|
||||
frame = 2
|
||||
playing = true
|
||||
|
||||
[node name="Damageable" parent="." instance=ExtResource( 5 )]
|
||||
|
|
|
@ -39,7 +39,7 @@ position = Vector2( 421, -275 )
|
|||
scale = Vector2( 4, 4 )
|
||||
|
||||
[node name="FlameSprite" parent="TheDarkNightUI/MenuFire/Flame/Shape" index="0"]
|
||||
frame = 5
|
||||
frame = 3
|
||||
|
||||
[node name="Damaging" parent="TheDarkNightUI/MenuFire" index="3"]
|
||||
damage = -5.0
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,6 @@ wait_time = 10.0
|
|||
autostart = true
|
||||
|
||||
[node name="ChangeFireIntensity" parent="." index="3" instance=ExtResource( 1 )]
|
||||
amount_per_second = 20.0
|
||||
amount_per_second = 5.0
|
||||
|
||||
[connection signal="picked_up" from="." to="ChangeFireIntensity" method="_on_picked_up"]
|
||||
|
|
|
@ -6,13 +6,17 @@
|
|||
|
||||
[node name="RapidFirePickup" instance=ExtResource( 3 )]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
duration_seconds = inf
|
||||
|
||||
[node name="Sprite" parent="Shape" index="0"]
|
||||
scale = Vector2( 2, 2 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Duration" parent="." index="1"]
|
||||
wait_time = 15.0
|
||||
|
||||
[node name="Despawn" parent="." index="2"]
|
||||
wait_time = 30.0
|
||||
|
||||
[node name="RapidFire" parent="." index="3" instance=ExtResource( 1 )]
|
||||
new_cooldown = 0.1
|
||||
|
||||
[connection signal="picked_up" from="." to="RapidFire" method="_on_picked_up"]
|
||||
|
|
Loading…
Reference in a new issue