added project with nerabochie cows
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
extends NonPlayableCharacter
|
||||
|
||||
func _ready() -> void:
|
||||
walk_cycles = randi_range(min_walk_cycle, max_walk_cycle)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cw3vwyuw1ogw3
|
||||
@@ -0,0 +1,97 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bna1f7ugd2ye6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://te3dft51x8yj" path="res://assets/game/Characters/chicken_sprites.png" id="1_be5x3"]
|
||||
[ext_resource type="Script" uid="uid://cw3vwyuw1ogw3" path="res://scenes/characters/chicken/chicken.gd" id="1_r6a33"]
|
||||
[ext_resource type="Script" uid="uid://c47padj61m0xm" path="res://scripts/state_machine/node_state_machine.gd" id="2_awcwn"]
|
||||
[ext_resource type="Script" uid="uid://b0y0fxeo52kqi" path="res://scripts/state_machine/npc_states/idle_state.gd" id="3_31inw"]
|
||||
[ext_resource type="Script" uid="uid://ciwbskg1hsree" path="res://scripts/state_machine/npc_states/walk_state.gd" id="4_31inw"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rsly8"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_awcwn"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_be5x3"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_31inw"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(16, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r6a33"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(32, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_asyyu"]
|
||||
atlas = ExtResource("1_be5x3")
|
||||
region = Rect2(48, 16, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_31inw"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rsly8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_awcwn")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_be5x3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_31inw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r6a33")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_asyyu")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hv82h"]
|
||||
radius = 4.0
|
||||
|
||||
[node name="Chicken" type="CharacterBody2D"]
|
||||
script = ExtResource("1_r6a33")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -6)
|
||||
sprite_frames = SubResource("SpriteFrames_31inw")
|
||||
animation = &"walk"
|
||||
autoplay = "idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4)
|
||||
shape = SubResource("CircleShape2D_hv82h")
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
radius = 5.0
|
||||
debug_enabled = true
|
||||
|
||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("initial_node_state")]
|
||||
script = ExtResource("2_awcwn")
|
||||
initial_node_state = NodePath("Idle")
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("character", "animated_sprite_2d")]
|
||||
script = ExtResource("3_31inw")
|
||||
character = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
|
||||
[node name="Walk" type="Node" parent="StateMachine" node_paths=PackedStringArray("character", "animated_sprite_2d", "navigation_agent_2d")]
|
||||
script = ExtResource("4_31inw")
|
||||
character = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
navigation_agent_2d = NodePath("../../NavigationAgent2D")
|
||||
@@ -0,0 +1,83 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dhrdm43clw6hx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c71ipew17qq4n" path="res://assets/game/Characters/cow_sprites.png" id="1_kc4rr"]
|
||||
[ext_resource type="Script" uid="uid://c47padj61m0xm" path="res://scripts/state_machine/node_state_machine.gd" id="2_ilrem"]
|
||||
[ext_resource type="Script" uid="uid://b0y0fxeo52kqi" path="res://scripts/state_machine/npc_states/idle_state.gd" id="3_j7g5r"]
|
||||
[ext_resource type="Script" uid="uid://ciwbskg1hsree" path="res://scripts/state_machine/npc_states/walk_state.gd" id="4_4jynl"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sa3qd"]
|
||||
atlas = ExtResource("1_kc4rr")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_14ngq"]
|
||||
atlas = ExtResource("1_kc4rr")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ilrem"]
|
||||
atlas = ExtResource("1_kc4rr")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j7g5r"]
|
||||
atlas = ExtResource("1_kc4rr")
|
||||
region = Rect2(0, 32, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4jynl"]
|
||||
atlas = ExtResource("1_kc4rr")
|
||||
region = Rect2(32, 32, 32, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_cgos1"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sa3qd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_14ngq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ilrem")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j7g5r")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4jynl")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 3.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_kc4rr"]
|
||||
radius = 7.0
|
||||
|
||||
[node name="Cow" type="CharacterBody2D"]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -13)
|
||||
sprite_frames = SubResource("SpriteFrames_cgos1")
|
||||
animation = &"walk"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.754154
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
shape = SubResource("CircleShape2D_kc4rr")
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
navigation_layers = 2
|
||||
avoidance_enabled = true
|
||||
|
||||
[node name="StateMachine" type="Node" parent="."]
|
||||
script = ExtResource("2_ilrem")
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("3_j7g5r")
|
||||
|
||||
[node name="Walk" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("4_4jynl")
|
||||
@@ -0,0 +1,8 @@
|
||||
class_name NonPlayableCharacter
|
||||
extends CharacterBody2D
|
||||
|
||||
@export var min_walk_cycle: int = 2
|
||||
@export var max_walk_cycle: int = 6
|
||||
|
||||
var walk_cycles: int
|
||||
var current_walk_cycle: int
|
||||
@@ -0,0 +1 @@
|
||||
uid://bem5lhx5ynv3m
|
||||
@@ -0,0 +1,46 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animated_sprite_2d : AnimatedSprite2D
|
||||
@export var hit_component_collision_shape : CollisionShape2D
|
||||
|
||||
func _ready() -> void:
|
||||
hit_component_collision_shape.disabled = true
|
||||
hit_component_collision_shape.position = Vector2(0, 0)
|
||||
|
||||
func _on_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_physics_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_next_transitions() -> void:
|
||||
if !animated_sprite_2d.is_playing():
|
||||
transition.emit("Idle")
|
||||
|
||||
|
||||
func _on_enter() -> void:
|
||||
if player.player_direction == Vector2.UP:
|
||||
animated_sprite_2d.play("chopping_back")
|
||||
hit_component_collision_shape.position = Vector2(0, -20)
|
||||
elif player.player_direction == Vector2.RIGHT:
|
||||
animated_sprite_2d.play("chopping_right")
|
||||
hit_component_collision_shape.position = Vector2(9, 0)
|
||||
elif player.player_direction == Vector2.DOWN:
|
||||
animated_sprite_2d.play("chopping_front")
|
||||
hit_component_collision_shape.position = Vector2(0, 3)
|
||||
elif player.player_direction == Vector2.LEFT:
|
||||
animated_sprite_2d.play("chopping_left")
|
||||
hit_component_collision_shape.position = Vector2(-9, 0)
|
||||
else:
|
||||
animated_sprite_2d.play("chopping_front")
|
||||
|
||||
hit_component_collision_shape.disabled = false
|
||||
print(hit_component_collision_shape.disabled)
|
||||
|
||||
|
||||
func _on_exit() -> void:
|
||||
animated_sprite_2d.stop()
|
||||
hit_component_collision_shape.disabled = true
|
||||
@@ -0,0 +1 @@
|
||||
uid://c4452u1vscx6i
|
||||
@@ -0,0 +1,41 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animated_sprite_2d : AnimatedSprite2D
|
||||
|
||||
func _on_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_physics_process(_delta : float) -> void:
|
||||
if player.player_direction == Vector2.UP:
|
||||
animated_sprite_2d.play("idle_back")
|
||||
elif player.player_direction == Vector2.RIGHT:
|
||||
animated_sprite_2d.play("idle_right")
|
||||
elif player.player_direction == Vector2.DOWN:
|
||||
animated_sprite_2d.play("idle_front")
|
||||
elif player.player_direction == Vector2.LEFT:
|
||||
animated_sprite_2d.play("idle_left")
|
||||
else:
|
||||
animated_sprite_2d.play("idle_front")
|
||||
|
||||
|
||||
func _on_next_transitions() -> void:
|
||||
GameInputEvents.movement_input()
|
||||
|
||||
if GameInputEvents.is_movement_input():
|
||||
transition.emit("Walk")
|
||||
|
||||
if player.current_tool == DataTypes.Tools.AxeWood && GameInputEvents.is_used_tool():
|
||||
transition.emit("Chopping")
|
||||
if player.current_tool == DataTypes.Tools.TillGround && GameInputEvents.is_used_tool():
|
||||
transition.emit("Tilling")
|
||||
if player.current_tool == DataTypes.Tools.WaterCrops && GameInputEvents.is_used_tool():
|
||||
transition.emit("Watering")
|
||||
|
||||
func _on_enter() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_exit() -> void:
|
||||
animated_sprite_2d.stop()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cllwng70ofimo
|
||||
@@ -0,0 +1,17 @@
|
||||
class_name Player
|
||||
extends CharacterBody2D
|
||||
|
||||
@export var current_tool : DataTypes.Tools = DataTypes.Tools.None
|
||||
|
||||
var player_direction : Vector2
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_pressed("tool_none"):
|
||||
current_tool = DataTypes.Tools.None
|
||||
if Input.is_action_pressed("tool_axe"):
|
||||
current_tool = DataTypes.Tools.AxeWood
|
||||
if Input.is_action_pressed("tool_tilling"):
|
||||
current_tool = DataTypes.Tools.TillGround
|
||||
if Input.is_action_pressed("tool_water"):
|
||||
current_tool = DataTypes.Tools.WaterCrops
|
||||
@@ -0,0 +1 @@
|
||||
uid://d205est0d6jxx
|
||||
@@ -0,0 +1,454 @@
|
||||
[gd_scene load_steps=54 format=3 uid="uid://3u1xjuwdmkit"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d205est0d6jxx" path="res://scenes/characters/player/player.gd" id="1_6avc5"]
|
||||
[ext_resource type="Texture2D" uid="uid://n61u7n7qeqc5" path="res://assets/game/Characters/basic_character_sprites.png" id="1_7uws0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmab45u52gef" path="res://assets/game/Characters/character_sprites.png" id="1_t61fv"]
|
||||
[ext_resource type="Script" uid="uid://c47padj61m0xm" path="res://scripts/state_machine/node_state_machine.gd" id="3_hss88"]
|
||||
[ext_resource type="Script" uid="uid://cllwng70ofimo" path="res://scenes/characters/player/idle_state.gd" id="4_qd3e3"]
|
||||
[ext_resource type="Script" uid="uid://cyxh22il4jswp" path="res://scenes/characters/player/walk_state.gd" id="5_qd3e3"]
|
||||
[ext_resource type="Script" uid="uid://c4452u1vscx6i" path="res://scenes/characters/player/chopping_state.gd" id="7_mk55u"]
|
||||
[ext_resource type="Script" uid="uid://cnhdhcvgn2wjs" path="res://scenes/characters/player/tilling_state.gd" id="8_xuses"]
|
||||
[ext_resource type="Script" uid="uid://b0c6xphnjb3cl" path="res://scenes/characters/player/watering_state.gd" id="9_42irl"]
|
||||
[ext_resource type="PackedScene" uid="uid://04bcami5g18j" path="res://scenes/components/hit_component.tscn" id="10_3xnwo"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3xnwo"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 240, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_djydg"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 240, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bsn6e"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 192, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_blysn"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 192, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hv5x3"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 288, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ykrpk"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 288, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i1nod"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 336, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4kqyw"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 336, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t61fv"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(0, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_686vu"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(48, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hss88"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qd3e3"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6avc5"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(0, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mk55u"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(48, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xuses"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(0, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_42irl"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(48, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_svuau"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ro20i"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8y75b"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tebod"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6nfx3"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3hnlq"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d73qs"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u6wme"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bxwvg"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(96, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2v4cy"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(144, 48, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j8rto"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(96, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b4gk5"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(144, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r0hd7"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(96, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gpigg"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(144, 96, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nt8su"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(96, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_10pim"]
|
||||
atlas = ExtResource("1_7uws0")
|
||||
region = Rect2(144, 144, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pbtrp"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 432, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_es5sa"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 432, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kxlma"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 384, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ieypo"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 384, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sulyr"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 480, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_71adu"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 480, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xm30n"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(0, 528, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qe74o"]
|
||||
atlas = ExtResource("1_t61fv")
|
||||
region = Rect2(48, 528, 48, 48)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_3xnwo"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3xnwo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_djydg")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"chopping_back",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bsn6e")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_blysn")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"chopping_front",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hv5x3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ykrpk")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"chopping_left",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i1nod")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4kqyw")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"chopping_right",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t61fv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_686vu")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle_back",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hss88")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qd3e3")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle_front",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6avc5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mk55u")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle_left",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xuses")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_42irl")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle_right",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_svuau")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ro20i")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"tilling_back",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8y75b")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tebod")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"tilling_front",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6nfx3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3hnlq")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"tilling_left",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d73qs")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_u6wme")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"tilling_right",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bxwvg")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2v4cy")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk_back",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j8rto")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_b4gk5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk_front",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r0hd7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gpigg")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk_left",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nt8su")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_10pim")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk_right",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pbtrp")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_es5sa")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"watering_back",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kxlma")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ieypo")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"watering_front",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sulyr")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_71adu")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"watering_left",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xm30n")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qe74o")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"watering_right",
|
||||
"speed": 3.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_t61fv"]
|
||||
radius = 4.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_djydg"]
|
||||
radius = 2.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 2
|
||||
script = ExtResource("1_6avc5")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -8)
|
||||
sprite_frames = SubResource("SpriteFrames_3xnwo")
|
||||
animation = &"tilling_right"
|
||||
autoplay = "idle_front"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4)
|
||||
shape = SubResource("CircleShape2D_t61fv")
|
||||
|
||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("initial_node_state")]
|
||||
script = ExtResource("3_hss88")
|
||||
initial_node_state = NodePath("Idle")
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("player", "animated_sprite_2d")]
|
||||
script = ExtResource("4_qd3e3")
|
||||
player = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
|
||||
[node name="Walk" type="Node" parent="StateMachine" node_paths=PackedStringArray("player", "animated_sprite_2d")]
|
||||
script = ExtResource("5_qd3e3")
|
||||
player = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
|
||||
[node name="Chopping" type="Node" parent="StateMachine" node_paths=PackedStringArray("player", "animated_sprite_2d", "hit_component_collision_shape")]
|
||||
script = ExtResource("7_mk55u")
|
||||
player = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
hit_component_collision_shape = NodePath("../../HitComponent/HitComponentCollisionShape2D")
|
||||
|
||||
[node name="Tilling" type="Node" parent="StateMachine" node_paths=PackedStringArray("player", "animated_sprite_2d")]
|
||||
script = ExtResource("8_xuses")
|
||||
player = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
|
||||
[node name="Watering" type="Node" parent="StateMachine" node_paths=PackedStringArray("player", "animated_sprite_2d")]
|
||||
script = ExtResource("9_42irl")
|
||||
player = NodePath("../..")
|
||||
animated_sprite_2d = NodePath("../../AnimatedSprite2D")
|
||||
|
||||
[node name="HitComponent" parent="." instance=ExtResource("10_3xnwo")]
|
||||
current_tool = 1
|
||||
|
||||
[node name="HitComponentCollisionShape2D" type="CollisionShape2D" parent="HitComponent"]
|
||||
position = Vector2(9, 0)
|
||||
shape = SubResource("CircleShape2D_djydg")
|
||||
debug_color = Color(0.967873, 0.164564, 0.187665, 0.42)
|
||||
@@ -0,0 +1,33 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animated_sprite_2d : AnimatedSprite2D
|
||||
|
||||
func _on_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_physics_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_next_transitions() -> void:
|
||||
if !animated_sprite_2d.is_playing():
|
||||
transition.emit("Idle")
|
||||
|
||||
|
||||
func _on_enter() -> void:
|
||||
if player.player_direction == Vector2.UP:
|
||||
animated_sprite_2d.play("tilling_back")
|
||||
elif player.player_direction == Vector2.RIGHT:
|
||||
animated_sprite_2d.play("tilling_right")
|
||||
elif player.player_direction == Vector2.DOWN:
|
||||
animated_sprite_2d.play("tilling_front")
|
||||
elif player.player_direction == Vector2.LEFT:
|
||||
animated_sprite_2d.play("tilling_left")
|
||||
else:
|
||||
animated_sprite_2d.play("tilling_front")
|
||||
|
||||
|
||||
func _on_exit() -> void:
|
||||
animated_sprite_2d.stop()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cnhdhcvgn2wjs
|
||||
@@ -0,0 +1,41 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animated_sprite_2d : AnimatedSprite2D
|
||||
@export var speed : int = 50
|
||||
|
||||
func _on_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_physics_process(_delta : float) -> void:
|
||||
var direction : Vector2 = GameInputEvents.movement_input()
|
||||
|
||||
if direction == Vector2.UP:
|
||||
animated_sprite_2d.play("walk_back")
|
||||
elif direction == Vector2.RIGHT:
|
||||
animated_sprite_2d.play("walk_right")
|
||||
elif direction == Vector2.DOWN:
|
||||
animated_sprite_2d.play("walk_front")
|
||||
elif direction == Vector2.LEFT:
|
||||
animated_sprite_2d.play("walk_left")
|
||||
|
||||
if direction != Vector2.ZERO:
|
||||
player.player_direction = direction
|
||||
|
||||
|
||||
|
||||
player.velocity = direction * speed
|
||||
player.move_and_slide()
|
||||
|
||||
func _on_next_transitions() -> void:
|
||||
if !GameInputEvents.is_movement_input():
|
||||
transition.emit("Idle")
|
||||
|
||||
|
||||
func _on_enter() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_exit() -> void:
|
||||
animated_sprite_2d.stop()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cyxh22il4jswp
|
||||
@@ -0,0 +1,33 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animated_sprite_2d : AnimatedSprite2D
|
||||
|
||||
func _on_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_physics_process(_delta : float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_next_transitions() -> void:
|
||||
if !animated_sprite_2d.is_playing():
|
||||
transition.emit("Idle")
|
||||
|
||||
|
||||
func _on_enter() -> void:
|
||||
if player.player_direction == Vector2.UP:
|
||||
animated_sprite_2d.play("watering_back")
|
||||
elif player.player_direction == Vector2.RIGHT:
|
||||
animated_sprite_2d.play("watering_right")
|
||||
elif player.player_direction == Vector2.DOWN:
|
||||
animated_sprite_2d.play("watering_front")
|
||||
elif player.player_direction == Vector2.LEFT:
|
||||
animated_sprite_2d.play("watering_left")
|
||||
else:
|
||||
animated_sprite_2d.play("watering_front")
|
||||
|
||||
|
||||
func _on_exit() -> void:
|
||||
animated_sprite_2d.stop()
|
||||
@@ -0,0 +1 @@
|
||||
uid://b0c6xphnjb3cl
|
||||
@@ -0,0 +1,9 @@
|
||||
class_name CollectableComponent
|
||||
extends Area2D
|
||||
|
||||
@export var collectable_name : String
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body is Player:
|
||||
print("Collected")
|
||||
get_parent().queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dwlg7rbe070vb
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dk2en4pak8e6f"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwlg7rbe070vb" path="res://scenes/components/collectable_component.gd" id="1_14mdg"]
|
||||
|
||||
[node name="CollectableComponent" type="Area2D"]
|
||||
collision_layer = 32
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_14mdg")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
@@ -0,0 +1,13 @@
|
||||
class_name DamageComponent
|
||||
extends Node2D
|
||||
|
||||
@export var max_damage = 1
|
||||
@export var current_damage = 0
|
||||
|
||||
signal max_damaged_reached
|
||||
|
||||
func apply_damage(damage: int) -> void:
|
||||
current_damage = clamp(current_damage + damage, 0, max_damage)
|
||||
|
||||
if current_damage == max_damage:
|
||||
max_damaged_reached.emit()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dabtkv831n7fm
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cd3awkrirej8q"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dabtkv831n7fm" path="res://scenes/components/damage_component.gd" id="1_am71n"]
|
||||
|
||||
[node name="DamageComponent" type="Node2D"]
|
||||
script = ExtResource("1_am71n")
|
||||
@@ -0,0 +1,5 @@
|
||||
class_name HitComponent
|
||||
extends Area2D
|
||||
|
||||
@export var current_tool : DataTypes.Tools = DataTypes.Tools.None
|
||||
@export var hit_damage : int = 1
|
||||
@@ -0,0 +1 @@
|
||||
uid://tetr72as3jkf
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://04bcami5g18j"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://tetr72as3jkf" path="res://scenes/components/hit_component.gd" id="1_t7wh5"]
|
||||
|
||||
[node name="HitComponent" type="Area2D"]
|
||||
collision_layer = 8
|
||||
collision_mask = 16
|
||||
script = ExtResource("1_t7wh5")
|
||||
@@ -0,0 +1,12 @@
|
||||
class_name HurtComponent
|
||||
extends Area2D
|
||||
|
||||
@export var tool : DataTypes.Tools = DataTypes.Tools.None
|
||||
|
||||
signal hurt
|
||||
|
||||
|
||||
func _on_area_entered(area: Area2D) -> void:
|
||||
var hit_component = area as HitComponent
|
||||
if tool == hit_component.current_tool:
|
||||
hurt.emit(hit_component.hit_damage)
|
||||
@@ -0,0 +1 @@
|
||||
uid://b24ulc41sykw5
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c82ghkmm1uxfp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b24ulc41sykw5" path="res://scenes/components/hurt_component.gd" id="1_d1uqi"]
|
||||
|
||||
[node name="HurtComponent" type="Area2D"]
|
||||
collision_layer = 16
|
||||
collision_mask = 8
|
||||
script = ExtResource("1_d1uqi")
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
@@ -0,0 +1,15 @@
|
||||
class_name InteractableComponent
|
||||
extends Area2D
|
||||
|
||||
signal interactable_activated
|
||||
signal interactable_deactivated
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
interactable_activated.emit()
|
||||
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
interactable_deactivated.emit()
|
||||
@@ -0,0 +1 @@
|
||||
uid://clqjplcd1qock
|
||||
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d3iqdpvqhfyf5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://clqjplcd1qock" path="res://scenes/components/interactable_component.gd" id="1_onphe"]
|
||||
|
||||
[node name="InteractableComponent" type="Area2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_onphe")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
@@ -0,0 +1,16 @@
|
||||
extends StaticBody2D
|
||||
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||
@onready var interactable_component: InteractableComponent = $InteractableComponent
|
||||
|
||||
func _ready() -> void:
|
||||
interactable_component.interactable_activated.connect(on_interactable_activated)
|
||||
interactable_component.interactable_deactivated.connect(on_interactable_deactivated)
|
||||
|
||||
func on_interactable_activated() -> void:
|
||||
animated_sprite_2d.play("open_door")
|
||||
collision_layer = 2
|
||||
|
||||
func on_interactable_deactivated() -> void:
|
||||
animated_sprite_2d.play("close_door")
|
||||
collision_layer = 1
|
||||
@@ -0,0 +1 @@
|
||||
uid://b7wub52kknw3e
|
||||
@@ -0,0 +1,109 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://r70r5top6yxw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b7wub52kknw3e" path="res://scenes/houses/door.gd" id="1_act2a"]
|
||||
[ext_resource type="Texture2D" uid="uid://bojkicq5jj3bv" path="res://assets/game/Tilesets/doors.png" id="1_bxi54"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3iqdpvqhfyf5" path="res://scenes/components/interactable_component.tscn" id="2_2dpp7"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2dpp7"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_act2a"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 32, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1ugum"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 48, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nno8d"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wapg7"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3g7dj"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 16, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g4ind"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 48, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6uimo"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 32, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_557ok"]
|
||||
atlas = ExtResource("1_bxi54")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_nb53x"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2dpp7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_act2a")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1ugum")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nno8d")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"close_door",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wapg7")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3g7dj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g4ind")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6uimo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_557ok")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"open_door",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bxi54"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2dpp7"]
|
||||
size = Vector2(12, 38)
|
||||
|
||||
[node name="Door" type="StaticBody2D"]
|
||||
script = ExtResource("1_act2a")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_nb53x")
|
||||
animation = &"close_door"
|
||||
autoplay = "default"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_bxi54")
|
||||
|
||||
[node name="InteractableComponent" parent="." instance=ExtResource("2_2dpp7")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractableComponent"]
|
||||
shape = SubResource("RectangleShape2D_2dpp7")
|
||||
debug_color = Color(0.494525, 0.583036, 1.92523e-07, 0.42)
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=2 format=4 uid="uid://c6wwpx1few2ge"]
|
||||
|
||||
[ext_resource type="TileSet" uid="uid://cct3gg8334naq" path="res://tilesets/house_tile_set.tres" id="1_xgc15"]
|
||||
|
||||
[node name="LargeHouse" type="Node2D"]
|
||||
|
||||
[node name="HouseTileMap" type="Node2D" parent="."]
|
||||
|
||||
[node name="Floor" type="TileMapLayer" parent="HouseTileMap"]
|
||||
tile_map_data = PackedByteArray("AAAAAP7/AAABAAEAAAABAP7/AAABAAEAAAACAP7/AAABAAEAAAADAP//AAABAAEAAAAEAP//AAABAAEAAAAEAP7/AAABAAEAAAADAP7/AAABAAEAAAAFAP//AAABAAEAAAAGAP//AAABAAEAAAAFAP7/AAABAAEAAAAGAP7/AAABAAEAAAAHAP7/AAABAAEAAAAIAP7/AAABAAEAAAAJAP7/AAABAAEAAAABAP3/AAABAAEAAAAAAP3/AAABAAEAAAAAAPz/AAABAAEAAAAAAPv/AAABAAEAAAAAAPr/AAABAAEAAAABAPr/AAABAAEAAAACAPr/AAABAAEAAAADAPr/AAABAAEAAAAEAPr/AAABAAEAAAAFAPr/AAABAAEAAAAGAPr/AAABAAEAAAAHAPr/AAABAAEAAAAIAPr/AAABAAEAAAAJAPr/AAABAAEAAAAJAPv/AAABAAEAAAAJAPz/AAABAAEAAAAJAP3/AAABAAEAAAAIAP3/AAABAAEAAAAHAP3/AAABAAEAAAAGAP3/AAABAAEAAAAFAP3/AAABAAEAAAAEAP3/AAABAAEAAAADAP3/AAABAAEAAAACAP3/AAABAAEAAAABAPz/AAABAAEAAAABAPv/AAABAAEAAAACAPv/AAABAAEAAAADAPv/AAABAAEAAAAEAPv/AAABAAEAAAAFAPv/AAABAAEAAAAGAPv/AAABAAEAAAAHAPv/AAABAAEAAAAIAPv/AAABAAEAAAAIAPz/AAABAAEAAAAHAPz/AAABAAEAAAAGAPz/AAABAAEAAAAFAPz/AAABAAEAAAAEAPz/AAABAAEAAAADAPz/AAABAAEAAAACAPz/AAABAAEAAAACAP//AAABAAEAAAAHAP//AAABAAEAAAAIAP//AAABAAEAAAAKAP7/AAABAAEAAAAKAP3/AAABAAEAAAAKAPz/AAABAAEAAAAKAPv/AAABAAEAAAAKAPr/AAABAAEAAAA=")
|
||||
tile_set = ExtResource("1_xgc15")
|
||||
|
||||
[node name="Walls" type="TileMapLayer" parent="HouseTileMap"]
|
||||
tile_map_data = PackedByteArray("AAD///v/AAAAAAEAAAD///z/AAAAAAEAAAD///3/AAAAAAEAAAD///7/AAAAAAIAAAD///r/AAAAAAEAAAALAP3/AAACAAEAAAALAPz/AAACAAEAAAALAPv/AAACAAEAAAACAP//AAABAAIAAAADAP//AAADAAIAAAAEAP//AAABAAIAAAAGAP//AAABAAIAAAAIAP//AAABAAIAAAAHAP//AAADAAIAAAAJAP//AAACAAIAAAAJAP7/AAADAAAAAAAKAP7/AAABAAIAAAALAP7/AAACAAIAAAAAAP7/AAABAAIAAAABAP7/AAAEAAAAAAABAP//AAAAAAIAAAAAAPn/AAABAAAAAAABAPn/AAADAAIAAAACAPn/AAABAAAAAAADAPn/AAABAAAAAAAEAPn/AAABAAAAAAAFAPn/AAADAAIAAAAGAPn/AAABAAAAAAAHAPn/AAABAAAAAAAIAPn/AAABAAAAAAAJAPn/AAADAAIAAAAKAPn/AAABAAAAAAALAPn/AAACAAAAAAALAPr/AAACAAEAAAD///n/AAAAAAAAAAAFAP//AgAAAAAAAQA=")
|
||||
tile_set = ExtResource("1_xgc15")
|
||||
|
||||
[node name="Furniture" type="TileMapLayer" parent="HouseTileMap"]
|
||||
tile_map_data = PackedByteArray("AAADAPn/AQABAAAAAAAHAPn/AQACAAAAAAAKAPr/AQACAAEAAAAJAPr/AQAEAAMAAAAFAPz/AQADAAMAAAAEAPz/AQAEAAIAAAAGAPz/AQAFAAIAAAAGAPr/AQADAAIAAAAEAPn/AQAGAAMAAAAAAPr/AQADAAAAAAAJAPv/AQABAAUAAAAFAP7/AQABAAUAAAA=")
|
||||
tile_set = ExtResource("1_xgc15")
|
||||
@@ -0,0 +1,28 @@
|
||||
extends Sprite2D
|
||||
|
||||
@onready var hurt_component: HurtComponent = $HurtComponent
|
||||
@onready var damage_component: DamageComponent = $DamageComponent
|
||||
|
||||
var stone_scene = preload("res://scenes/objects/rocks/stone.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
hurt_component.hurt.connect(on_hurt)
|
||||
damage_component.max_damaged_reached.connect(on_max_damage_reached)
|
||||
|
||||
func on_hurt(hit_damage: int) -> void:
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
damage_component.apply_damage(hit_damage)
|
||||
material.set_shader_parameter("shake_intensity", 0.3)
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
material.set_shader_parameter("shake_intensity", 0.0)
|
||||
|
||||
func on_max_damage_reached() -> void:
|
||||
call_deferred("add_stone_scene")
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
queue_free()
|
||||
|
||||
func add_stone_scene() -> void:
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
var stone_instance = stone_scene.instantiate() as Node2D
|
||||
stone_instance.global_position = global_position
|
||||
get_parent().add_child(stone_instance)
|
||||
@@ -0,0 +1 @@
|
||||
uid://ck5yoag6lc7yu
|
||||
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bogb8jcyikd22"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djm430uofdey4" path="res://assets/game/Objects/basic_grass_biom_things.png" id="1_70ahf"]
|
||||
[ext_resource type="Shader" uid="uid://bc6pkfntsjgpa" path="res://scenes/objects/shake.gdshader" id="1_bntui"]
|
||||
[ext_resource type="PackedScene" uid="uid://c82ghkmm1uxfp" path="res://scenes/components/hurt_component.tscn" id="2_aw33s"]
|
||||
[ext_resource type="Script" uid="uid://ck5yoag6lc7yu" path="res://scenes/objects/rocks/rock.gd" id="2_f5itc"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd3awkrirej8q" path="res://scenes/components/damage_component.tscn" id="4_bntui"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8i8v8"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("1_bntui")
|
||||
shader_parameter/shake_intensity = 0.0
|
||||
shader_parameter/shake_speed = 20.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_aw33s"]
|
||||
atlas = ExtResource("1_70ahf")
|
||||
region = Rect2(128, 16, 16, 16)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_70ahf"]
|
||||
radius = 5.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_aw33s"]
|
||||
radius = 6.0
|
||||
|
||||
[node name="Rock" type="Sprite2D"]
|
||||
material = SubResource("ShaderMaterial_8i8v8")
|
||||
position = Vector2(0, -4)
|
||||
texture = SubResource("AtlasTexture_aw33s")
|
||||
script = ExtResource("2_f5itc")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(0, 1)
|
||||
shape = SubResource("CircleShape2D_70ahf")
|
||||
|
||||
[node name="HurtComponent" parent="." instance=ExtResource("2_aw33s")]
|
||||
tool = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="HurtComponent"]
|
||||
shape = SubResource("CircleShape2D_aw33s")
|
||||
debug_color = Color(0.84073, 0.29711, 0.6188, 0.42)
|
||||
|
||||
[node name="DamageComponent" parent="." instance=ExtResource("4_bntui")]
|
||||
max_damage = 4
|
||||
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://e1k1nplcm5x3"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djm430uofdey4" path="res://assets/game/Objects/basic_grass_biom_things.png" id="1_oca81"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk2en4pak8e6f" path="res://scenes/components/collectable_component.tscn" id="2_k7uky"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dgxlj"]
|
||||
atlas = ExtResource("1_oca81")
|
||||
region = Rect2(114, 18, 10, 8)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_oca81"]
|
||||
radius = 3.0
|
||||
|
||||
[node name="Stone" type="Sprite2D"]
|
||||
texture = SubResource("AtlasTexture_dgxlj")
|
||||
|
||||
[node name="CollectableComponent" parent="." instance=ExtResource("2_k7uky")]
|
||||
collectable_name = "stone"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollectableComponent"]
|
||||
shape = SubResource("CircleShape2D_oca81")
|
||||
debug_color = Color(0, 0.64226, 0.32076, 0.42)
|
||||
@@ -0,0 +1,16 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float shake_intensity = 0.0;
|
||||
uniform float shake_speed = 20.0;
|
||||
|
||||
void vertex()
|
||||
{
|
||||
vec2 shake = vec2(0.0);
|
||||
|
||||
if (VERTEX.y < 0.0)
|
||||
{
|
||||
shake.x = sin(TIME * shake_speed + VERTEX.y) * shake_intensity;
|
||||
}
|
||||
|
||||
VERTEX.xy += shake;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bc6pkfntsjgpa
|
||||
@@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://b1ecwl06mird5"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://bc6pkfntsjgpa" path="res://scenes/objects/shake.gdshader" id="1_f4wgc"]
|
||||
[ext_resource type="Texture2D" uid="uid://djm430uofdey4" path="res://assets/game/Objects/basic_grass_biom_things.png" id="1_lwbpo"]
|
||||
[ext_resource type="Script" uid="uid://bjyo5al8rswf6" path="res://scenes/objects/trees/tree.gd" id="2_wjqkr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd3awkrirej8q" path="res://scenes/components/damage_component.tscn" id="3_ivetc"]
|
||||
[ext_resource type="PackedScene" uid="uid://c82ghkmm1uxfp" path="res://scenes/components/hurt_component.tscn" id="4_wjqkr"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6vpey"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("1_f4wgc")
|
||||
shader_parameter/shake_intensity = 0.0
|
||||
shader_parameter/shake_speed = 20.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sx6ol"]
|
||||
atlas = ExtResource("1_lwbpo")
|
||||
region = Rect2(16, 0, 32, 32)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ivetc"]
|
||||
radius = 4.12311
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f4wgc"]
|
||||
size = Vector2(8, 10)
|
||||
|
||||
[node name="LargeTree" type="Sprite2D"]
|
||||
material = SubResource("ShaderMaterial_6vpey")
|
||||
position = Vector2(0, -14)
|
||||
texture = SubResource("AtlasTexture_sx6ol")
|
||||
script = ExtResource("2_wjqkr")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(0, 11)
|
||||
shape = SubResource("CircleShape2D_ivetc")
|
||||
|
||||
[node name="HurtComponent" parent="." instance=ExtResource("4_wjqkr")]
|
||||
tool = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="HurtComponent"]
|
||||
position = Vector2(0, 10)
|
||||
shape = SubResource("RectangleShape2D_f4wgc")
|
||||
debug_color = Color(0.987551, 0, 0.311789, 0.42)
|
||||
|
||||
[node name="DamageComponent" parent="." instance=ExtResource("3_ivetc")]
|
||||
max_damage = 6
|
||||
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dwuetj48nbxl4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djm430uofdey4" path="res://assets/game/Objects/basic_grass_biom_things.png" id="1_bcctm"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk2en4pak8e6f" path="res://scenes/components/collectable_component.tscn" id="2_e2a05"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_e2a05"]
|
||||
atlas = ExtResource("1_bcctm")
|
||||
region = Rect2(80, 32, 16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_s5rqd"]
|
||||
size = Vector2(12, 9)
|
||||
|
||||
[node name="Log" type="Sprite2D"]
|
||||
texture = SubResource("AtlasTexture_e2a05")
|
||||
|
||||
[node name="CollectableComponent" parent="." instance=ExtResource("2_e2a05")]
|
||||
collectable_name = "Log"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollectableComponent"]
|
||||
position = Vector2(0, 0.5)
|
||||
shape = SubResource("RectangleShape2D_s5rqd")
|
||||
@@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://l1macsaei2qb"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djm430uofdey4" path="res://assets/game/Objects/basic_grass_biom_things.png" id="1_a8qts"]
|
||||
[ext_resource type="Shader" uid="uid://bc6pkfntsjgpa" path="res://scenes/objects/shake.gdshader" id="1_w057i"]
|
||||
[ext_resource type="Script" uid="uid://bjyo5al8rswf6" path="res://scenes/objects/trees/tree.gd" id="2_g5iuu"]
|
||||
[ext_resource type="PackedScene" uid="uid://c82ghkmm1uxfp" path="res://scenes/components/hurt_component.tscn" id="2_xyb6m"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd3awkrirej8q" path="res://scenes/components/damage_component.tscn" id="3_au4vd"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_skbjc"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("1_w057i")
|
||||
shader_parameter/shake_intensity = 0.0
|
||||
shader_parameter/shake_speed = 20.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xyb6m"]
|
||||
atlas = ExtResource("1_a8qts")
|
||||
region = Rect2(0, 0, 16, 32)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_au4vd"]
|
||||
radius = 4.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_au4vd"]
|
||||
size = Vector2(8, 9)
|
||||
|
||||
[node name="SmallTree" type="Sprite2D"]
|
||||
material = SubResource("ShaderMaterial_skbjc")
|
||||
position = Vector2(0, -10)
|
||||
texture = SubResource("AtlasTexture_xyb6m")
|
||||
script = ExtResource("2_g5iuu")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(0, 8)
|
||||
shape = SubResource("CircleShape2D_au4vd")
|
||||
|
||||
[node name="HurtComponent" parent="." instance=ExtResource("2_xyb6m")]
|
||||
tool = 1
|
||||
|
||||
[node name="HurtComponentCollisionShape2D" type="CollisionShape2D" parent="HurtComponent"]
|
||||
position = Vector2(0, 7.5)
|
||||
shape = SubResource("RectangleShape2D_au4vd")
|
||||
debug_color = Color(0.86184, 0.231398, 0.689692, 0.42)
|
||||
|
||||
[node name="DamageComponent" parent="." instance=ExtResource("3_au4vd")]
|
||||
max_damage = 3
|
||||
@@ -0,0 +1,28 @@
|
||||
extends Sprite2D
|
||||
|
||||
@onready var hurt_component: HurtComponent = $HurtComponent
|
||||
@onready var damage_component: DamageComponent = $DamageComponent
|
||||
|
||||
var log_scene = preload("res://scenes/objects/trees/log.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
hurt_component.hurt.connect(on_hurt)
|
||||
damage_component.max_damaged_reached.connect(on_max_damage_reached)
|
||||
|
||||
func on_hurt(hit_damage: int) -> void:
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
damage_component.apply_damage(hit_damage)
|
||||
material.set_shader_parameter("shake_intensity", 0.5)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
material.set_shader_parameter("shake_intensity", 0.0)
|
||||
|
||||
func on_max_damage_reached() -> void:
|
||||
call_deferred("add_log_scene")
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
queue_free()
|
||||
|
||||
func add_log_scene() -> void:
|
||||
await get_tree().create_timer(0.33).timeout
|
||||
var log_instance = log_scene.instantiate() as Node2D
|
||||
log_instance.global_position = global_position
|
||||
get_parent().add_child(log_instance)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bjyo5al8rswf6
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user