mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 07:34:22 +00:00
stuff
This commit is contained in:
parent
643455b689
commit
fbddb8ffa2
20 changed files with 194 additions and 281 deletions
|
@ -40,7 +40,7 @@ func spawn():
|
|||
return null
|
||||
var entity = scene.instantiate()
|
||||
entity.global_position = global_position
|
||||
target.add_child.call_deferred(entity) # Not sure why this is needed.
|
||||
target.add_child(entity)
|
||||
spawned.emit(entity)
|
||||
return entity
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ class_name TimerStddev
|
|||
|
||||
func randomize_wait_time() -> void:
|
||||
wait_time = clampf(
|
||||
min_secs,
|
||||
Random.rng.randfn(mean_secs, deviation),
|
||||
min_secs,
|
||||
max_secs
|
||||
)
|
||||
|
||||
|
|
|
@ -1,56 +1,35 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Chupacabra
|
||||
|
||||
|
||||
@export var skitter_directions: Array[Vector2] = []
|
||||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var movement_wander: MoveStraight = %"MovementWander"
|
||||
@onready var movement_wander_tp: TargetPicker = movement_wander.get_node("TrackerMeat/TargetPicker")
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
@onready var eater: Eater = %"Eater"
|
||||
@onready var tophatter: Eater = %"TopHatter"
|
||||
@onready var monocler: Eater = %"Monocler"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
||||
func _on_eater_eaten(edible:Edible) -> void:
|
||||
edible.get_parent().queue_free()
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
tophatter.collision_mask = 16
|
||||
monocler.collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
eater.collision_mask = 16
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
tophatter.collision_mask = 8
|
||||
monocler.collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
eater.collision_mask = 8
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
|
||||
func _on_wander_enabled() -> void:
|
||||
if movement_wander_tp.target:
|
||||
movement_wander.steer_direction_towards(movement_wander_tp.target)
|
||||
else:
|
||||
movement_wander.randomize_direction()
|
||||
|
||||
func _on_gold_spawner_spawned(entity:Node2D) -> void:
|
||||
entity.get_node("MoveStraight").speed = 25
|
||||
entity.get_node("MoveStraight").randomize_direction()
|
||||
entity.get_node("MoveStraight/Priority").priority_alternative()
|
||||
|
|
|
@ -559,22 +559,11 @@ debug_color = Color(1, 0, 0, 0.294118)
|
|||
stream = ExtResource("17_ccla5")
|
||||
bus = &"KillSounds"
|
||||
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]]
|
||||
[connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocles"]]
|
||||
[connection signal="tree_exiting" from="Sprite/Monocler/Spawner" to="Sprite/Monocler/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/Monocler/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="spawned" from="GoldSpawner" to="." method="_on_gold_spawner_spawned"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner/SpawnTimer" method="randomize_wait_time"]
|
||||
[connection signal="move" from="MovementIdle" to="." method="_on_move"]
|
||||
[connection signal="move_disabled" from="MovementIdle" to="MovementIdle/BoredTimer" method="stop"]
|
||||
[connection signal="move_enabled" from="MovementIdle" to="MovementIdle/BoredTimer" method="start"]
|
||||
|
|
|
@ -1,45 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Cthulhu
|
||||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
@onready var tophatter: Eater = %"TopHatter"
|
||||
@onready var monocler: Eater = %"Monocler"
|
||||
|
||||
func _ready():
|
||||
# Setup index and layers
|
||||
_on_fallen()
|
||||
|
||||
func _on_move(movement: Vector2):
|
||||
better_move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
tophatter.collision_mask = 16
|
||||
monocler.collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
tophatter.collision_mask = 8
|
||||
monocler.collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_eater_eaten(edible: Edible) -> void:
|
||||
edible.get_parent().queue_free()
|
||||
|
||||
func _on_gold_spawner_spawned(entity:Node2D) -> void:
|
||||
entity.scale *= 2
|
||||
entity.get_node("Collectible").quantity = 25
|
||||
entity.get_node("MoveStraight").randomize_direction()
|
||||
entity.get_node("MoveStraight/Priority").priority_alternative()
|
||||
|
||||
|
||||
|
|
|
@ -317,16 +317,6 @@ mean_secs = 0.15
|
|||
min_secs = 0.05
|
||||
max_secs = 0.3
|
||||
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter/Sprite" method="show"]
|
||||
[connection signal="tree_exiting" from="SpriteFocus/Sprite/TopHatter/Spawner" to="SpriteFocus/Sprite/TopHatter/Spawner" method="spawn"]
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler/Sprite" method="show"]
|
||||
[connection signal="tree_exiting" from="SpriteFocus/Sprite/Monocler/Spawner" to="SpriteFocus/Sprite/Monocler/Spawner" method="spawn"]
|
||||
[connection signal="dragged" from="MovementDrag" to="." method="_on_dragged"]
|
||||
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragPriority" method="priority_alternative" unbinds=1]
|
||||
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragSound" method="play" unbinds=1]
|
||||
|
@ -340,3 +330,4 @@ max_secs = 0.3
|
|||
[connection signal="eaten" from="Eater" to="Eater/EatSound" method="play" unbinds=1]
|
||||
[connection signal="spawned" from="GoldSpawner" to="." method="_on_gold_spawner_spawned"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner/SpawnTimer" method="randomize_wait_time"]
|
||||
|
|
108
entities/entity.gd
Normal file
108
entities/entity.gd
Normal file
|
@ -0,0 +1,108 @@
|
|||
extends BetterCharacterBody2D
|
||||
class_name Entity
|
||||
|
||||
|
||||
## The [SpriteLeftRight] of this entity, or null if it doesn't have one.
|
||||
@onready var sprite: SpriteLeftRight = get_node_or_null("%Sprite")
|
||||
|
||||
## The main [Eater] of this entity, or null if it doesn't have one.
|
||||
@onready var eater: Eater = get_node_or_null("%Eater")
|
||||
|
||||
## The main [AnimationPlayer] of this entity, or null if it doesn't have one.
|
||||
@onready var animator: AnimationPlayer = get_node_or_null("%Animator")
|
||||
|
||||
## The [Eater] controlling the appearence of the [TopHat] on this entity, or null if this isn't supported.
|
||||
@onready var tophatter: Eater = get_node_or_null("%TopHatter")
|
||||
|
||||
## The [Eater] controlling the appearence of the [Monocle] on this entity, or null if this isn't supported.
|
||||
@onready var monocler: Eater = get_node_or_null("%Monocler")
|
||||
|
||||
|
||||
enum State {
|
||||
GROUNDED = 0,
|
||||
FLYING = 1,
|
||||
TRAPPED = 2,
|
||||
}
|
||||
|
||||
## The [State] this entity is in.
|
||||
var state := State.GROUNDED
|
||||
|
||||
|
||||
## Set the entity to be considered walking on the ground.
|
||||
func set_grounded():
|
||||
state = State.GROUNDED
|
||||
collision_layer = Enums.PhysLayers.EntityGround
|
||||
collision_mask = Enums.PhysLayers.EntityGround
|
||||
if tophatter:
|
||||
tophatter.collision_mask = Enums.PhysLayers.EntityGround
|
||||
if monocler:
|
||||
monocler.collision_mask = Enums.PhysLayers.EntityGround
|
||||
if eater:
|
||||
eater.collision_mask = Enums.PhysLayers.EntityGround
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
|
||||
## Set the entity to be considered hovering in the air.
|
||||
func set_flying():
|
||||
state = State.FLYING
|
||||
collision_layer = Enums.PhysLayers.EntityAir
|
||||
collision_mask = Enums.PhysLayers.EntityAir
|
||||
if tophatter:
|
||||
tophatter.collision_mask = Enums.PhysLayers.EntityAir
|
||||
if monocler:
|
||||
monocler.collision_mask = Enums.PhysLayers.EntityAir
|
||||
if eater:
|
||||
eater.collision_mask = Enums.PhysLayers.EntityAir
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
|
||||
## Set the entity to be considered trapped in a [SacrificeStone].
|
||||
func set_trapped():
|
||||
state = State.TRAPPED
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
|
||||
## Handle a signal controlling movement.
|
||||
func handle_movement(movement: Vector2) -> void:
|
||||
better_move_and_collide(movement)
|
||||
if sprite:
|
||||
sprite.handle_move(movement)
|
||||
|
||||
## Initialize the signals of the [field tophatter], if it exists.
|
||||
func _init_tophatter_signals() -> void:
|
||||
if tophatter:
|
||||
var subsprite: Sprite2D = tophatter.get_node("Sprite")
|
||||
var spawner: Spawner = tophatter.get_node("Spawner")
|
||||
var sacrificable: Sacrificable = tophatter.get_node_or_null("Sacrificable")
|
||||
tophatter.eaten.connect(func(edible: Edible): edible.queue_free())
|
||||
tophatter.goal_reached.connect(tophatter.clear_diets)
|
||||
tophatter.goal_reached.connect(subsprite.show)
|
||||
tophatter.goal_reached.connect(spawner.enable)
|
||||
spawner.tree_exiting.connect(spawner.spawn)
|
||||
if sacrificable:
|
||||
sacrificable.sacrificed.connect(queue_free)
|
||||
tophatter.goal_reached.connect(func(): sacrificable.set_kind(&"TopHat"))
|
||||
|
||||
## Initialize the signals of the [field monocler], if it exists.
|
||||
func _init_monocler_signals() -> void:
|
||||
if monocler:
|
||||
var subsprite: Sprite2D = monocler.get_node("Sprite")
|
||||
var spawner: Spawner = monocler.get_node("Spawner")
|
||||
var sacrificable: Sacrificable = monocler.get_node_or_null("Sacrificable")
|
||||
monocler.eaten.connect(func(edible: Edible): edible.queue_free())
|
||||
monocler.goal_reached.connect(monocler.clear_diets)
|
||||
monocler.goal_reached.connect(subsprite.show)
|
||||
monocler.goal_reached.connect(spawner.enable)
|
||||
spawner.tree_exiting.connect(spawner.spawn)
|
||||
if sacrificable:
|
||||
monocler.goal_reached.connect(func(): sacrificable.set_kind(&"Monocle"))
|
||||
sacrificable.sacrificed.connect(queue_free)
|
||||
|
||||
|
||||
## Backwards compatible name for [method handle_movement].
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
handle_movement(movement)
|
||||
|
||||
func _ready() -> void:
|
||||
_init_tophatter_signals()
|
||||
_init_monocler_signals()
|
|
@ -1,49 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Imp
|
||||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var eater: Eater = %"Eater"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
@onready var tophatter: Eater = %"TopHatter"
|
||||
@onready var monocler: Eater = %"Monocler"
|
||||
|
||||
|
||||
func _ready():
|
||||
# Setup index and layers
|
||||
_on_fallen()
|
||||
|
||||
func _on_move(movement: Vector2):
|
||||
better_move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
||||
func _on_eater_eaten(edible: Edible) -> void:
|
||||
edible.get_parent().queue_free()
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
tophatter.collision_mask = 16
|
||||
monocler.collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
eater.collision_mask = 16
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
tophatter.collision_mask = 8
|
||||
monocler.collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
eater.collision_mask = 8
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
|
|
|
@ -415,22 +415,10 @@ debug_color = Color(1, 0, 0, 0.294118)
|
|||
stream = ExtResource("19_7la6c")
|
||||
bus = &"KillSounds"
|
||||
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"Monocle"]]
|
||||
[connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]]
|
||||
[connection signal="tree_exiting" from="Sprite/Monocler/Spawner" to="Sprite/Monocler/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/Monocler/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner/SpawnTimer" method="randomize_wait_time"]
|
||||
[connection signal="changed_direction" from="MovementWander" to="MovementWander/WanderPriority" method="priority_conditional"]
|
||||
[connection signal="move" from="MovementWander" to="." method="_on_move"]
|
||||
[connection signal="timeout" from="MovementWander/ChangeDirectionTimer" to="MovementWander" method="randomize_direction"]
|
||||
|
|
|
@ -1,31 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Monocle
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
better_move_and_collide(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
|
|
|
@ -151,6 +151,7 @@ bus = &"DragSounds"
|
|||
stream = ExtResource("5_grwug")
|
||||
bus = &"FallSounds"
|
||||
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="dragged" from="MovementDrag" to="." method="_on_dragged"]
|
||||
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragSound" method="play" unbinds=1]
|
||||
[connection signal="fallen" from="MovementDrag" to="." method="_on_fallen"]
|
||||
|
|
|
@ -1,46 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Sheep
|
||||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
@onready var tophatter: Eater = %"TopHatter"
|
||||
@onready var monocler: Eater = %"Monocler"
|
||||
|
||||
|
||||
func _ready():
|
||||
# Setup index and layers
|
||||
_on_fallen()
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
better_move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
tophatter.collision_mask = 16
|
||||
monocler.collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
tophatter.collision_mask = 8
|
||||
monocler.collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
|
||||
func _on_eater_eaten(edible: Edible) -> void:
|
||||
edible.get_parent().queue_free()
|
||||
set_grounded()
|
||||
|
|
|
@ -212,7 +212,6 @@ radius = 24.0
|
|||
radius = 24.0
|
||||
|
||||
[node name="Sheep" type="CharacterBody2D"]
|
||||
z_index = 1
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
motion_mode = 1
|
||||
|
@ -409,20 +408,7 @@ bus = &"DragSounds"
|
|||
stream = ExtResource("17_8kst2")
|
||||
bus = &"FallSounds"
|
||||
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable"]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]]
|
||||
[connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable"]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]]
|
||||
[connection signal="tree_exiting" from="Sprite/Monocler/Spawner" to="Sprite/Monocler/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/Monocler/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Edible" to="Spawner" method="roll_spawn" binds= [11]]
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="move" from="MovementIdle" to="." method="_on_move"]
|
||||
|
|
|
@ -1,31 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Skull
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
better_move_and_collide(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
|
|
|
@ -1,31 +1,17 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name TopHat
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
better_move_and_collide(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = false
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
y_sort_enabled = true
|
||||
set_grounded()
|
||||
|
|
|
@ -149,6 +149,7 @@ bus = &"DragSounds"
|
|||
stream = ExtResource("6_6tpnh")
|
||||
bus = &"FallSounds"
|
||||
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="dragged" from="MovementDrag" to="." method="_on_dragged"]
|
||||
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragSound" method="play" unbinds=1]
|
||||
[connection signal="fallen" from="MovementDrag" to="." method="_on_fallen"]
|
||||
|
|
|
@ -1,31 +1,22 @@
|
|||
extends BetterCharacterBody2D
|
||||
extends Entity
|
||||
class_name Watcher
|
||||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
func _ready():
|
||||
# Setup index and layers
|
||||
_on_fallen()
|
||||
|
||||
func _on_move(movement: Vector2):
|
||||
better_move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
||||
func _on_dragged(_cursor: Cursor) -> void:
|
||||
set_flying()
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
set_flying()
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
y_sort_enabled = false
|
||||
set_trapped()
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityAir
|
||||
y_sort_enabled = true
|
||||
set_flying()
|
||||
|
||||
func _on_eater_eaten(edible: Edible) -> void:
|
||||
edible.get_parent().queue_free()
|
||||
func _on_gold_spawner_spawned(entity:Node2D) -> void:
|
||||
entity.get_node("MoveStraight").speed = 50
|
||||
entity.get_node("MoveStraight").randomize_direction()
|
||||
entity.get_node("MoveStraight/Priority").priority_alternative()
|
||||
|
|
|
@ -233,8 +233,8 @@ _data = {
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_dpwsl"]
|
||||
radius = 32.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_w03iw"]
|
||||
radius = 256.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_f4w15"]
|
||||
radius = 512.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ywwo3"]
|
||||
radius = 32.0
|
||||
|
@ -375,7 +375,7 @@ acceptable_diets = Array[StringName]([&"Meat"])
|
|||
|
||||
[node name="Shape" type="CollisionShape2D" parent="MovementHunt/TrackerMeat"]
|
||||
position = Vector2(4, 29)
|
||||
shape = SubResource("CircleShape2D_w03iw")
|
||||
shape = SubResource("CircleShape2D_f4w15")
|
||||
debug_color = Color(1, 1, 0, 0.294118)
|
||||
|
||||
[node name="TargetPicker" parent="MovementHunt/TrackerMeat" node_paths=PackedStringArray("tracker") instance=ExtResource("16_ch04y")]
|
||||
|
@ -414,22 +414,11 @@ debug_color = Color(1, 0, 0, 0.294118)
|
|||
stream = ExtResource("20_bdcer")
|
||||
bus = &"KillSounds"
|
||||
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]]
|
||||
[connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1]
|
||||
[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"]
|
||||
[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]]
|
||||
[connection signal="tree_exiting" from="Sprite/Monocler/Spawner" to="Sprite/Monocler/Spawner" method="spawn"]
|
||||
[connection signal="sacrificed" from="Sprite/Monocler/Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="eaten" from="Edible" to="." method="queue_free"]
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="spawned" from="GoldSpawner" to="." method="_on_gold_spawner_spawned"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner/SpawnTimer" method="randomize_wait_time"]
|
||||
[connection signal="move" from="MovementTilt" to="." method="_on_move"]
|
||||
[connection signal="move_enabled" from="MovementTilt" to="Animator" method="play" binds= [&"fly"]]
|
||||
[connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_rotation_speed"]
|
||||
|
|
5
enums.gd
5
enums.gd
|
@ -10,3 +10,8 @@ enum ZIndex {
|
|||
Flowers = -20,
|
||||
Terrain = -30,
|
||||
}
|
||||
|
||||
enum PhysLayers {
|
||||
EntityGround = 8,
|
||||
EntityAir = 16,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=20 format=3 uid="uid://cxj5aud02f40j"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://cxj5aud02f40j"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm068vaseh45n" path="res://scenes/game/game_camera.tscn" id="2_db5xs"]
|
||||
|
@ -10,6 +10,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://col1q3elvkfwk" path="res://scenes/game/cursor.tscn" id="5_g504x"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxm3edor0akqj" path="res://scenes/game/tileset_flowers_shaded.png" id="5_yqthh"]
|
||||
[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="13_56o7t"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnjtduk0hla3f" path="res://entities/watcher.tscn" id="14_pu3su"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgpwig0rd08vh" path="res://entities/summoning_circle_pentagram.tscn" id="16_nhsrb"]
|
||||
[ext_resource type="PackedScene" uid="uid://db246fkcf452d" path="res://entities/tree.tscn" id="18_r8twr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn0p5s44h86px" path="res://entities/barn.tscn" id="20_tek4w"]
|
||||
|
@ -1108,4 +1109,19 @@ position = Vector2(-160, 420)
|
|||
[node name="Tree27" parent="Entities" instance=ExtResource("18_r8twr")]
|
||||
position = Vector2(120, 480)
|
||||
|
||||
[node name="Watcher" parent="." instance=ExtResource("14_pu3su")]
|
||||
position = Vector2(-360, 0)
|
||||
|
||||
[node name="Watcher2" parent="." instance=ExtResource("14_pu3su")]
|
||||
position = Vector2(-120, -200)
|
||||
|
||||
[node name="Watcher3" parent="." instance=ExtResource("14_pu3su")]
|
||||
position = Vector2(180, -40)
|
||||
|
||||
[node name="Watcher4" parent="." instance=ExtResource("14_pu3su")]
|
||||
position = Vector2(-60, 180)
|
||||
|
||||
[node name="Watcher5" parent="." instance=ExtResource("14_pu3su")]
|
||||
position = Vector2(280, 160)
|
||||
|
||||
[connection signal="recipe_matched" from="Entities/SummoningCirclePentagram" to="." method="_on_recipe_matched"]
|
||||
|
|
Loading…
Reference in a new issue