1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-22 04:34:19 +00:00
This commit is contained in:
Maxim Lobovsky 2022-04-03 21:07:24 +02:00
commit 8f80a40c75
79 changed files with 654 additions and 342 deletions

7
FireExtinguisherEnemy.gd Normal file
View file

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

View file

@ -12,16 +12,88 @@ _global_script_classes=[ {
"base": "Node",
"class": "Alliance",
"language": "GDScript",
"path": "res://src/entities/behaviours/Alliance.gd"
"path": "res://src/behaviours/damage/Alliance.gd"
}, {
"base": "Node",
"class": "AttractedToMovement",
"language": "GDScript",
"path": "res://src/behaviours/movement/AttractedToMovement.gd"
}, {
"base": "Node",
"class": "BulletMovement",
"language": "GDScript",
"path": "res://src/behaviours/movement/BulletMovement.gd"
}, {
"base": "Node",
"class": "Damaging",
"language": "GDScript",
"path": "res://src/behaviours/damage/Damaging.gd"
}, {
"base": "Node",
"class": "DropLoot",
"language": "GDScript",
"path": "res://src/behaviours/spawning/DropLoot.gd"
}, {
"base": "Node",
"class": "ErraticMovement",
"language": "GDScript",
"path": "res://src/behaviours/movement/ErraticMovement.gd"
}, {
"base": "KinematicBody2D",
"class": "FireExtinguisherEnemy",
"language": "GDScript",
"path": "res://FireExtinguisherEnemy.gd"
}, {
"base": "Node",
"class": "Ownership",
"language": "GDScript",
"path": "res://src/entities/behaviours/Ownership.gd"
"path": "res://src/behaviours/damage/Ownership.gd"
}, {
"base": "Node",
"class": "PlayerMovement",
"language": "GDScript",
"path": "res://src/behaviours/movement/PlayerMovement.gd"
}, {
"base": "Node",
"class": "RNG",
"language": "GDScript",
"path": "res://src/mechanics/RNG.gd"
}, {
"base": "Node",
"class": "RandomRotationOnReady",
"language": "GDScript",
"path": "res://src/behaviours/RandomRotationOnReady.gd"
}, {
"base": "Node",
"class": "SetSpawnedGoalTo",
"language": "GDScript",
"path": "res://src/behaviours/targeting/SetSpawnedGoalTo.gd"
}, {
"base": "Node2D",
"class": "SpawnEveryPeriod",
"language": "GDScript",
"path": "res://src/behaviours/spawning/SpawnEveryPeriod.gd"
}, {
"base": "Node",
"class": "TeleportToScreenEdge",
"language": "GDScript",
"path": "res://src/behaviours/movement/TeleportToScreenEdge.gd"
} ]
_global_script_class_icons={
"Alliance": "",
"Ownership": ""
"AttractedToMovement": "",
"BulletMovement": "",
"Damaging": "",
"DropLoot": "",
"ErraticMovement": "",
"FireExtinguisherEnemy": "",
"Ownership": "",
"PlayerMovement": "",
"RNG": "",
"RandomRotationOnReady": "",
"SetSpawnedGoalTo": "",
"SpawnEveryPeriod": "",
"TeleportToScreenEdge": ""
}
[application]
@ -46,7 +118,7 @@ player_move_up={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null)
]
}
player_move_down={
@ -54,7 +126,7 @@ player_move_down={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null)
]
}
player_move_left={
@ -62,7 +134,7 @@ player_move_left={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null)
]
}
player_move_right={
@ -70,7 +142,7 @@ player_move_right={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null)
]
}
player_shoot={

BIN
src/Sounds/arrow.mp3 (Stored with Git LFS)

Binary file not shown.

BIN
src/Sounds/branch.mp3 (Stored with Git LFS)

Binary file not shown.

BIN
src/Sounds/death.mp3 (Stored with Git LFS)

Binary file not shown.

View file

@ -1,10 +1,14 @@
extends Node
export var bullet: PackedScene = preload("res://src/entities/Bullet.tscn")
export var bullet_container_node_path: String = "../.."
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():

View file

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

View file

@ -0,0 +1,10 @@
extends Node
class_name RandomRotationOnReady
onready var parent: Node2D = get_parent()
onready var rng: RandomNumberGenerator = get_tree().root.get_node("Game/RNG").rng
func _ready():
parent.rotate(rng.randf() * 2 * PI)

View file

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/behaviours/RandomRotationOnReady.gd" type="Script" id=1]
[node name="RandomRotationOnReady" type="Node"]
script = ExtResource( 1 )
__meta__ = {
"_editor_description_": "Rotates the parent Node2D randomly when the node is ready."
}

View file

@ -0,0 +1,9 @@
[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."
}

View file

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/behaviours/damage/Damageable.gd" type="Script" id=1]
[node name="Damageable" type="Node"]
script = ExtResource( 1 )
__meta__ = {
"_editor_description_": "Allows the parent entity to take damage and die."
}

View file

@ -0,0 +1,28 @@
extends Node
class_name Damaging
export var damage: int
export var destroy_on_damage: bool
export var friendly_fire: bool
onready var parent: Node2D = get_parent()
func do_damage(to: Node):
# Find the owner of this bullet
var bullet_owner = Ownership.get_value(parent)
# Check if the bullet should do damage
var same_alliance = Alliance.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:
return
# Damage the collider!
damageable.health -= damage
# Alas, destroy self
if destroy_on_damage:
queue_free()

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/behaviours/damage/Damaging.gd" type="Script" id=1]
[node name="Damaging" type="Node"]
script = ExtResource( 1 )
__meta__ = {
"_editor_description_": "Allows the object to damage Damageable nodes."
}
damage = 1
destroy_on_damage = true

View file

@ -0,0 +1,9 @@
[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."
}

View file

@ -0,0 +1,34 @@
extends Node
class_name AttractedToMovement
signal touching_goal
signal goal_reached
export var movement_per_second: float
export var goal_path: NodePath
onready var parent: KinematicBody2D = get_parent()
onready var goal: StaticBody2D = get_node(goal_path) if goal_path else null
var _goal_reached_triggered: bool = false
func move():
var direction: Vector2 = (goal.global_position - parent.global_position).normalized()
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
for slide_no in parent.get_slide_count():
var slide = parent.get_slide_collision(slide_no)
if slide.collider == goal:
emit_signal("touching_goal")
if not _goal_reached_triggered:
emit_signal("goal_reached")
_goal_reached_triggered = true
func _physics_process(_delta):
if goal:
move()

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/behaviours/movement/AttractedToMovement.gd" type="Script" id=1]
[node name="AttractedToMovement" type="Node"]
script = ExtResource( 1 )
__meta__ = {
"_editor_description_": "Moves the parent KinematicBody2D towards the specified goal.
It does not automatically set a goal!"
}
movement_per_second = 32.0

View file

@ -1,12 +1,16 @@
extends Node
onready var target: KinematicBody2D = get_parent()
export var movement_per_second: float = 400.0
class_name BulletMovement
signal hit(collision)
export var movement_per_second: float
onready var target: KinematicBody2D = get_parent()
func _physics_process(delta):
var direction = Vector2(cos(target.rotation), sin(target.rotation))
var collision: KinematicCollision2D = target.move_and_collide(direction * movement_per_second * delta)

View file

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

View file

@ -1,14 +1,14 @@
extends Node
class_name ErraticMovement
export var movement_per_second: float = 16.0
export var movement_per_second: float
onready var target: KinematicBody2D = get_parent()
onready var rng = RandomNumberGenerator.new()
onready var rng: RandomNumberGenerator = get_tree().root.get_node("Game/RNG").rng
func _physics_process(_delta):
var direction: Vector2 = Vector2(rng.randf_range(-1, 1), rng.randf_range(-1, 1)).normalized()
var _motion: Vector2 = target.move_and_slide(direction * movement_per_second, Vector2.ZERO)

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/entities/behaviours/ErraticMovement.gd" type="Script" id=1]
[ext_resource path="res://src/behaviours/movement/ErraticMovement.gd" type="Script" id=1]
[node name="ErraticMovement" type="Node"]
script = ExtResource( 1 )
movement_per_second = 16.0

View file

@ -1,10 +1,11 @@
extends Node
class_name PlayerMovement
export var movement_per_second: float = 96.0
export var movement_per_second: float
onready var target: KinematicBody2D = get_parent()
onready var parent: KinematicBody2D = get_parent()
func _physics_process(_delta):
@ -18,4 +19,4 @@ func _physics_process(_delta):
if direction.length() > 1:
direction.normalized()
var _motion: Vector2 = target.move_and_slide(direction * movement_per_second, Vector2.ZERO)
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/entities/behaviours/PlayerMovement.gd" type="Script" id=1]
[ext_resource path="res://src/behaviours/movement/PlayerMovement.gd" type="Script" id=1]
[node name="PlayerMovement" type="Node"]
script = ExtResource( 1 )
movement_per_second = 96.0

View file

@ -0,0 +1,35 @@
extends Node
class_name TeleportToScreenEdge
signal teleported(to)
export var bounds: Vector2
onready var parent = get_parent()
onready var rng = get_tree().root.get_node("Game/RNG").rng
func teleport():
var random = rng.randi_range(1, 4)
var new_position
if random == 1:
# Left
new_position = Vector2(0, rng.randf_range(0, bounds.y))
elif random == 2:
# Right
new_position = Vector2(bounds.x, rng.randf_range(0, bounds.y))
elif random == 3:
# Top
new_position = Vector2(rng.randf_range(0, bounds.x), 0)
else:
# Bottom
new_position = Vector2(rng.randf_range(0, bounds.y), bounds.y)
print("Moving to to %s" % new_position)
parent.set_position(new_position)
emit_signal("teleported", parent.position)

View file

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

View file

@ -0,0 +1,47 @@
extends Node
class_name DropLoot
export(Array, PackedScene) var loot_types
export(Array, float) var loot_weights
# This may break if the container structure is changed
onready var source: Node2D = get_parent()
onready var container: Node = get_node(@"../../../Pickups")
onready var rng: RandomNumberGenerator = get_tree().root.get_node("Game/RNG").rng
func _ready():
if len(loot_types) != len(loot_weights):
push_error("The amount of loot types and loot weights is different!")
func select_drop() -> PackedScene:
var total_weights: float = 0.0
for weight in loot_weights:
total_weights += weight
var result = rng.randf_range(0.0, total_weights)
for i in range(loot_types.len()):
var loot_type = loot_types[i]
var loot_weight = loot_weights[i]
result -= loot_weight
if result <= 0:
return loot_type
push_error("Couldn't select loot type; something went wrong during the calculation!")
return null
func create_drop() -> Node:
var scene = select_drop()
# Allow dropping nothing
if scene == null:
return null
var node = scene.instance()
node.set_position(source.global_position)
container.add_child(node)
return node

View file

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

View file

@ -0,0 +1,36 @@
extends Node2D
class_name SpawnEveryPeriod
signal spawned(node)
export var spawning: PackedScene
export var bounds: Vector2 setget set_bounds, get_bounds
export var period_secs: float setget set_period, get_period
onready var container = get_parent()
func spawn():
if spawning == null:
return
var node: Node2D = spawning.instance()
container.add_child(node)
node.set_position(global_position)
emit_signal("spawned", node)
func set_bounds(value):
$TeleportToScreenEdge.bounds = value
func get_bounds():
return $TeleportToScreenEdge.bounds
func set_period(value):
$Period.wait_time = value
func get_period():
return $Period.wait_time

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/behaviours/spawning/SpawnEveryPeriod.gd" type="Script" id=1]
[node name="SpawnEveryPeriod" type="Node2D"]
script = ExtResource( 1 )
[node name="Period" type="Timer" parent="."]
autostart = true
[connection signal="timeout" from="Period" to="." method="spawn"]

View file

@ -0,0 +1,10 @@
extends Node
class_name SetSpawnedGoalTo
export var goal_path: NodePath
func set_goal(node):
var movement = node.get_node("AttractedToMovement")
movement.goal = get_node(goal_path)

View file

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

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 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 )]

View file

@ -1,21 +0,0 @@
extends KinematicBody2D
export var damage: int = 1
func _on_BulletMovement_hit(collision: KinematicCollision2D):
# Find the owner of this bullet
var bullet_owner = Ownership.get_value(self)
# Check if the bullet should do damage
var same_alliance = Alliance.compare(bullet_owner, collision.collider)
if same_alliance:
return
# Check if it is possible to damage the collider
var damageable = collision.collider.get_node("Damageable")
if damageable == null:
return
# Damage the collider!
damageable.health -= damage
# Alas, destroy self
queue_free()

View file

@ -1,31 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://src/mechanics/Arrow.png" type="Texture" id=1]
[ext_resource path="res://src/entities/behaviours/BulletMovement.gd" type="Script" id=2]
[ext_resource path="res://src/entities/behaviours/Ownership.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/entities/Bullet.gd" type="Script" id=4]
[ext_resource path="res://src/entities/behaviours/ArrowSound.gd" type="Script" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 8 )
[node name="Bullet" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 2
script = ExtResource( 4 )
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape"]
scale = Vector2( 1, 0.5 )
texture = ExtResource( 1 )
[node name="BulletMovement" type="Node" parent="."]
script = ExtResource( 2 )
[node name="Ownership" parent="." instance=ExtResource( 3 )]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
script = ExtResource( 5 )
[connection signal="hit" from="BulletMovement" to="." method="_on_BulletMovement_hit"]

View file

@ -1,8 +0,0 @@
extends KinematicBody2D
func _on_Damageable_dead():
for child in get_children():
if child.name == "BranchSpawn":
child.BranchSpawn()
queue_free()

View file

@ -1,35 +0,0 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://src/mechanics/Black.png" type="Texture" id=1]
[ext_resource path="res://src/entities/behaviours/ErraticMovement.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/entities/behaviours/AttractedTo.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/entities/behaviours/Damageable.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/entities/behaviours/Alliance.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/entities/Enemy.gd" type="Script" id=6]
[ext_resource path="res://src/entities/behaviours/BranchSpawn.gd" type="Script" id=7]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[node name="Enemy" type="KinematicBody2D"]
collision_layer = 3
script = ExtResource( 6 )
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape"]
texture = ExtResource( 1 )
[node name="AttractedTo" parent="." instance=ExtResource( 3 )]
[node name="ErraticMovement" parent="." instance=ExtResource( 2 )]
[node name="Damageable" parent="." instance=ExtResource( 4 )]
[node name="Alliance" parent="." instance=ExtResource( 5 )]
alliance = -1
[node name="BranchSpawn" type="Node" parent="."]
script = ExtResource( 7 )
[connection signal="dead" from="Damageable" to="." method="_on_Damageable_dead"]

View file

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@ -28,6 +28,7 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true

View file

@ -1,31 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
[ext_resource path="res://src/entities/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/entities/behaviours/BulletSpawn.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/entities/behaviours/Damageable.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/entities/behaviours/Alliance.tscn" type="PackedScene" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[node name="Player" type="KinematicBody2D"]
collision_layer = 3
collision/safe_margin = 0.02
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape"]
texture = ExtResource( 1 )
[node name="PlayerMovement" parent="." instance=ExtResource( 2 )]
[node name="BulletSpawn" parent="." instance=ExtResource( 3 )]
[node name="Damageable" parent="." instance=ExtResource( 4 )]
health = 5
max_health = 5
[node name="Alliance" parent="." instance=ExtResource( 5 )]
alliance = 1

View file

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

View file

@ -1,10 +0,0 @@
extends AudioStreamPlayer
func _ready():
set_stream(load("res://src/Sounds/arrow.mp3"))
play()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -1,27 +0,0 @@
extends Node
export var movement_per_second: float = 32.0
export var goal_path: String = "../../PhaseOneContainer/Fire"
onready var target: KinematicBody2D = get_parent()
# TODO: Use a better algorithm
onready var goal: StaticBody2D = get_node(goal_path)
signal touching_goal
var goal_reached_triggered: bool = false
signal goal_reached
func _physics_process(_delta):
if target.global_position != null:
var direction: Vector2 = (goal.global_position - target.global_position).normalized()
var _motion: Vector2 = target.move_and_slide(direction * movement_per_second, Vector2.ZERO)
for slide_no in target.get_slide_count():
var slide = target.get_slide_collision(slide_no)
if slide.collider == goal:
emit_signal("touching_goal")
if not goal_reached_triggered:
emit_signal("goal_reached")
goal_reached_triggered = true

View file

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

View file

@ -1,13 +0,0 @@
extends Node
export var branch: PackedScene = preload("res://src/entities/Pickup.tscn")
export var branch_container_node_path: String = "../.."
onready var branch_container_node: Node = get_node(branch_container_node_path)
onready var source: Node2D = get_parent()
func BranchSpawn():
var new_branch = branch.instance()
new_branch.set_position(source.global_position)
branch_container_node.add_child(new_branch)

View file

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

View file

@ -1,34 +0,0 @@
extends Node
# Items
export var enemy: PackedScene = preload("res://src/entities/Enemy.tscn")
export var bullet_container_node_path: String = "../.."
onready var bullet_container_node: Node = get_node(bullet_container_node_path)
var _timer : Timer = null
var rng : RandomNumberGenerator = RandomNumberGenerator.new()
func _ready():
_timer = Timer.new()
add_child(_timer)
_timer.connect("timeout", self, "_on_Timer_timeout")
_timer.set_wait_time(1.5)
_timer.set_one_shot(false) # Make sure it loops
_timer.start()
rng.randomize()
func _on_Timer_timeout():
var position = Vector2(0, 0)
var new_enemy = enemy.instance()
var random = rng.randi_range(1, 4)
if random == 1: position = Vector2(0, rng.randf_range(0, 640))
elif random == 2: position = Vector2(1280, rng.randf_range(0, 640))
elif random == 3: position = Vector2(rng.randf_range(0, 1280), 0)
else: position = Vector2(rng.randf_range(0, 640), 640)
new_enemy.set_position(position)
bullet_container_node.add_child(new_enemy)

View file

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

View file

@ -1,11 +0,0 @@
extends Sprite
var rng : RandomNumberGenerator = RandomNumberGenerator.new()
func _ready():
rng.randomize()
self.rotate(rng.randf_range(0,360))
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -0,0 +1,15 @@
[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]
[node name="AbstractBullet" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 2
[node name="BulletMovement" parent="." instance=ExtResource( 1 )]
[node name="Ownership" parent="." instance=ExtResource( 2 )]
[node name="Damaging" parent="." instance=ExtResource( 3 )]

View file

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex"
path="res://.import/Arrow.png-f36200d9da913e07d0ffb1a2717b8b5c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/mechanics/Arrow.png"
dest_files=[ "res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex" ]
source_file="res://src/entities/bullets/Arrow.png"
dest_files=[ "res://.import/Arrow.png-f36200d9da913e07d0ffb1a2717b8b5c.stex" ]
[params]
@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/entities/bullets/AbstractBullet.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/entities/bullets/Arrow.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 6 )
[node name="Arrow" instance=ExtResource( 1 )]
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
texture = ExtResource( 2 )
[node name="BulletMovement" parent="." index="1"]
movement_per_second = 400.0

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/behaviours/spawning/DropLoot.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/entities/AbstractEntity.tscn" type="PackedScene" id=2]
[node name="AbstractEnemy" instance=ExtResource( 2 )]
[node name="Alliance" parent="." index="0"]
alliance = -1
[node name="DropLoot" parent="." index="2" instance=ExtResource( 1 )]

View file

@ -0,0 +1,23 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://src/mechanics/White.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/AttractedToMovement.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/entities/enemies/AbstractEnemy.tscn" type="PackedScene" id=4]
[ext_resource path="res://FireExtinguisherEnemy.gd" type="Script" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[node name="FireExtinguisherEnemy" instance=ExtResource( 4 )]
script = ExtResource( 5 )
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
texture = ExtResource( 1 )
[node name="ErraticMovement" parent="." index="4" instance=ExtResource( 2 )]
[node name="AttractedToMovement" parent="." index="5" instance=ExtResource( 3 )]

View file

@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/behaviours/movement/PlayerMovement.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/entities/AbstractEntity.tscn" type="PackedScene" id=3]
[node name="AbstractPlayer" instance=ExtResource( 3 )]
[node name="PlayerMovement" parent="." index="2" instance=ExtResource( 2 )]

View file

@ -0,0 +1,15 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/entities/players/AbstractPlayer.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[node name="PhaseOnePlayer" instance=ExtResource( 1 )]
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
texture = ExtResource( 2 )

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,5 @@
extends Node
export var fire_path: NodePath
export var choir_min: float = 0.05
export var choir_max: float = 0.30
@ -10,12 +9,7 @@ export var drum_min: float = 0.40
export var drum_max: float = 0.80
func _ready():
var fire = get_node(fire_path)
fire.connect("intensity_changed", self, "_on_fire_intensity_changed")
func _on_fire_intensity_changed(value):
func _on_Fire_intensity_changed(value):
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"

View file

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@ -28,6 +28,7 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true

View file

@ -28,6 +28,7 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true

View file

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2

View file

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@ -28,6 +28,7 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true

10
src/mechanics/RNG.gd Normal file
View file

@ -0,0 +1,10 @@
extends Node
class_name RNG
var rng: RandomNumberGenerator
func _ready():
rng = RandomNumberGenerator.new()
rng.randomize()

9
src/mechanics/RNG.tscn Normal file
View file

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/mechanics/RNG.gd" type="Script" id=1]
[node name="RNG" type="Node"]
script = ExtResource( 1 )
__meta__ = {
"_editor_description_": "Global random number generator that can be accessed by any script at $/Game/RNG."
}

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/behaviours/spawning/SpawnEveryPeriod.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/behaviours/movement/TeleportToScreenEdge.tscn" type="PackedScene" id=2]
[node name="ScreenEdgeSpawner" instance=ExtResource( 1 )]
[node name="TeleportToScreenEdge" parent="." index="1" instance=ExtResource( 2 )]
[connection signal="timeout" from="Period" to="TeleportToScreenEdge" method="teleport"]

View file

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@ -28,6 +28,7 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true

View file

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex"
path="res://.import/Branch1.png-7e27ca4a6b40f6dab201183aecab63ec.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/mechanics/Branch1.png"
dest_files=[ "res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex" ]
source_file="res://src/pickups/Branch1.png"
dest_files=[ "res://.import/Branch1.png-7e27ca4a6b40f6dab201183aecab63ec.stex" ]
[params]
@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2

View file

@ -1,7 +1,7 @@
extends Area2D
export var sprite: Texture = preload("res://src/mechanics/Branch1.png") setget set_sprite, get_sprite
export var sprite: Texture = preload("res://src/mechanics/White.png") setget set_sprite, get_sprite
export var duration_seconds: float = 1.0 setget set_duration, get_duration
export var despawn_seconds: float = INF setget set_despawn, get_despawn

View file

@ -1,28 +1,29 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/mechanics/Branch1.png" type="Texture" id=1]
[ext_resource path="res://src/entities/Pickup.gd" type="Script" id=2]
[ext_resource path="res://src/entities/behaviours/SpriteRandomRotation.gd" type="Script" id=3]
[ext_resource path="res://src/entities/behaviours/SpriteRandomRotation.gd" type="Script" id=1]
[ext_resource path="res://src/pickups/Branch1.png" type="Texture" id=2]
[ext_resource path="res://src/entities/Pickup.gd" type="Script" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[node name="Pickup" type="Area2D"]
input_pickable = false
script = ExtResource( 2 )
script = ExtResource( 3 )
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape"]
texture = ExtResource( 1 )
script = ExtResource( 3 )
texture = ExtResource( 2 )
script = ExtResource( 1 )
[node name="Duration" type="Timer" parent="."]
one_shot = true
[node name="Despawn" type="Timer" parent="."]
one_shot = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="timeout" from="Duration" to="." method="_on_Duration_timeout"]
[connection signal="timeout" from="Despawn" to="." method="_on_Despawn_timeout"]

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/entities/pickupeffects/ChangeFireIntensity.gd" type="Script" id=1]
[ext_resource path="res://src/pickups/effects/ChangeFireIntensity.gd" type="Script" id=1]
[node name="ChangeFireIntensity" type="Node"]
script = ExtResource( 1 )

BIN
src/sounds/Arrow.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
path="res://.import/Arrow.mp3-034096617a893a977e49af1155ab45bc.mp3str"
[deps]
source_file="res://src/sounds/Arrow.mp3"
dest_files=[ "res://.import/Arrow.mp3-034096617a893a977e49af1155ab45bc.mp3str" ]
[params]
loop=false
loop_offset=0

BIN
src/sounds/Branch.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
path="res://.import/Branch.mp3-5d37fbfbb6a12f007268561bc5ec7f37.mp3str"
[deps]
source_file="res://src/sounds/Branch.mp3"
dest_files=[ "res://.import/Branch.mp3-5d37fbfbb6a12f007268561bc5ec7f37.mp3str" ]
[params]
loop=false
loop_offset=0

BIN
src/sounds/Death.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
path="res://.import/Death.mp3-d9e2895f2f81775cb1dcf8d65bac6b2b.mp3str"
[deps]
source_file="res://src/sounds/Death.mp3"
dest_files=[ "res://.import/Death.mp3-d9e2895f2f81775cb1dcf8d65bac6b2b.mp3str" ]
[params]
loop=false
loop_offset=0