mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-25 14:14:19 +00:00
💥 I am breaking a lot of stuff
This commit is contained in:
parent
a5d1a25ba5
commit
49315b7aca
65 changed files with 524 additions and 282 deletions
7
FireExtinguisherEnemy.gd
Normal file
7
FireExtinguisherEnemy.gd
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
extends KinematicBody2D
|
||||||
|
class_name FireExtinguisherEnemy
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$AttractedToMovement.goal = get_tree().root.find_node("*/Fire")
|
||||||
|
|
|
@ -12,7 +12,7 @@ _global_script_classes=[ {
|
||||||
"base": "Node",
|
"base": "Node",
|
||||||
"class": "Alliance",
|
"class": "Alliance",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://src/behaviours/Alliance.gd"
|
"path": "res://src/behaviours/damage/Alliance.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Node",
|
"base": "Node",
|
||||||
"class": "AttractedToMovement",
|
"class": "AttractedToMovement",
|
||||||
|
@ -20,14 +20,80 @@ _global_script_classes=[ {
|
||||||
"path": "res://src/behaviours/movement/AttractedToMovement.gd"
|
"path": "res://src/behaviours/movement/AttractedToMovement.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Node",
|
"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",
|
"class": "Ownership",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://src/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={
|
_global_script_class_icons={
|
||||||
"Alliance": "",
|
"Alliance": "",
|
||||||
"AttractedToMovement": "",
|
"AttractedToMovement": "",
|
||||||
"Ownership": ""
|
"BulletMovement": "",
|
||||||
|
"Damaging": "",
|
||||||
|
"DropLoot": "",
|
||||||
|
"ErraticMovement": "",
|
||||||
|
"FireExtinguisherEnemy": "",
|
||||||
|
"Ownership": "",
|
||||||
|
"PlayerMovement": "",
|
||||||
|
"RNG": "",
|
||||||
|
"RandomRotationOnReady": "",
|
||||||
|
"SetSpawnedGoalTo": "",
|
||||||
|
"SpawnEveryPeriod": "",
|
||||||
|
"TeleportToScreenEdge": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
extends Node
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
|
|
||||||
export var branch: PackedScene
|
|
||||||
export var branch_container_node_path: NodePath
|
|
||||||
|
|
||||||
|
|
||||||
onready var branch_container_node: Node = get_node(branch_container_node_path)
|
|
||||||
onready var source: Node2D = get_parent()
|
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
var new_branch = branch.instance()
|
|
||||||
new_branch.set_position(source.global_position)
|
|
||||||
branch_container_node.add_child(new_branch)
|
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/BranchSpawn.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="BranchSpawn" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/Damageable.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="Damageable" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
|
@ -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)
|
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/ErraticMovement.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="ErraticMovement" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/Ownership.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="Ownership" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/PlayerMovement.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="PlayerMovement" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
10
src/behaviours/RandomRotationOnReady.gd
Normal file
10
src/behaviours/RandomRotationOnReady.gd
Normal 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)
|
9
src/behaviours/RandomRotationOnReady.tscn
Normal file
9
src/behaviours/RandomRotationOnReady.tscn
Normal 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."
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/Alliance.gd" type="Script" id=1]
|
[ext_resource path="res://src/behaviours/damage/Alliance.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="Alliance" type="Node"]
|
[node name="Alliance" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
9
src/behaviours/damage/Damageable.tscn
Normal file
9
src/behaviours/damage/Damageable.tscn
Normal 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."
|
||||||
|
}
|
28
src/behaviours/damage/Damaging.gd
Normal file
28
src/behaviours/damage/Damaging.gd
Normal 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()
|
11
src/behaviours/damage/Damaging.tscn
Normal file
11
src/behaviours/damage/Damaging.tscn
Normal 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
|
9
src/behaviours/damage/Ownership.tscn
Normal file
9
src/behaviours/damage/Ownership.tscn
Normal 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."
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/entities/behaviours/AttractedToMovement.gd" type="Script" id=1]
|
[ext_resource path="res://src/behaviours/movement/AttractedToMovement.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="AttractedToMovement" type="Node"]
|
[node name="AttractedToMovement" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_editor_description_": "Moves the parent KinematicBody2D towards the specified goal."
|
"_editor_description_": "Moves the parent KinematicBody2D towards the specified goal.
|
||||||
|
It does not automatically set a goal!"
|
||||||
}
|
}
|
||||||
|
movement_per_second = 32.0
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
class_name BulletMovement
|
||||||
|
|
||||||
|
|
||||||
signal hit(collision)
|
signal hit(collision)
|
6
src/behaviours/movement/BulletMovement.tscn
Normal file
6
src/behaviours/movement/BulletMovement.tscn
Normal 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 )
|
|
@ -1,19 +1,14 @@
|
||||||
extends Node
|
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 target: KinematicBody2D = get_parent()
|
||||||
var rng: RandomNumberGenerator
|
onready var rng: RandomNumberGenerator = get_tree().root.get_node("Game/RNG").rng
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
rng = RandomNumberGenerator.new()
|
|
||||||
rng.randomize()
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
var direction: Vector2 = Vector2(rng.randf_range(-1, 1), rng.randf_range(-1, 1)).normalized()
|
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)
|
var _motion: Vector2 = target.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
||||||
|
|
7
src/behaviours/movement/ErraticMovement.tscn
Normal file
7
src/behaviours/movement/ErraticMovement.tscn
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[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
|
|
@ -1,10 +1,11 @@
|
||||||
extends Node
|
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):
|
func _physics_process(_delta):
|
||||||
|
@ -18,4 +19,4 @@ func _physics_process(_delta):
|
||||||
if direction.length() > 1:
|
if direction.length() > 1:
|
||||||
direction.normalized()
|
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)
|
7
src/behaviours/movement/PlayerMovement.tscn
Normal file
7
src/behaviours/movement/PlayerMovement.tscn
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[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
|
35
src/behaviours/movement/TeleportToScreenEdge.gd
Normal file
35
src/behaviours/movement/TeleportToScreenEdge.gd
Normal 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)
|
6
src/behaviours/movement/TeleportToScreenEdge.tscn
Normal file
6
src/behaviours/movement/TeleportToScreenEdge.tscn
Normal 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 )
|
47
src/behaviours/spawning/DropLoot.gd
Normal file
47
src/behaviours/spawning/DropLoot.gd
Normal 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
|
6
src/behaviours/spawning/DropLoot.tscn
Normal file
6
src/behaviours/spawning/DropLoot.tscn
Normal 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 )
|
36
src/behaviours/spawning/SpawnEveryPeriod.gd
Normal file
36
src/behaviours/spawning/SpawnEveryPeriod.gd
Normal 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
|
11
src/behaviours/spawning/SpawnEveryPeriod.tscn
Normal file
11
src/behaviours/spawning/SpawnEveryPeriod.tscn
Normal 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"]
|
10
src/behaviours/targeting/SetSpawnedGoalTo.gd
Normal file
10
src/behaviours/targeting/SetSpawnedGoalTo.gd
Normal 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)
|
6
src/behaviours/targeting/SetSpawnedGoalTo.tscn
Normal file
6
src/behaviours/targeting/SetSpawnedGoalTo.tscn
Normal 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 )
|
|
@ -1,7 +1,7 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/behaviours/Damageable.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/behaviours/damage/Damageable.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/behaviours/Alliance.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/behaviours/damage/Alliance.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
[node name="AbstractEntity" type="KinematicBody2D"]
|
[node name="AbstractEntity" type="KinematicBody2D"]
|
||||||
collision_layer = 3
|
collision_layer = 3
|
||||||
|
|
|
@ -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()
|
|
|
@ -1,33 +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/behaviours/BulletMovement.gd" type="Script" id=2]
|
|
||||||
[ext_resource path="res://src/behaviours/Ownership.tscn" type="PackedScene" id=3]
|
|
||||||
[ext_resource path="res://src/entities/Bullet.gd" type="Script" id=4]
|
|
||||||
[ext_resource path="res://src/sounds/Arrow.mp3" type="AudioStream" id=5]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
|
||||||
extents = Vector2( 16, 3 )
|
|
||||||
|
|
||||||
[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="."]
|
|
||||||
stream = ExtResource( 5 )
|
|
||||||
autoplay = true
|
|
||||||
|
|
||||||
[connection signal="hit" from="BulletMovement" to="." method="_on_BulletMovement_hit"]
|
|
|
@ -1,8 +0,0 @@
|
||||||
extends KinematicBody2D
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Damageable_dead():
|
|
||||||
for child in get_children():
|
|
||||||
if child.name == "BranchSpawn":
|
|
||||||
child.BranchSpawn()
|
|
||||||
queue_free()
|
|
|
@ -1,36 +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/behaviours/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/Damageable.tscn" type="PackedScene" id=4]
|
|
||||||
[ext_resource path="res://src/behaviours/Alliance.tscn" type="PackedScene" id=5]
|
|
||||||
[ext_resource path="res://src/entities/Enemy.gd" type="Script" id=6]
|
|
||||||
[ext_resource path="res://src/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"]
|
|
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://src/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
|
|
||||||
[ext_resource path="res://src/entities/AbstractEntity.tscn" type="PackedScene" id=3]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
|
||||||
extents = Vector2( 16, 16 )
|
|
||||||
|
|
||||||
[node name="Player" instance=ExtResource( 3 )]
|
|
||||||
|
|
||||||
[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="PlayerMovement" parent="." index="1" instance=ExtResource( 2 )]
|
|
15
src/entities/bullets/AbstractBullet.tscn
Normal file
15
src/entities/bullets/AbstractBullet.tscn
Normal 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 )]
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex"
|
path="res://.import/Arrow.png-f36200d9da913e07d0ffb1a2717b8b5c.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://src/mechanics/Arrow.png"
|
source_file="res://src/entities/bullets/Arrow.png"
|
||||||
dest_files=[ "res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex" ]
|
dest_files=[ "res://.import/Arrow.png-f36200d9da913e07d0ffb1a2717b8b5c.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
18
src/entities/bullets/Arrow.tscn
Normal file
18
src/entities/bullets/Arrow.tscn
Normal 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
|
11
src/entities/enemies/AbstractEnemy.tscn
Normal file
11
src/entities/enemies/AbstractEnemy.tscn
Normal 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 )]
|
23
src/entities/enemies/FireExtinguisherEnemy.tscn
Normal file
23
src/entities/enemies/FireExtinguisherEnemy.tscn
Normal 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 )]
|
8
src/entities/players/AbstractPlayer.tscn
Normal file
8
src/entities/players/AbstractPlayer.tscn
Normal 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 )]
|
15
src/entities/players/PhaseOnePlayer.tscn
Normal file
15
src/entities/players/PhaseOnePlayer.tscn
Normal 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
|
@ -1,6 +1,5 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
export var fire_path: NodePath
|
|
||||||
|
|
||||||
export var choir_min: float = 0.05
|
export var choir_min: float = 0.05
|
||||||
export var choir_max: float = 0.30
|
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
|
export var drum_max: float = 0.80
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _on_Fire_intensity_changed(value):
|
||||||
var fire = get_node(fire_path)
|
|
||||||
fire.connect("intensity_changed", self, "_on_fire_intensity_changed")
|
|
||||||
|
|
||||||
|
|
||||||
func _on_fire_intensity_changed(value):
|
|
||||||
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
|
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
|
||||||
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"
|
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
extends Sprite
|
extends Node
|
||||||
|
class_name RNG
|
||||||
|
|
||||||
|
|
||||||
var rng: RandomNumberGenerator
|
var rng: RandomNumberGenerator
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
rng = RandomNumberGenerator.new()
|
rng = RandomNumberGenerator.new()
|
||||||
rng.randomize()
|
rng.randomize()
|
||||||
self.rotate(rng.randf() * 2 * PI)
|
|
9
src/mechanics/RNG.tscn
Normal file
9
src/mechanics/RNG.tscn
Normal 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."
|
||||||
|
}
|
10
src/mechanics/ScreenEdgeSpawner.tscn
Normal file
10
src/mechanics/ScreenEdgeSpawner.tscn
Normal 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"]
|
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex"
|
path="res://.import/Branch1.png-7e27ca4a6b40f6dab201183aecab63ec.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://src/mechanics/Branch1.png"
|
source_file="res://src/pickups/Branch1.png"
|
||||||
dest_files=[ "res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex" ]
|
dest_files=[ "res://.import/Branch1.png-7e27ca4a6b40f6dab201183aecab63ec.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -28,6 +28,7 @@ process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
process/HDR_as_SRGB=false
|
||||||
process/invert_color=false
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=true
|
|
@ -1,28 +1,29 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[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/behaviours/SpriteRandomRotation.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://src/entities/Pickup.gd" type="Script" id=2]
|
[ext_resource path="res://src/pickups/Branch1.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://src/behaviours/SpriteRandomRotation.gd" type="Script" id=3]
|
[ext_resource path="res://src/entities/Pickup.gd" type="Script" id=3]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 16, 16 )
|
extents = Vector2( 16, 16 )
|
||||||
|
|
||||||
[node name="Pickup" type="Area2D"]
|
[node name="Pickup" type="Area2D"]
|
||||||
input_pickable = false
|
input_pickable = false
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Shape" type="CollisionShape2D" parent="."]
|
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="Shape"]
|
[node name="Sprite" type="Sprite" parent="Shape"]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 2 )
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Duration" type="Timer" parent="."]
|
[node name="Duration" type="Timer" parent="."]
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="Despawn" type="Timer" parent="."]
|
[node name="Despawn" type="Timer" parent="."]
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
[connection signal="timeout" from="Duration" to="." method="_on_Duration_timeout"]
|
[connection signal="timeout" from="Duration" to="." method="_on_Duration_timeout"]
|
||||||
[connection signal="timeout" from="Despawn" to="." method="_on_Despawn_timeout"]
|
[connection signal="timeout" from="Despawn" to="." method="_on_Despawn_timeout"]
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[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"]
|
[node name="ChangeFireIntensity" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
Loading…
Reference in a new issue