mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-21 12:14:18 +00:00
💥 hurry up
This commit is contained in:
parent
1f37d21c0d
commit
9abdd614ae
125 changed files with 1007 additions and 1015 deletions
|
@ -15,9 +15,9 @@ _global_script_classes=[ {
|
|||
"path": "res://src/behaviours/damage/Alliance.gd"
|
||||
}, {
|
||||
"base": "KinematicBody2D",
|
||||
"class": "ArrowAlternative",
|
||||
"class": "Arrow",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/entities/bullets/ArrowAlternative.gd"
|
||||
"path": "res://src/entities/bullets/Arrow.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "AttractedToMovement",
|
||||
|
@ -30,6 +30,21 @@ _global_script_classes=[ {
|
|||
"path": "res://src/behaviours/movement/BulletMovement.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "ChangeFireIntensity",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/pickups/effects/ChangeFireIntensity.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "DamageEveryTick",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/DamageEveryTick.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Damageable",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/Damageable.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Damaging",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/Damaging.gd"
|
||||
|
@ -39,10 +54,10 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/spawning/DropLoot.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "ErraticMovement",
|
||||
"base": "Node2D",
|
||||
"class": "Fire",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/movement/ErraticMovement.gd"
|
||||
"path": "res://src/entities/fire/Fire.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Flammable",
|
||||
|
@ -60,6 +75,16 @@ _global_script_classes=[ {
|
|||
"path": "res://src/behaviours/spawning/FreeWhenShapeIsOffScreen.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Music",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/levels/Music.gd"
|
||||
}, {
|
||||
"base": "Button",
|
||||
"class": "MuteButton",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/levels/ui/MuteButton.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Ownership",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/damage/Ownership.gd"
|
||||
|
@ -85,16 +110,26 @@ _global_script_classes=[ {
|
|||
"path": "res://src/pickups/effects/RapidFire.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "SetSpawnedGoalTo",
|
||||
"class": "SetSpawnedATMGoalTo",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/targeting/SetSpawnedGoalTo.gd"
|
||||
"path": "res://src/behaviours/targeting/SetSpawnedATMGoalTo.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"base": "Node",
|
||||
"class": "ShootOnClick",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/spawning/ShootOnClick.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "ShootWhenPossible",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/spawning/ShootWhenPossible.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "SpawnEveryPeriod",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/spawning/SpawnEveryPeriod.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"base": "Node",
|
||||
"class": "SpawnOnShoot",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/spawning/SpawnOnShoot.gd"
|
||||
|
@ -108,34 +143,48 @@ _global_script_classes=[ {
|
|||
"class": "TeleportToScreenEdge",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/movement/TeleportToRandomPosition.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "Utils",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/Utils.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Alliance": "",
|
||||
"ArrowAlternative": "",
|
||||
"Arrow": "",
|
||||
"AttractedToMovement": "",
|
||||
"BulletMovement": "",
|
||||
"ChangeFireIntensity": "",
|
||||
"DamageEveryTick": "",
|
||||
"Damageable": "",
|
||||
"Damaging": "",
|
||||
"DropLoot": "",
|
||||
"ErraticMovement": "",
|
||||
"Fire": "",
|
||||
"Flammable": "",
|
||||
"FourSidedSprite": "",
|
||||
"FreeWhenShapeIsOffScreen": "",
|
||||
"Music": "",
|
||||
"MuteButton": "",
|
||||
"Ownership": "",
|
||||
"PlayerMovement": "",
|
||||
"RNG": "",
|
||||
"RandomRotationOnReady": "",
|
||||
"RapidFire": "",
|
||||
"SetSpawnedGoalTo": "",
|
||||
"SetSpawnedATMGoalTo": "",
|
||||
"ShootOnClick": "",
|
||||
"ShootWhenPossible": "",
|
||||
"SpawnEveryPeriod": "",
|
||||
"SpawnOnShoot": "",
|
||||
"TeleportToRandomPosition": "",
|
||||
"TeleportToScreenEdge": ""
|
||||
"TeleportToScreenEdge": "",
|
||||
"Utils": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="LD50"
|
||||
run/main_scene="res://src/levels/MainMenu.tscn"
|
||||
config/name="The Cold Night"
|
||||
run/main_scene="res://src/levels/Game.tscn"
|
||||
boot_splash/bg_color=Color( 0, 0, 0, 1 )
|
||||
|
||||
[audio]
|
||||
|
||||
|
|
5
src/Utils.gd
Normal file
5
src/Utils.gd
Normal file
|
@ -0,0 +1,5 @@
|
|||
class_name Utils
|
||||
|
||||
|
||||
static func is_between(m, val, x):
|
||||
return (m < val) && (val <= x)
|
|
@ -1,6 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/BulletSpawn.gd" type="Script" id=1]
|
||||
|
||||
[node name="BulletSpawn" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -2,22 +2,31 @@ extends Node
|
|||
class_name Alliance
|
||||
|
||||
|
||||
signal alliance_changed(origin, value)
|
||||
|
||||
|
||||
enum AllianceKind {
|
||||
ENEMY = -1,
|
||||
NONE = 0,
|
||||
PLAYER = 1,
|
||||
}
|
||||
|
||||
export(AllianceKind) var alliance: int
|
||||
|
||||
export(AllianceKind) var alliance setget set_alliance
|
||||
|
||||
|
||||
static func get_value(first) -> int:
|
||||
var first_node = first.get_node("Alliance")
|
||||
var first_alliance = null
|
||||
if first_node != null:
|
||||
first_alliance = first_node.alliance
|
||||
return first_alliance
|
||||
func set_alliance(value):
|
||||
alliance = value
|
||||
emit_signal("alliance_changed", self, value)
|
||||
|
||||
|
||||
static func compare(first, second) -> bool:
|
||||
return get_value(first) == get_value(second)
|
||||
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)
|
||||
|
|
10
src/behaviours/damage/DamageEveryTick.gd
Normal file
10
src/behaviours/damage/DamageEveryTick.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends Node
|
||||
class_name DamageEveryTick
|
||||
|
||||
|
||||
onready var parent = get_parent()
|
||||
onready var target = parent.get_parent()
|
||||
|
||||
|
||||
func _process(delta):
|
||||
parent.do_damage(target, delta)
|
6
src/behaviours/damage/DamageEveryTick.tscn
Normal file
6
src/behaviours/damage/DamageEveryTick.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/damage/DamageEveryTick.gd" type="Script" id=1]
|
||||
|
||||
[node name="DamageEveryTick" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,25 +1,24 @@
|
|||
extends Node2D
|
||||
extends Node
|
||||
class_name Damageable
|
||||
|
||||
|
||||
signal health_changed(value)
|
||||
signal dead
|
||||
signal health_changed(origin, value)
|
||||
signal health_reached_min(origin, value)
|
||||
signal health_reached_max(origin, value)
|
||||
|
||||
|
||||
export var health: int = 1 setget set_health, get_health
|
||||
export var max_health: int = 1
|
||||
export(float) var min_health
|
||||
export(float) var max_health
|
||||
export(float) var health setget set_health
|
||||
|
||||
|
||||
onready var parent: Node = get_parent()
|
||||
onready var parent = get_parent()
|
||||
|
||||
|
||||
func set_health(value):
|
||||
health = value
|
||||
emit_signal("health_changed", value)
|
||||
if health <= 0:
|
||||
emit_signal("dead")
|
||||
# WIP
|
||||
parent.queue_free()
|
||||
|
||||
|
||||
func get_health():
|
||||
return health
|
||||
health = clamp(value, min_health, max_health)
|
||||
emit_signal("health_changed", self, value)
|
||||
if is_zero_approx(health - min_health):
|
||||
emit_signal("health_reached_min", self, value)
|
||||
if is_zero_approx(health - max_health):
|
||||
emit_signal("health_reached_max", self, value)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource path="res://src/behaviours/damage/Damageable.gd" type="Script" id=1]
|
||||
|
||||
[node name="Damageable" type="Node2D"]
|
||||
[node name="Damageable" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_description_": "Allows the parent entity to take damage and die."
|
||||
|
|
|
@ -2,31 +2,33 @@ extends Node
|
|||
class_name Damaging
|
||||
|
||||
|
||||
export var damage: int
|
||||
export var destroy_on_damage: bool
|
||||
export var friendly_fire: bool
|
||||
signal damaged(origin, damaged)
|
||||
|
||||
|
||||
onready var parent: Node2D = get_parent()
|
||||
export(float) var damage
|
||||
export(bool) var destroy_after_damage
|
||||
export(bool) var friendly_fire
|
||||
|
||||
|
||||
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
|
||||
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:
|
||||
return
|
||||
# Damage the collider!
|
||||
damageable.health -= damage
|
||||
# Alas, destroy self
|
||||
if destroy_on_damage:
|
||||
parent.queue_free()
|
||||
damageable.health += damage * multiplier
|
||||
# Emit the signal
|
||||
emit_signal("damaged", self, to)
|
||||
|
||||
|
||||
func do_damage_to_collider(collision: KinematicCollision2D):
|
||||
do_damage(collision.collider)
|
||||
|
|
|
@ -7,5 +7,4 @@ script = ExtResource( 1 )
|
|||
__meta__ = {
|
||||
"_editor_description_": "Allows the object to damage Damageable nodes."
|
||||
}
|
||||
damage = 1
|
||||
destroy_on_damage = true
|
||||
damage = -1.0
|
||||
|
|
|
@ -2,8 +2,8 @@ extends Node
|
|||
class_name Flammable
|
||||
|
||||
|
||||
signal caught_fire
|
||||
signal extinguished_fire
|
||||
signal caught_fire(origin)
|
||||
signal extinguished_fire(origin)
|
||||
|
||||
|
||||
var on_fire = false
|
||||
|
@ -11,9 +11,11 @@ var on_fire = false
|
|||
|
||||
func catch_fire():
|
||||
if not on_fire:
|
||||
emit_signal("caught_fire")
|
||||
on_fire = true
|
||||
emit_signal("caught_fire", self)
|
||||
|
||||
|
||||
func extinguish_fire():
|
||||
if on_fire:
|
||||
emit_signal("extinguished_fire")
|
||||
on_fire = false
|
||||
emit_signal("extinguished_fire", self)
|
||||
|
|
|
@ -2,12 +2,12 @@ extends Node
|
|||
class_name Ownership
|
||||
|
||||
|
||||
var entity_owner: Node = null
|
||||
var entity_owner = null
|
||||
|
||||
|
||||
static func get_value(first) -> Node:
|
||||
var first_node = first.get_node("Ownership")
|
||||
var first_eowner = null
|
||||
if first_node != null:
|
||||
first_eowner = first_node.entity_owner
|
||||
return first_eowner
|
||||
static func discover(node):
|
||||
var ownership_node = node.get_node("Ownership")
|
||||
if ownership_node != null:
|
||||
return ownership_node.entity_owner
|
||||
else:
|
||||
return null
|
||||
|
|
|
@ -2,28 +2,24 @@ extends AnimatedSprite
|
|||
class_name FourSidedSprite
|
||||
|
||||
|
||||
const UP_LEFT = -3*PI/4
|
||||
const UP_RIGHT = -PI/4
|
||||
const DOWN_RIGHT = PI/4
|
||||
const DOWN_LEFT = 3*PI/4
|
||||
const UP_LEFT = -3*TAU/8
|
||||
const UP_RIGHT = -TAU/8
|
||||
const DOWN_RIGHT = TAU/8
|
||||
const DOWN_LEFT = 3*TAU/8
|
||||
|
||||
|
||||
func turn(direction: Vector2) -> String:
|
||||
var angle = direction.angle()
|
||||
var anime
|
||||
|
||||
if _between(UP_LEFT, angle, UP_RIGHT):
|
||||
if Utils.is_between(UP_LEFT, angle, UP_RIGHT):
|
||||
anime = "up"
|
||||
elif _between(UP_RIGHT, angle, DOWN_RIGHT):
|
||||
elif Utils.is_between(UP_RIGHT, angle, DOWN_RIGHT):
|
||||
anime = "right"
|
||||
elif _between(DOWN_RIGHT, angle, DOWN_LEFT):
|
||||
elif Utils.is_between(DOWN_RIGHT, angle, DOWN_LEFT):
|
||||
anime = "down"
|
||||
else:
|
||||
anime = "left"
|
||||
|
||||
play(anime)
|
||||
return animation
|
||||
|
||||
|
||||
func _between(m, val, x) -> bool:
|
||||
return (m < val) && (val <= x)
|
||||
|
|
|
@ -2,8 +2,8 @@ extends Node
|
|||
class_name RandomRotationOnReady
|
||||
|
||||
|
||||
onready var parent: Node2D = get_parent()
|
||||
onready var rng: RandomNumberGenerator = get_tree().root.get_node("Game/RNG").rng
|
||||
onready var parent = get_parent()
|
||||
onready var rng = get_tree().root.get_node("Game/RNG").rng
|
||||
|
||||
|
||||
func _ready():
|
||||
|
|
|
@ -2,34 +2,35 @@ extends Node
|
|||
class_name AttractedToMovement
|
||||
|
||||
|
||||
signal moving_in_direction(direction)
|
||||
signal touching_goal(who)
|
||||
signal goal_reached(who)
|
||||
signal moved_in_direction(origin, direction)
|
||||
signal goal_reached(origin, who)
|
||||
signal collided(origin, collision)
|
||||
|
||||
|
||||
export var movement_per_second: float
|
||||
export(float) var movement_per_second
|
||||
|
||||
|
||||
onready var parent: KinematicBody2D = get_parent()
|
||||
onready var parent = get_parent()
|
||||
|
||||
|
||||
var goal: Node2D = null
|
||||
var _goal_reached_triggered: bool = false
|
||||
var goal
|
||||
|
||||
|
||||
func move():
|
||||
var direction: Vector2 = (goal.global_position - parent.global_position).normalized()
|
||||
emit_signal("moving_in_direction", direction)
|
||||
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
||||
func _move():
|
||||
var direction = (goal.global_position - parent.global_position).normalized()
|
||||
var _motion = parent.move_and_slide(direction * movement_per_second)
|
||||
_handle_collisions()
|
||||
emit_signal("moved_in_direction", self, direction)
|
||||
|
||||
|
||||
func _handle_collisions():
|
||||
for slide_no in parent.get_slide_count():
|
||||
var slide = parent.get_slide_collision(slide_no)
|
||||
if slide.collider == goal:
|
||||
emit_signal("touching_goal", self)
|
||||
if not _goal_reached_triggered:
|
||||
emit_signal("goal_reached", self)
|
||||
_goal_reached_triggered = true
|
||||
var collision = parent.get_slide_collision(slide_no)
|
||||
emit_signal("collided", self, collision)
|
||||
if collision.collider == goal:
|
||||
emit_signal("goal_reached", self)
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
if goal:
|
||||
move()
|
||||
_move()
|
||||
|
|
|
@ -2,17 +2,19 @@ extends Node
|
|||
class_name BulletMovement
|
||||
|
||||
|
||||
signal hit(collision)
|
||||
signal moved_in_direction(origin, direction)
|
||||
signal collided(origin, collision)
|
||||
|
||||
|
||||
export var movement_per_second: float
|
||||
|
||||
|
||||
onready var target: KinematicBody2D = get_parent()
|
||||
onready var parent = 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)
|
||||
var direction = Vector2(cos(parent.rotation), sin(parent.rotation))
|
||||
var collision = parent.move_and_collide(direction * movement_per_second * delta)
|
||||
if collision != null:
|
||||
emit_signal("hit", collision)
|
||||
emit_signal("collided", self, collision)
|
||||
emit_signal("moved_in_direction", self, direction)
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
extends Node
|
||||
class_name ErraticMovement
|
||||
|
||||
|
||||
export var movement_per_second: float
|
||||
|
||||
|
||||
onready var target: KinematicBody2D = get_parent()
|
||||
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)
|
|
@ -1,7 +0,0 @@
|
|||
[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
|
|
@ -2,7 +2,8 @@ extends Node
|
|||
class_name PlayerMovement
|
||||
|
||||
|
||||
signal moving_in_direction(direction)
|
||||
signal moved_in_direction(origin, direction)
|
||||
signal collided(origin, collision)
|
||||
|
||||
|
||||
export var movement_per_second: float
|
||||
|
@ -11,7 +12,7 @@ export var movement_per_second: float
|
|||
onready var parent: KinematicBody2D = get_parent()
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
func _read_direction():
|
||||
var direction = Vector2.ZERO
|
||||
direction += Input.get_action_strength("player_move_up") * Vector2.UP
|
||||
direction += Input.get_action_strength("player_move_down") * Vector2.DOWN
|
||||
|
@ -21,6 +22,21 @@ func _physics_process(_delta):
|
|||
# Basically, "cap" movement at 1
|
||||
if direction.length() > 1:
|
||||
direction.normalized()
|
||||
return direction
|
||||
|
||||
emit_signal("moving_in_direction", direction)
|
||||
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
||||
|
||||
func _move():
|
||||
var direction = _read_direction()
|
||||
var _motion = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
||||
_handle_collisions()
|
||||
emit_signal("moved_in_direction", self, direction.normalized())
|
||||
|
||||
|
||||
func _handle_collisions():
|
||||
for slide_no in parent.get_slide_count():
|
||||
var collision = parent.get_slide_collision(slide_no)
|
||||
emit_signal("collided", self, collision)
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
_move()
|
||||
|
|
|
@ -2,10 +2,10 @@ extends Node
|
|||
class_name TeleportToScreenEdge
|
||||
|
||||
|
||||
signal teleported(to)
|
||||
signal teleported(origin)
|
||||
|
||||
|
||||
export var bounds: Vector2
|
||||
export(Vector2) var bounds
|
||||
|
||||
|
||||
onready var parent = get_parent()
|
||||
|
@ -19,9 +19,8 @@ func teleport():
|
|||
)
|
||||
|
||||
parent.set_position(new_position)
|
||||
emit_signal("teleported", parent.position)
|
||||
emit_signal("teleported", self)
|
||||
|
||||
|
||||
func _handle_spawned(_node):
|
||||
teleport()
|
||||
|
|
@ -2,10 +2,10 @@ extends Node
|
|||
class_name TeleportToRandomPosition
|
||||
|
||||
|
||||
signal teleported(to)
|
||||
signal teleported(origin)
|
||||
|
||||
|
||||
export var bounds: Vector2
|
||||
export(Vector2) var bounds
|
||||
|
||||
|
||||
onready var parent = get_parent()
|
||||
|
@ -30,8 +30,8 @@ func teleport():
|
|||
new_position = Vector2(rng.randf_range(0, bounds.x), bounds.y)
|
||||
|
||||
parent.set_position(new_position)
|
||||
emit_signal("teleported", parent.position)
|
||||
emit_signal("teleported", self)
|
||||
|
||||
|
||||
func _handle_spawned(_node):
|
||||
func _on_SpawnEveryPeriod_spawned(_origin, _node):
|
||||
teleport()
|
||||
|
|
|
@ -4,12 +4,12 @@ class_name DropLoot
|
|||
|
||||
export(Array, PackedScene) var loot_types
|
||||
export(Array, float) var loot_weights
|
||||
export(String) var container_name
|
||||
|
||||
|
||||
# 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
|
||||
onready var source = get_parent()
|
||||
onready var container = get_tree().root.find_node(container_name, true, false)
|
||||
onready var rng = get_tree().root.get_node("Game/RNG").rng
|
||||
|
||||
|
||||
func _ready():
|
||||
|
@ -17,8 +17,8 @@ func _ready():
|
|||
push_error("The amount of loot types and loot weights is different!")
|
||||
|
||||
|
||||
func select_drop() -> PackedScene:
|
||||
var total_weights: float = 0.0
|
||||
func select_drop():
|
||||
var total_weights = 0.0
|
||||
for weight in loot_weights:
|
||||
total_weights += weight
|
||||
|
||||
|
@ -35,13 +35,13 @@ func select_drop() -> PackedScene:
|
|||
return null
|
||||
|
||||
|
||||
func create_drop() -> Node:
|
||||
func create_drop():
|
||||
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)
|
||||
node.set_position(source.global_position)
|
||||
return node
|
||||
|
|
|
@ -2,13 +2,13 @@ extends VisibilityNotifier2D
|
|||
class_name FreeWhenShapeIsOffScreen
|
||||
|
||||
|
||||
onready var shape: Node = get_parent()
|
||||
onready var target: Node = shape.get_parent()
|
||||
onready var parent = get_parent()
|
||||
onready var target = parent.get_parent()
|
||||
|
||||
|
||||
func _ready():
|
||||
# This is gonna break.
|
||||
var ext = shape.shape.extents
|
||||
var ext = parent.shape.extents
|
||||
rect = Rect2(-ext.x, -ext.y, ext.x * 2, ext.y * 2)
|
||||
|
||||
|
||||
|
|
14
src/behaviours/spawning/ShootOnClick.gd
Normal file
14
src/behaviours/spawning/ShootOnClick.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends Node
|
||||
class_name ShootOnClick
|
||||
|
||||
|
||||
export(int) var rapid_fire_instances
|
||||
|
||||
|
||||
onready var parent = get_parent()
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if Input.is_action_pressed("player_shoot") if rapid_fire_instances > 0 else Input.is_action_just_pressed("player_shoot"):
|
||||
var target = parent.parent.get_global_mouse_position()
|
||||
parent.shoot(parent.parent.get_angle_to(target))
|
6
src/behaviours/spawning/ShootOnClick.tscn
Normal file
6
src/behaviours/spawning/ShootOnClick.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/spawning/ShootOnClick.gd" type="Script" id=1]
|
||||
|
||||
[node name="ShootOnClick" type="Node"]
|
||||
script = ExtResource( 1 )
|
9
src/behaviours/spawning/ShootWhenPossible.gd
Normal file
9
src/behaviours/spawning/ShootWhenPossible.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Node
|
||||
class_name ShootWhenPossible
|
||||
|
||||
|
||||
onready var parent = get_parent()
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
parent.shoot(parent.rotation)
|
6
src/behaviours/spawning/ShootWhenPossible.tscn
Normal file
6
src/behaviours/spawning/ShootWhenPossible.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/spawning/ShootWhenPossible.gd" type="Script" id=1]
|
||||
|
||||
[node name="ShootWhenPossible" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,36 +1,22 @@
|
|||
extends Node2D
|
||||
extends Node
|
||||
class_name SpawnEveryPeriod
|
||||
|
||||
|
||||
signal spawned(node)
|
||||
signal spawned(origin, node)
|
||||
|
||||
|
||||
export var spawning: PackedScene
|
||||
export var bounds: Vector2 setget set_bounds, get_bounds
|
||||
export var period_secs: float setget set_period, get_period
|
||||
export(PackedScene) var spawning
|
||||
export(String) var container_name
|
||||
|
||||
|
||||
onready var container = get_parent()
|
||||
onready var parent = get_parent()
|
||||
onready var container = get_tree().root.find_node(container_name, true, false)
|
||||
|
||||
|
||||
func spawn():
|
||||
if spawning == null:
|
||||
return
|
||||
var node: Node2D = spawning.instance()
|
||||
var node = 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
|
||||
node.set_position(parent.global_position)
|
||||
emit_signal("spawned", self, node)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource path="res://src/behaviours/spawning/SpawnEveryPeriod.gd" type="Script" id=1]
|
||||
|
||||
[node name="SpawnEveryPeriod" type="Node2D"]
|
||||
[node name="SpawnEveryPeriod" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Period" type="Timer" parent="."]
|
||||
|
|
|
@ -1,43 +1,28 @@
|
|||
extends Node2D
|
||||
extends Node
|
||||
class_name SpawnOnShoot
|
||||
|
||||
|
||||
signal shot(bullet)
|
||||
signal shot(origin, bullet)
|
||||
|
||||
|
||||
export var bullet: PackedScene
|
||||
export var cooldown: float setget set_cooldown, get_cooldown
|
||||
export var rapid_fire: bool
|
||||
export var angle_offset: float
|
||||
export(PackedScene) var spawning
|
||||
export(float) var angle_offset
|
||||
export(String) var container_name
|
||||
|
||||
|
||||
onready var parent: Node2D = get_parent()
|
||||
onready var container: Node = get_tree().root.find_node("Bullets", true, false)
|
||||
onready var parent = get_parent()
|
||||
onready var container = get_tree().root.find_node(container_name, true, false)
|
||||
|
||||
|
||||
func set_cooldown(value):
|
||||
$Cooldown.wait_time = value
|
||||
|
||||
func get_cooldown() -> float:
|
||||
return $Cooldown.wait_time
|
||||
|
||||
|
||||
func shoot(target):
|
||||
var node = bullet.instance()
|
||||
func shoot(angle):
|
||||
if not $Cooldown.is_stopped():
|
||||
return
|
||||
var node = spawning.instance()
|
||||
container.add_child(node)
|
||||
node.set_position(global_position)
|
||||
node.set_rotation(node.get_angle_to(target) + angle_offset)
|
||||
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)
|
||||
emit_signal("shot")
|
||||
$Sound.play()
|
||||
$Cooldown.start()
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
var not_on_cooldown: bool = $Cooldown.is_stopped()
|
||||
var trying_to_shoot: bool = Input.is_action_pressed("player_shoot") if rapid_fire else Input.is_action_just_pressed("player_shoot")
|
||||
|
||||
if not_on_cooldown and trying_to_shoot:
|
||||
var target = get_global_mouse_position()
|
||||
shoot(target)
|
||||
emit_signal("shot", self, node)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource path="res://src/behaviours/spawning/SpawnOnShoot.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/sounds/Arrow.mp3" type="AudioStream" id=2]
|
||||
|
||||
[node name="SpawnOnShoot" type="Node2D"]
|
||||
[node name="SpawnOnShoot" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Cooldown" type="Timer" parent="."]
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
extends Node
|
||||
|
||||
|
||||
signal goal_reached(who)
|
||||
|
||||
|
||||
func set_consequences(node):
|
||||
var movement = node.get_node("AttractedToMovement")
|
||||
movement.connect("goal_reached", self, "_on_goal_reached")
|
||||
|
||||
|
||||
func _on_goal_reached(who):
|
||||
emit_signal("goal_reached", who)
|
|
@ -1,6 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/targeting/SetGoalReachedConsequences.gd" type="Script" id=1]
|
||||
|
||||
[node name="SetGoalReachedConsequences" type="Node"]
|
||||
script = ExtResource( 1 )
|
21
src/behaviours/targeting/SetSpawnedATMGoalTo.gd
Normal file
21
src/behaviours/targeting/SetSpawnedATMGoalTo.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends Node
|
||||
class_name SetSpawnedATMGoalTo
|
||||
|
||||
|
||||
signal set_goal(origin, target)
|
||||
|
||||
|
||||
export(NodePath) var goal_path
|
||||
|
||||
|
||||
onready var goal = get_node(goal_path)
|
||||
|
||||
|
||||
func set_goal(node):
|
||||
var movement = node.get_node("AttractedToMovement")
|
||||
movement.goal = goal
|
||||
emit_signal("set_goal", self, movement)
|
||||
|
||||
|
||||
func _on_SpawnEveryPeriod_spawned(_origin, node):
|
||||
set_goal(node)
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/targeting/SetSpawnedGoalTo.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/targeting/SetSpawnedATMGoalTo.gd" type="Script" id=1]
|
||||
|
||||
[node name="SetSpawnedGoalTo" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,11 +0,0 @@
|
|||
extends Node
|
||||
class_name SetSpawnedGoalTo
|
||||
|
||||
|
||||
export var goal_path: NodePath
|
||||
onready var goal = get_node(goal_path)
|
||||
|
||||
|
||||
func set_goal(node):
|
||||
var movement = node.get_node("AttractedToMovement")
|
||||
movement.goal = goal
|
|
@ -13,5 +13,4 @@ collision_mask = 2
|
|||
[node name="Ownership" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Damaging" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[connection signal="hit" from="BulletMovement" to="Damaging" method="do_damage_to_collider"]
|
||||
destroy_after_damage = true
|
||||
|
|
23
src/entities/bullets/Arrow.gd
Normal file
23
src/entities/bullets/Arrow.gd
Normal file
|
@ -0,0 +1,23 @@
|
|||
extends KinematicBody2D
|
||||
class_name Arrow
|
||||
|
||||
|
||||
export(Texture) var dim_texture
|
||||
export(int) var dim_damage
|
||||
|
||||
export(Texture) var lit_texture
|
||||
export(int) var lit_damage
|
||||
|
||||
|
||||
func _on_Flammable_caught_fire(_origin):
|
||||
$Shape/Sprite.texture = lit_texture
|
||||
$Damaging.damage = lit_damage
|
||||
$Damaging.destroy_after_damage = false
|
||||
$Light.visible = true
|
||||
|
||||
|
||||
func _on_Flammable_extinguished_fire(_origin):
|
||||
$Shape/Sprite.texture = dim_texture
|
||||
$Damaging.damage = dim_damage
|
||||
$Damaging.destroy_after_damage = true
|
||||
$Light.visible = false
|
BIN
src/entities/bullets/Arrow.png
(Stored with Git LFS)
BIN
src/entities/bullets/Arrow.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,13 +1,22 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=9 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]
|
||||
[ext_resource path="res://src/behaviours/spawning/FreeWhenShapeIsOffScreen.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/entities/bullets/Arrow.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/behaviours/damage/Flammable.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/behaviours/spawning/FreeWhenShapeIsOffScreen.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://src/entities/bullets/ArrowFire.png" type="Texture" id=7]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 6 )
|
||||
extents = Vector2( 6, 1.5 )
|
||||
|
||||
[node name="Arrow" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 3 )
|
||||
dim_texture = ExtResource( 2 )
|
||||
dim_damage = 1
|
||||
lit_texture = ExtResource( 7 )
|
||||
lit_damage = 5
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
@ -15,7 +24,19 @@ shape = SubResource( 1 )
|
|||
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="FreeWhenShapeIsOffScreen" parent="Shape" index="1" instance=ExtResource( 3 )]
|
||||
[node name="FreeWhenShapeIsOffScreen" parent="Shape" index="1" instance=ExtResource( 6 )]
|
||||
|
||||
[node name="BulletMovement" parent="." index="1"]
|
||||
movement_per_second = 400.0
|
||||
|
||||
[node name="Light" type="Light2D" parent="." index="4"]
|
||||
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 )]
|
||||
|
||||
[connection signal="caught_fire" from="Flammable" to="." method="_on_Flammable_caught_fire"]
|
||||
[connection signal="extinguished_fire" from="Flammable" to="." method="_on_Flammable_extinguished_fire"]
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
extends KinematicBody2D
|
||||
class_name ArrowAlternative
|
||||
|
||||
|
||||
export var dim_texture: Texture = preload("res://src/entities/bullets/ArrowAlternative.png")
|
||||
export var dim_damage: int = 1
|
||||
|
||||
export var lit_texture: Texture = preload("res://src/entities/bullets/ArrowAlternativeOnFire.png")
|
||||
export var lit_damage: int = 5
|
||||
|
||||
|
||||
func _on_Flammable_caught_fire():
|
||||
$Shape/Sprite.texture = lit_texture
|
||||
$Damaging.damage = lit_damage
|
||||
$Damaging.destroy_on_damage = false
|
||||
$Light.visible = true
|
||||
|
||||
|
||||
func _on_Flammable_extinguished_fire():
|
||||
$Shape/Sprite.texture = dim_texture
|
||||
$Damaging.damage = dim_damage
|
||||
$Damaging.destroy_on_damage = true
|
||||
$Light.visible = false
|
BIN
src/entities/bullets/ArrowAlternative.png
(Stored with Git LFS)
BIN
src/entities/bullets/ArrowAlternative.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ArrowAlternative.png-83943b77de3726256aea2b460f0a30e4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/bullets/ArrowAlternative.png"
|
||||
dest_files=[ "res://.import/ArrowAlternative.png-83943b77de3726256aea2b460f0a30e4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
|
@ -1,37 +0,0 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/bullets/AbstractBullet.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/entities/bullets/ArrowAlternative.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/entities/bullets/ArrowAlternative.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/behaviours/damage/Flammable.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/behaviours/spawning/FreeWhenShapeIsOffScreen.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 6, 1.5 )
|
||||
|
||||
[node name="ArrowAlternative" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[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="FreeWhenShapeIsOffScreen" parent="Shape" index="1" instance=ExtResource( 6 )]
|
||||
|
||||
[node name="BulletMovement" parent="." index="1"]
|
||||
movement_per_second = 400.0
|
||||
|
||||
[node name="Light" type="Light2D" parent="." index="4"]
|
||||
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 )]
|
||||
|
||||
[connection signal="caught_fire" from="Flammable" to="." method="_on_Flammable_caught_fire"]
|
||||
[connection signal="extinguished_fire" from="Flammable" to="." method="_on_Flammable_extinguished_fire"]
|
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ArrowAlternativeOnFire.png-8a0ce235161d77b846223626ffd5e8d6.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/bullets/ArrowAlternativeOnFire.png"
|
||||
dest_files=[ "res://.import/ArrowAlternativeOnFire.png-8a0ce235161d77b846223626ffd5e8d6.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/EnemySpider.png-c95784f88ad7e56ff4e9578701ea7904.stex"
|
||||
path="res://.import/ArrowFire.png-3ca6cc210fd6ec182e20326648c8302d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/mechanics/EnemySpider.png"
|
||||
dest_files=[ "res://.import/EnemySpider.png-c95784f88ad7e56ff4e9578701ea7904.stex" ]
|
||||
source_file="res://src/entities/bullets/ArrowFire.png"
|
||||
dest_files=[ "res://.import/ArrowFire.png-3ca6cc210fd6ec182e20326648c8302d.stex" ]
|
||||
|
||||
[params]
|
||||
|
BIN
src/entities/bullets/PiercingArrow.png
(Stored with Git LFS)
Normal file
BIN
src/entities/bullets/PiercingArrow.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0000.png-c3c7633cb72ff2aa54d8a1d627a73199.stex"
|
||||
path="res://.import/PiercingArrow.png-cc699c14f201167c707e32420ad72b4a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0000.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0000.png-c3c7633cb72ff2aa54d8a1d627a73199.stex" ]
|
||||
source_file="res://src/entities/bullets/PiercingArrow.png"
|
||||
dest_files=[ "res://.import/PiercingArrow.png-cc699c14f201167c707e32420ad72b4a.stex" ]
|
||||
|
||||
[params]
|
||||
|
24
src/entities/bullets/PiercingArrow.tscn
Normal file
24
src/entities/bullets/PiercingArrow.tscn
Normal file
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/spawning/FreeWhenShapeIsOffScreen.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/entities/bullets/PiercingArrow.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/entities/bullets/AbstractBullet.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 6 )
|
||||
|
||||
[node name="Arrow" 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( 2 )
|
||||
|
||||
[node name="FreeWhenShapeIsOffScreen" parent="Shape" index="1" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="BulletMovement" parent="." index="1"]
|
||||
movement_per_second = 200.0
|
||||
|
||||
[node name="Damaging" parent="." index="3"]
|
||||
destroy_after_damage = false
|
|
@ -9,5 +9,4 @@
|
|||
alliance = -1
|
||||
|
||||
[node name="DropLoot" parent="." index="2" instance=ExtResource( 1 )]
|
||||
|
||||
[connection signal="dead" from="Damageable" to="DropLoot" method="create_drop"]
|
||||
container_name = "Pickups"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=12 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,7 +9,6 @@
|
|||
[ext_resource path="res://src/entities/enemies/EnemySnowmanFront.png" type="Texture" id=7]
|
||||
[ext_resource path="res://src/entities/enemies/EnemySnowmanRight.png" type="Texture" id=8]
|
||||
[ext_resource path="res://src/behaviours/graphics/FourSidedSprite.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://src/sounds/Death.mp3" type="AudioStream" id=10]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 9.0
|
||||
|
@ -52,10 +51,3 @@ loot_types = [ null, ExtResource( 2 ), ExtResource( 5 ) ]
|
|||
loot_weights = [ 1.0, 1.0, 0.1 ]
|
||||
|
||||
[node name="AttractedToMovement" parent="." index="4" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="MeltSound" parent="." index="5"]
|
||||
stream = ExtResource( 10 )
|
||||
|
||||
[connection signal="dead" from="Damageable" to="DropLoot" method="create_drop"]
|
||||
[connection signal="dead" from="Damageable" to="MeltSound" method="_on_Damageable_dead"]
|
||||
[connection signal="moving_in_direction" from="AttractedToMovement" to="Shape/FourSidedSprite" method="turn"]
|
||||
|
|
35
src/entities/enemies/EnemySpider.png.import
Normal file
35
src/entities/enemies/EnemySpider.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/EnemySpider.png-cb28a041f7bd929ab2ebedaf573389ea.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/enemies/EnemySpider.png"
|
||||
dest_files=[ "res://.import/EnemySpider.png-cb28a041f7bd929ab2ebedaf573389ea.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/EnemySpiderSanta.png-eac0456ac0f4bbe49e411b81e6d559f8.stex"
|
||||
path="res://.import/EnemySpiderSanta.png-cba6da66b147fcf646d5ce8562f321c5.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/mechanics/EnemySpiderSanta.png"
|
||||
dest_files=[ "res://.import/EnemySpiderSanta.png-eac0456ac0f4bbe49e411b81e6d559f8.stex" ]
|
||||
source_file="res://src/entities/enemies/EnemySpiderSanta.png"
|
||||
dest_files=[ "res://.import/EnemySpiderSanta.png-cba6da66b147fcf646d5ce8562f321c5.stex" ]
|
||||
|
||||
[params]
|
||||
|
15
src/entities/enemies/PathEnemy.tscn
Normal file
15
src/entities/enemies/PathEnemy.tscn
Normal file
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/enemies/EnemySpider.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/enemies/AbstractEnemy.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 33.0
|
||||
|
||||
[node name="PathEnemy" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
|
||||
texture = ExtResource( 1 )
|
BIN
src/entities/fire/Fire-v2-f0000.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0000.png
(Stored with Git LFS)
Binary file not shown.
BIN
src/entities/fire/Fire-v2-f0002.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0002.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0002.png-6918086f60d08af1502a25fbd0160af4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0002.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0002.png-6918086f60d08af1502a25fbd0160af4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
BIN
src/entities/fire/Fire-v2-f0004.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0004.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0004.png-869043dd473b06e573b8de42a9b37843.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0004.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0004.png-869043dd473b06e573b8de42a9b37843.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
BIN
src/entities/fire/Fire-v2-f0006.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0006.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0006.png-8f88a006c846bf327208a83f85304e65.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0006.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0006.png-8f88a006c846bf327208a83f85304e65.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
BIN
src/entities/fire/Fire-v2-f0008.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0008.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0008.png-ff0a69063533f0f2b8e26bd0a7c17473.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0008.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0008.png-ff0a69063533f0f2b8e26bd0a7c17473.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
BIN
src/entities/fire/Fire-v2-f0010.png
(Stored with Git LFS)
BIN
src/entities/fire/Fire-v2-f0010.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Fire-v2-f0010.png-8835d325650eb9a3d686496d562eb34c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/entities/fire/Fire-v2-f0010.png"
|
||||
dest_files=[ "res://.import/Fire-v2-f0010.png-8835d325650eb9a3d686496d562eb34c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
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
|
||||
svg/scale=1.0
|
|
@ -1,57 +1,14 @@
|
|||
extends Node2D
|
||||
class_name Fire
|
||||
|
||||
|
||||
export var intensity: float = 1.0 setget set_intensity
|
||||
export var change_per_second: float = - 1.0 / 60.0
|
||||
export var min_intensity: float = 0
|
||||
export var max_intensity: float = INF
|
||||
export var enemy_touch_penalty = 0.1
|
||||
|
||||
|
||||
signal intensity_changed(value)
|
||||
signal intensity_at_max
|
||||
signal intensity_at_min
|
||||
var intensity_reached_max_triggered: bool = false
|
||||
var intensity_reached_min_triggered: bool = false
|
||||
signal intensity_reached_min
|
||||
signal intensity_reached_max
|
||||
|
||||
|
||||
func set_intensity(value):
|
||||
intensity = clamp(value, min_intensity, max_intensity)
|
||||
# Update everything that needs to be updated when the intensity changes
|
||||
$Flame.scale = Vector2(value, value)
|
||||
# Trigger signals
|
||||
emit_signal("intensity_changed", intensity)
|
||||
# max intensity signal
|
||||
if intensity == max_intensity:
|
||||
emit_signal("intensity_at_max")
|
||||
if not intensity_reached_max_triggered:
|
||||
emit_signal("intensity_reached_max")
|
||||
intensity_reached_max_triggered = true
|
||||
else:
|
||||
intensity_reached_max_triggered = false
|
||||
# min intensity signal
|
||||
if intensity == min_intensity:
|
||||
emit_signal("intensity_at_min")
|
||||
if not intensity_reached_min_triggered:
|
||||
emit_signal("intensity_reached_min")
|
||||
intensity_reached_min_triggered = true
|
||||
else:
|
||||
intensity_reached_min_triggered = false
|
||||
|
||||
|
||||
func _process(delta):
|
||||
set_intensity(intensity + (delta * change_per_second))
|
||||
|
||||
|
||||
func _on_Flame_body_entered(body: PhysicsBody2D):
|
||||
func _on_Flame_body_entered(body):
|
||||
var flammable = body.get_node("Flammable")
|
||||
if flammable != null:
|
||||
flammable.catch_fire()
|
||||
|
||||
|
||||
func _on_Enemy_goal_reached(who):
|
||||
intensity -= enemy_touch_penalty
|
||||
# Melt
|
||||
who.queue_free()
|
||||
func _on_Damageable_health_changed(origin, value):
|
||||
var scale = smoothstep(origin.min_health, origin.max_health, value) * 2
|
||||
$Flame.scale = Vector2(scale, scale)
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
[gd_scene load_steps=20 format=2]
|
||||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/fire/FirePit.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/entities/fire/Fire.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0006.png" type="Texture" id=4]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0006.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0008.png" type="Texture" id=6]
|
||||
[ext_resource path="res://src/behaviours/damage/Damageable.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://src/behaviours/damage/DamageEveryTick.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0000.png" type="Texture" id=7]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0002.png" type="Texture" id=8]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0002.png" type="Texture" id=9]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0000.png" type="Texture" id=10]
|
||||
[ext_resource path="res://src/behaviours/damage/Damaging.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0004.png" type="Texture" id=11]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0010.png" type="Texture" id=12]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0004.png" type="Texture" id=13]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v2-f0010.png" type="Texture" id=14]
|
||||
[ext_resource path="res://src/entities/fire/Fire-v1-f0008.png" type="Texture" id=15]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
|
@ -28,15 +25,10 @@ blend_mode = 1
|
|||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 10 ), ExtResource( 9 ), ExtResource( 13 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 14 ) ],
|
||||
"loop": true,
|
||||
"name": "v2",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 7 ), ExtResource( 8 ), ExtResource( 11 ), ExtResource( 4 ), ExtResource( 15 ), ExtResource( 12 ) ],
|
||||
"loop": true,
|
||||
"name": "v1",
|
||||
"speed": 5.0
|
||||
"speed": 8.0
|
||||
} ]
|
||||
|
||||
[node name="Fire" type="Node2D"]
|
||||
|
@ -53,6 +45,7 @@ rotation = -1.5708
|
|||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Flame" type="Area2D" parent="."]
|
||||
position = Vector2( 1, 0 )
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
|
||||
|
@ -67,10 +60,21 @@ shape = SubResource( 3 )
|
|||
|
||||
[node name="FlameSprite" type="AnimatedSprite" parent="Flame/Shape"]
|
||||
material = SubResource( 2 )
|
||||
position = Vector2( 0, -12 )
|
||||
z_index = 1
|
||||
frames = SubResource( 4 )
|
||||
animation = "v1"
|
||||
frame = 4
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Damageable" parent="." instance=ExtResource( 5 )]
|
||||
max_health = 200.0
|
||||
health = 100.0
|
||||
|
||||
[node name="Damaging" parent="." instance=ExtResource( 9 )]
|
||||
friendly_fire = true
|
||||
|
||||
[node name="DamageEveryTick" parent="Damaging" instance=ExtResource( 6 )]
|
||||
|
||||
[connection signal="body_entered" from="Flame" to="." method="_on_Flame_body_entered"]
|
||||
[connection signal="health_changed" from="Damageable" to="." method="_on_Damageable_health_changed"]
|
||||
|
|
|
@ -5,4 +5,7 @@
|
|||
|
||||
[node name="AbstractPlayer" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Alliance" parent="." index="0"]
|
||||
alliance = 1
|
||||
|
||||
[node name="PlayerMovement" parent="." index="2" instance=ExtResource( 2 )]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/players/AbstractPlayer.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/entities/bullets/ArrowAlternative.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/behaviours/spawning/ShootOnClick.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/entities/bullets/Arrow.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/behaviours/spawning/SpawnOnShoot.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/entities/players/CharacterFrontLeft.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/entities/players/CharacterFront.png" type="Texture" id=6]
|
||||
|
@ -48,8 +49,8 @@ script = ExtResource( 7 )
|
|||
[node name="Listener" type="Listener2D" parent="." index="1"]
|
||||
current = true
|
||||
|
||||
[node name="SpawnOnShoot" parent="." index="2" instance=ExtResource( 4 )]
|
||||
bullet = ExtResource( 3 )
|
||||
cooldown = 0.2
|
||||
[node name="SpawnOnShoot" parent="." index="5" instance=ExtResource( 4 )]
|
||||
spawning = ExtResource( 3 )
|
||||
container_name = "Bullets"
|
||||
|
||||
[connection signal="moving_in_direction" from="PlayerMovement" to="Shape/FourSidedSprite" method="turn"]
|
||||
[node name="ShootOnClick" parent="SpawnOnShoot" index="2" instance=ExtResource( 2 )]
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
var survival_seconds: float setget set_survival_seconds
|
||||
signal survival_seconds_updated(value)
|
||||
export(PackedScene) var main_menu = preload("res://src/levels/mainmenu/MainMenu.tscn")
|
||||
export(PackedScene) var phase_one = preload("res://src/levels/phaseone/PhaseOne.tscn")
|
||||
export(PackedScene) var user_interface = preload("res://src/levels/ui/UserInterface.tscn")
|
||||
|
||||
|
||||
func set_survival_seconds(value):
|
||||
survival_seconds = value
|
||||
emit_signal("survival_seconds_updated", value)
|
||||
func _ready():
|
||||
print("Starting from the menu!")
|
||||
add_child(main_menu.instance())
|
||||
# warning-ignore: RETURN_VALUE_DISCARDED
|
||||
$MainMenu/TheDarkNightUI/Play.connect("pressed", self, "_on_MainMenu_Play_pressed")
|
||||
|
||||
|
||||
func _process(delta):
|
||||
set_survival_seconds(survival_seconds + delta)
|
||||
|
||||
|
||||
func _on_Fire_intensity_reached_min():
|
||||
print("Game over!")
|
||||
func _on_MainMenu_Play_pressed():
|
||||
print("Moving to the first phase...")
|
||||
$MainMenu.queue_free()
|
||||
add_child(phase_one.instance())
|
||||
add_child(user_interface.instance())
|
||||
# warning-ignore: RETURN_VALUE_DISCARDED
|
||||
$PhaseOne.connect("survival_seconds_updated", $UserInterface/TheDarkNightUI/TimeSurvived,"_on_PhaseOne_survival_seconds_updated")
|
||||
# warning-ignore: RETURN_VALUE_DISCARDED
|
||||
$UserInterface/TheDarkNightUI/MuteButton.connect("toggled", $Music, "_on_MuteButton_toggled")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
if child.name == "Play":
|
||||
get_node(child.name).connect("pressed", self, "change_scn")
|
||||
|
||||
func change_scn():
|
||||
get_tree().change_scene("res://src/levels/Game.tscn")
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://src/levels/MainMenu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/ui/Title.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/ui/PlayButton.png" type="Texture" id=3]
|
||||
[ext_resource path="res://src/ui/fonts/SourceSerifPro-Light.ttf" type="DynamicFontData" id=4]
|
||||
[ext_resource path="res://src/entities/fire/Fire.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 70
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[node name="MainMenu" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 720.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Panel"]
|
||||
position = Vector2( 640.881, 360.696 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Fire" parent="Panel" instance=ExtResource( 5 )]
|
||||
position = Vector2( 421, 365 )
|
||||
scale = Vector2( 4, 4 )
|
||||
|
||||
[node name="Play" type="Button" parent="."]
|
||||
margin_left = 944.0
|
||||
margin_top = 489.0
|
||||
margin_right = 1210.0
|
||||
margin_bottom = 615.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Play"
|
||||
icon = ExtResource( 3 )
|
||||
flat = true
|
|
@ -1,4 +1,5 @@
|
|||
extends Node
|
||||
class_name Music
|
||||
|
||||
|
||||
export var choir_min: float = 0.05
|
||||
|
@ -10,15 +11,8 @@ export var drum_max: float = 0.80
|
|||
export var muted: bool setget set_mute, get_mute
|
||||
|
||||
|
||||
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"
|
||||
|
||||
$Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60
|
||||
$Bell.bus = "Master" if $Bell.volume_db > -60 else "Mute"
|
||||
|
||||
$Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60
|
||||
$Drum.bus = "Master" if $Drum.volume_db > -60 else "Mute"
|
||||
func _ready():
|
||||
update_state()
|
||||
|
||||
|
||||
func set_mute(value):
|
||||
|
@ -30,5 +24,21 @@ func get_mute():
|
|||
return AudioServer.is_bus_mute(index)
|
||||
|
||||
|
||||
func _on_MuteButton_pressed():
|
||||
set_mute(not get_mute())
|
||||
func update_state():
|
||||
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"
|
||||
$Bell.bus = "Master" if $Bell.volume_db > -60 else "Mute"
|
||||
$Drum.bus = "Master" if $Drum.volume_db > -60 else "Mute"
|
||||
$BossDrum.bus = "Master" if $BossDrum.volume_db > -60 else "Mute"
|
||||
$BossGuitar.bus = "Master" if $BossGuitar.volume_db > -60 else "Mute"
|
||||
|
||||
|
||||
|
||||
func _on_Fire_intensity_changed(value):
|
||||
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
|
||||
$Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60
|
||||
$Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60
|
||||
update_state()
|
||||
|
||||
|
||||
func _on_MuteButton_toggled(button_pressed):
|
||||
set_mute(button_pressed)
|
11
src/levels/mainmenu/MainMenu.gd
Normal file
11
src/levels/mainmenu/MainMenu.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
func change_scn():
|
||||
var result = get_tree().change_scene("res://src/levels/Game.tscn")
|
||||
if result != OK:
|
||||
push_error("Could not change scene: %d" % [result])
|
||||
|
||||
|
||||
func _on_Play_pressed():
|
||||
change_scn()
|
60
src/levels/mainmenu/MainMenu.tscn
Normal file
60
src/levels/mainmenu/MainMenu.tscn
Normal file
|
@ -0,0 +1,60 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://src/ui/fonts/SourceSerifPro-Light.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://src/levels/ui/ui/Title.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/levels/ui/PlayButton.png" type="Texture" id=3]
|
||||
[ext_resource path="res://src/entities/fire/Fire.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/levels/ui/fonts/SourceSerifPro-Regular.ttf" type="DynamicFontData" id=5]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 22
|
||||
font_data = ExtResource( 5 )
|
||||
|
||||
[sub_resource type="Theme" id=2]
|
||||
default_font = SubResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
size = 70
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="MainMenu" type="CanvasLayer"]
|
||||
|
||||
[node name="TheDarkNightUI" type="Control" parent="."]
|
||||
light_mask = 2
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -640.0
|
||||
margin_top = -80.0
|
||||
margin_right = 640.0
|
||||
theme = SubResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="TheDarkNightUI"]
|
||||
position = Vector2( 640.881, -279.304 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="MenuFire" parent="TheDarkNightUI" instance=ExtResource( 4 )]
|
||||
position = Vector2( 421, -275 )
|
||||
scale = Vector2( 4, 4 )
|
||||
|
||||
[node name="Damaging" parent="TheDarkNightUI/MenuFire" index="3"]
|
||||
damage = -5.0
|
||||
|
||||
[node name="Play" type="Button" parent="TheDarkNightUI"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -202.0
|
||||
margin_top = -190.0
|
||||
margin_right = -64.0
|
||||
margin_bottom = -64.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Play"
|
||||
icon = ExtResource( 3 )
|
||||
flat = true
|
||||
|
||||
[editable path="TheDarkNightUI/MenuFire"]
|
16
src/levels/phaseone/PhaseOne.gd
Normal file
16
src/levels/phaseone/PhaseOne.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends CanvasLayer
|
||||
|
||||
|
||||
signal survival_seconds_updated(origin, value)
|
||||
|
||||
|
||||
var survival_seconds = 0 setget set_survival_seconds
|
||||
|
||||
|
||||
func set_survival_seconds(value):
|
||||
survival_seconds = value
|
||||
emit_signal("survival_seconds_updated", self, value)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
set_survival_seconds(survival_seconds + delta)
|
93
src/levels/phaseone/PhaseOne.tscn
Normal file
93
src/levels/phaseone/PhaseOne.tscn
Normal file
File diff suppressed because one or more lines are too long
BIN
src/levels/ui/LifeBarBg.png
(Stored with Git LFS)
Normal file
BIN
src/levels/ui/LifeBarBg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Music_off.png-27b13d35b03a178cf5a3bbf66101607e.stex"
|
||||
path="res://.import/LifeBarBg.png-92e27c6c8c2b2c98514ee58be3531b57.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/Music_off.png"
|
||||
dest_files=[ "res://.import/Music_off.png-27b13d35b03a178cf5a3bbf66101607e.stex" ]
|
||||
source_file="res://src/levels/ui/LifeBarBg.png"
|
||||
dest_files=[ "res://.import/LifeBarBg.png-92e27c6c8c2b2c98514ee58be3531b57.stex" ]
|
||||
|
||||
[params]
|
||||
|
BIN
src/levels/ui/LifeBarFg.png
(Stored with Git LFS)
Normal file
BIN
src/levels/ui/LifeBarFg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/LifeBarFg.png-0d39793826fe9b1367d14793755cf28a.stex"
|
||||
path="res://.import/LifeBarFg.png-28ea90fdcf238c170621d71fd7364d9c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/LifeBarFg.png"
|
||||
dest_files=[ "res://.import/LifeBarFg.png-0d39793826fe9b1367d14793755cf28a.stex" ]
|
||||
source_file="res://src/levels/ui/LifeBarFg.png"
|
||||
dest_files=[ "res://.import/LifeBarFg.png-28ea90fdcf238c170621d71fd7364d9c.stex" ]
|
||||
|
||||
[params]
|
||||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Music_on.png-a4e74b2de0c60b71ef58425ddb79e339.stex"
|
||||
path="res://.import/MusicOff.png-3d7a249e16e0845cbf72a491bcf78f89.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/Music_on.png"
|
||||
dest_files=[ "res://.import/Music_on.png-a4e74b2de0c60b71ef58425ddb79e339.stex" ]
|
||||
source_file="res://src/levels/ui/MusicOff.png"
|
||||
dest_files=[ "res://.import/MusicOff.png-3d7a249e16e0845cbf72a491bcf78f89.stex" ]
|
||||
|
||||
[params]
|
||||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/LifeBarBg.png-99f7fc4234c2ec6ac697cc824f58880b.stex"
|
||||
path="res://.import/MusicOn.png-f3bda32dfd5085be5d85bd799f5e477a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/LifeBarBg.png"
|
||||
dest_files=[ "res://.import/LifeBarBg.png-99f7fc4234c2ec6ac697cc824f58880b.stex" ]
|
||||
source_file="res://src/levels/ui/MusicOn.png"
|
||||
dest_files=[ "res://.import/MusicOn.png-f3bda32dfd5085be5d85bd799f5e477a.stex" ]
|
||||
|
||||
[params]
|
||||
|
10
src/levels/ui/MuteButton.gd
Normal file
10
src/levels/ui/MuteButton.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends Button
|
||||
class_name MuteButton
|
||||
|
||||
|
||||
export(Texture) var on_sprite
|
||||
export(Texture) var off_sprite
|
||||
|
||||
|
||||
func _on_MuteButton_toggled(button_pressed):
|
||||
$Sprite.texture = on_sprite if button_pressed else off_sprite
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/PlayButton.png-bbb75720f98ee0da7cc56e3bae2f00bf.stex"
|
||||
path="res://.import/PlayButton.png-e039009d0149a660666f12aa55641bfc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/PlayButton.png"
|
||||
dest_files=[ "res://.import/PlayButton.png-bbb75720f98ee0da7cc56e3bae2f00bf.stex" ]
|
||||
source_file="res://src/levels/ui/PlayButton.png"
|
||||
dest_files=[ "res://.import/PlayButton.png-e039009d0149a660666f12aa55641bfc.stex" ]
|
||||
|
||||
[params]
|
||||
|
|
@ -1,12 +1,7 @@
|
|||
extends Label
|
||||
|
||||
|
||||
func _ready():
|
||||
var game = get_tree().root.get_node("Game")
|
||||
game.connect("survival_seconds_updated", self, "_on_survival_seconds_updated")
|
||||
|
||||
|
||||
func _on_survival_seconds_updated(value: float):
|
||||
func _on_PhaseOne_survival_seconds_updated(_origin, value):
|
||||
# warning-ignore:NARROWING_CONVERSION
|
||||
var minutes: int = floor(value / 60)
|
||||
var seconds_and_millis: float = value - minutes * 60
|
BIN
src/levels/ui/Title.png
(Stored with Git LFS)
Normal file
BIN
src/levels/ui/Title.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Title.png-eddaf0247c16f2cd01805f96e728b10b.stex"
|
||||
path="res://.import/Title.png-7e1407f721da11d4fb44afc739066a3c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/Title.png"
|
||||
dest_files=[ "res://.import/Title.png-eddaf0247c16f2cd01805f96e728b10b.stex" ]
|
||||
source_file="res://src/levels/ui/Title.png"
|
||||
dest_files=[ "res://.import/Title.png-7e1407f721da11d4fb44afc739066a3c.stex" ]
|
||||
|
||||
[params]
|
||||
|
BIN
src/levels/ui/UIBar.png
(Stored with Git LFS)
Normal file
BIN
src/levels/ui/UIBar.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -2,15 +2,15 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/UIBar.png-1a0464279903795260a97a88d660c35b.stex"
|
||||
path="res://.import/UIBar.png-52cf3d006ccfd901972f38b7c438639b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/UIBar.png"
|
||||
dest_files=[ "res://.import/UIBar.png-1a0464279903795260a97a88d660c35b.stex" ]
|
||||
source_file="res://src/levels/ui/UIBar.png"
|
||||
dest_files=[ "res://.import/UIBar.png-52cf3d006ccfd901972f38b7c438639b.stex" ]
|
||||
|
||||
[params]
|
||||
|
78
src/levels/ui/UserInterface.tscn
Normal file
78
src/levels/ui/UserInterface.tscn
Normal file
|
@ -0,0 +1,78 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://src/levels/ui/MusicOn.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/levels/ui/UIBar.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/levels/ui/LifeBarFg.png" type="Texture" id=3]
|
||||
[ext_resource path="res://src/levels/ui/TimeSurvived.gd" type="Script" id=4]
|
||||
[ext_resource path="res://src/levels/ui/LifeBarBg.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/levels/ui/fonts/SourceSerifPro-Regular.ttf" type="DynamicFontData" id=6]
|
||||
[ext_resource path="res://src/levels/ui/MuteButton.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
size = 22
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="Theme" id=2]
|
||||
default_font = SubResource( 3 )
|
||||
|
||||
[node name="UserInterface" type="CanvasLayer"]
|
||||
|
||||
[node name="TheDarkNightUI" type="Control" parent="."]
|
||||
light_mask = 2
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -640.0
|
||||
margin_top = -80.0
|
||||
margin_right = 640.0
|
||||
theme = SubResource( 2 )
|
||||
|
||||
[node name="UIBar" type="Sprite" parent="TheDarkNightUI"]
|
||||
position = Vector2( 640, 40 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="TimeSurvived" type="Label" parent="TheDarkNightUI"]
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 589.0
|
||||
margin_top = 16.0
|
||||
margin_right = 680.0
|
||||
margin_bottom = -12.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
text = "00:00.000"
|
||||
align = 2
|
||||
valign = 1
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="TextureProgress" type="TextureProgress" parent="TheDarkNightUI"]
|
||||
margin_left = 15.0
|
||||
margin_top = 15.0
|
||||
margin_right = 365.0
|
||||
margin_bottom = 65.0
|
||||
value = 50.0
|
||||
texture_under = ExtResource( 5 )
|
||||
texture_progress = ExtResource( 3 )
|
||||
texture_progress_offset = Vector2( 10, 5 )
|
||||
|
||||
[node name="MuteButton" type="Button" parent="TheDarkNightUI"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -64.0
|
||||
margin_top = -25.0
|
||||
margin_bottom = 25.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
toggle_mode = true
|
||||
flat = true
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="TheDarkNightUI/MuteButton"]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
|
||||
[connection signal="toggled" from="TheDarkNightUI/MuteButton" to="TheDarkNightUI/MuteButton" method="_on_MuteButton_toggled"]
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue