Compare commits
25 Commits
main
..
56daf32a16
| Author | SHA1 | Date | |
|---|---|---|---|
| 56daf32a16 | |||
| e2dee3f801 | |||
| aa7b392edc | |||
| ebc0133a82 | |||
| 0dff01da11 | |||
| 80d8785a71 | |||
| 530ea16f11 | |||
| a0b35ef4a4 | |||
| 1f25c93fc1 | |||
| 2562366d8a | |||
| b62b24dbbc | |||
| b0e497172f | |||
| 39cd68432e | |||
| 230f39cf54 | |||
| c3522f5417 | |||
| a5a3fa2acf | |||
| 1e617715f3 | |||
| 8d2ce976ec | |||
| 8d9cff9735 | |||
| c0de81481e | |||
| 67c5f8e4d5 | |||
| 63710b691b | |||
| 81d81ae103 | |||
| 37b5b698a6 | |||
| 7f12066244 |
@@ -17,3 +17,5 @@ mono_crash.*.json
|
|||||||
|
|
||||||
export
|
export
|
||||||
|
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
class_name AbstractColorEnemy
|
class_name AbstractColorCultist
|
||||||
extends AbstractEnemy
|
extends AbstractCultist
|
||||||
|
|
||||||
|
|
||||||
@onready var collision_switcher : CollisionSwitcher = $CollisionSwitcher
|
@onready var collision_switcher : CollisionSwitcher = $CollisionSwitcher
|
||||||
+7
-7
@@ -1,11 +1,11 @@
|
|||||||
[gd_scene format=3 uid="uid://d37eyum03h83i"]
|
[gd_scene format=3 uid="uid://d37eyum03h83i"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bx0luh4vdob3q" path="res://game/characters/enemies/abstract_enemy.tscn" id="1_12hr0"]
|
[ext_resource type="PackedScene" uid="uid://bx0luh4vdob3q" path="res://game/characters/enemies/abstract_cultist.tscn" id="1_12hr0"]
|
||||||
[ext_resource type="Script" uid="uid://das7ujanefsn0" path="res://game/characters/enemies/abstract_color_enemy.gd" id="2_rd56i"]
|
[ext_resource type="Script" uid="uid://das7ujanefsn0" path="res://game/characters/enemies/abstract_color_cultist.gd" id="2_rd56i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="3_e5cea"]
|
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="3_e5cea"]
|
||||||
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_r5rx0"]
|
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_r5rx0"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ybui5"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ejk4w"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource("3_r5rx0")
|
shader = ExtResource("3_r5rx0")
|
||||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||||
@@ -16,11 +16,11 @@ shader_parameter/speed = 5.0
|
|||||||
shader_parameter/intensity = 1.0
|
shader_parameter/intensity = 1.0
|
||||||
shader_parameter/scale = 20.0
|
shader_parameter/scale = 20.0
|
||||||
|
|
||||||
[node name="AbstractColorEnemy" instance=ExtResource("1_12hr0")]
|
[node name="AbstractColorCultist" unique_id=644641841 instance=ExtResource("1_12hr0")]
|
||||||
script = ExtResource("2_rd56i")
|
script = ExtResource("2_rd56i")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." index="0"]
|
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||||
material = SubResource("ShaderMaterial_ybui5")
|
material = SubResource("ShaderMaterial_ejk4w")
|
||||||
|
|
||||||
[node name="CollisionSwitcher" parent="." index="2" node_paths=PackedStringArray("object") instance=ExtResource("3_e5cea")]
|
[node name="CollisionSwitcher" parent="." index="2" unique_id=991274552 node_paths=PackedStringArray("object") instance=ExtResource("3_e5cea")]
|
||||||
object = NodePath("..")
|
object = NodePath("..")
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
class_name AbstractCultist
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
const MAX_WALK_SPEED = 85
|
||||||
|
const MAX_CHASE_SPEED = 170
|
||||||
|
const ACCELERATION = 600.0
|
||||||
|
const JUMP_VELOCITY = 222.0
|
||||||
|
const JUMP_GRAVITY_FACTOR = 1.0
|
||||||
|
const FALL_GRAVITY_FACTOR = 1.5
|
||||||
|
|
||||||
|
|
||||||
|
var target_x := 0.0
|
||||||
|
|
||||||
|
|
||||||
|
@onready var sprite : AnimatedSprite2D = $CultistSprite
|
||||||
|
|
||||||
|
@onready var left_wall_high_ray : RayCast2D = $WallCheckHigh/LeftWallRay
|
||||||
|
@onready var right_wall_high_ray : RayCast2D = $WallCheckHigh/RightWallRay
|
||||||
|
|
||||||
|
@onready var left_wall_low_ray : RayCast2D = $WallCheckLow/LeftWallRay
|
||||||
|
@onready var right_wall_low_ray : RayCast2D = $WallCheckLow/RightWallRay
|
||||||
|
|
||||||
|
@onready var left_player_close_ray : RayCast2D = $%LeftPlayerCloseRay
|
||||||
|
@onready var right_player_close_ray : RayCast2D = $%RightPlayerCloseRay
|
||||||
|
|
||||||
|
@onready var left_player_distant_ray : RayCast2D = $%LeftPlayerDistantRay
|
||||||
|
@onready var right_player_distant_ray : RayCast2D = $%RightPlayerDistantRay
|
||||||
|
|
||||||
|
@onready var state_machine : CultistStateMachine = $CultistStateMachine
|
||||||
|
@onready var chase_left_state : CultistState = $CultistStateMachine/ChaseLeftState
|
||||||
|
@onready var chase_right_state : CultistState = $CultistStateMachine/ChaseRightState
|
||||||
|
@onready var look_around_state : CultistState = $CultistStateMachine/LookAroundState
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_set_ray_cast_enable(left_player_close_ray, false)
|
||||||
|
_set_ray_cast_enable(right_player_close_ray, false)
|
||||||
|
_set_ray_cast_enable(left_player_distant_ray, false)
|
||||||
|
_set_ray_cast_enable(right_player_distant_ray, false)
|
||||||
|
|
||||||
|
state_machine.init()
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
state_machine.physics_process(delta)
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
|
func update_x_velocity(direction: int, max_speed: float, delta: float) -> void:
|
||||||
|
velocity.x = move_toward(velocity.x, direction * max_speed, ACCELERATION * delta)
|
||||||
|
|
||||||
|
|
||||||
|
func get_gravity_factor() -> float:
|
||||||
|
return JUMP_GRAVITY_FACTOR if velocity.y < 0.0 else FALL_GRAVITY_FACTOR
|
||||||
|
|
||||||
|
|
||||||
|
func _set_ray_cast_enable(ray_cast: RayCast2D, enabled: bool) -> void:
|
||||||
|
ray_cast.process_mode = Node.PROCESS_MODE_INHERIT if enabled else Node.PROCESS_MODE_DISABLED
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
[gd_scene format=3 uid="uid://bx0luh4vdob3q"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://but5aeh7y1s0f" path="res://game/characters/enemies/abstract_cultist.gd" id="1_2wrno"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dtxiercm8dsfm" path="res://game/characters/enemies/cultist_sprite.tscn" id="2_tjvyk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dike8xgbqdut2" path="res://game/killing_area.tscn" id="3_tjvyk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bg7k6ovbk1xgm" path="res://game/characters/enemies/state_machine/cultist_state_machine.tscn" id="4_yu28k"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bq1v55jv4c6qe" path="res://game/characters/enemies/state_machine/cultist_state.tscn" id="5_tu2pi"]
|
||||||
|
[ext_resource type="Script" uid="uid://bqnq6m0s4etqh" path="res://game/characters/enemies/state_machine/fall_state.gd" id="7_7tkj8"]
|
||||||
|
[ext_resource type="Script" uid="uid://b8o0lvuy6a5q1" path="res://game/characters/enemies/state_machine/fall_left_state.gd" id="8_2opx4"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxg54u14yb6go" path="res://game/characters/enemies/state_machine/fall_right_state.gd" id="9_lu83c"]
|
||||||
|
[ext_resource type="Script" uid="uid://bfp8gywqqkju7" path="res://game/characters/enemies/state_machine/look_around_state.gd" id="10_lu83c"]
|
||||||
|
[ext_resource type="Script" uid="uid://hgn4yll571hp" path="res://game/characters/enemies/state_machine/walk_left_state.gd" id="11_lh753"]
|
||||||
|
[ext_resource type="Script" uid="uid://bwwhmjxhg2adp" path="res://game/characters/enemies/state_machine/walk_right_state.gd" id="12_lh753"]
|
||||||
|
[ext_resource type="Script" uid="uid://cn2lfl4kuxvjk" path="res://game/characters/enemies/state_machine/chase_left_state.gd" id="13_42ivi"]
|
||||||
|
[ext_resource type="Script" uid="uid://cqlym4lqahsd3" path="res://game/characters/enemies/state_machine/cultist_jump_left_state.gd" id="14_42ivi"]
|
||||||
|
[ext_resource type="Script" uid="uid://3kl84tu1vwiv" path="res://game/characters/enemies/state_machine/chase_right_state.gd" id="14_cqp7f"]
|
||||||
|
[ext_resource type="Script" uid="uid://cf52bjcpasft1" path="res://game/characters/enemies/state_machine/cultist_jump_right_state.gd" id="15_cqp7f"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_mocsw"]
|
||||||
|
radius = 4.0
|
||||||
|
height = 28.0
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_tjvyk"]
|
||||||
|
radius = 4.0
|
||||||
|
height = 28.0
|
||||||
|
|
||||||
|
[node name="AbstractCultist" type="CharacterBody2D" unique_id=1676614852]
|
||||||
|
collision_layer = 0
|
||||||
|
script = ExtResource("1_2wrno")
|
||||||
|
|
||||||
|
[node name="CultistSprite" parent="." unique_id=1997264413 instance=ExtResource("2_tjvyk")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=185651284]
|
||||||
|
position = Vector2(0, 2)
|
||||||
|
shape = SubResource("CapsuleShape2D_mocsw")
|
||||||
|
|
||||||
|
[node name="WallCheckHigh" type="Node2D" parent="." unique_id=1697845810]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
|
||||||
|
[node name="LeftWallRay" type="RayCast2D" parent="WallCheckHigh" unique_id=1026693538]
|
||||||
|
target_position = Vector2(-16, 0)
|
||||||
|
|
||||||
|
[node name="RightWallRay" type="RayCast2D" parent="WallCheckHigh" unique_id=1129233918]
|
||||||
|
target_position = Vector2(16, 0)
|
||||||
|
|
||||||
|
[node name="WallCheckLow" type="Node2D" parent="." unique_id=782156094]
|
||||||
|
position = Vector2(0, 9)
|
||||||
|
|
||||||
|
[node name="LeftWallRay" type="RayCast2D" parent="WallCheckLow" unique_id=521416854]
|
||||||
|
target_position = Vector2(-16, 0)
|
||||||
|
|
||||||
|
[node name="RightWallRay" type="RayCast2D" parent="WallCheckLow" unique_id=1457669135]
|
||||||
|
target_position = Vector2(16, 0)
|
||||||
|
|
||||||
|
[node name="PlayerCloseCheck" type="Node2D" parent="." unique_id=1593775088]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
|
||||||
|
[node name="LeftPlayerCloseRay" type="RayCast2D" parent="PlayerCloseCheck" unique_id=947570027]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
target_position = Vector2(-48, 0)
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="RightPlayerCloseRay" type="RayCast2D" parent="PlayerCloseCheck" unique_id=1559118218]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
target_position = Vector2(48, 0)
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="PlayerDistantCheck" type="Node2D" parent="." unique_id=1597489123]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
|
||||||
|
[node name="LeftPlayerDistantRay" type="RayCast2D" parent="PlayerDistantCheck" unique_id=1491085518]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
target_position = Vector2(-320, 0)
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="RightPlayerDistantRay" type="RayCast2D" parent="PlayerDistantCheck" unique_id=1377654831]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
target_position = Vector2(320, 0)
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="KillingArea" parent="." unique_id=1891922549 instance=ExtResource("3_tjvyk")]
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingArea" unique_id=1710758452]
|
||||||
|
position = Vector2(0, 2)
|
||||||
|
shape = SubResource("CapsuleShape2D_tjvyk")
|
||||||
|
|
||||||
|
[node name="CultistStateMachine" parent="." unique_id=633169960 node_paths=PackedStringArray("cultist", "initial_state") instance=ExtResource("4_yu28k")]
|
||||||
|
cultist = NodePath("..")
|
||||||
|
initial_state = NodePath("WalkLeftState")
|
||||||
|
|
||||||
|
[node name="FallState" parent="CultistStateMachine" unique_id=1764777802 node_paths=PackedStringArray("look_around_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("7_7tkj8")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="FallLeftState" parent="CultistStateMachine" unique_id=1011952297 node_paths=PackedStringArray("fall_state", "look_around_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("8_2opx4")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="FallRightState" parent="CultistStateMachine" unique_id=1932915544 node_paths=PackedStringArray("fall_state", "look_around_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("9_lu83c")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="LookAroundState" parent="CultistStateMachine" unique_id=2025927882 node_paths=PackedStringArray("fall_state", "walk_left_state", "walk_right_state", "chase_left_state", "chase_right_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("10_lu83c")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
chase_left_state = NodePath("../ChaseLeftState")
|
||||||
|
chase_right_state = NodePath("../ChaseRightState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="WalkLeftState" parent="CultistStateMachine" unique_id=276543931 node_paths=PackedStringArray("chase_state", "another_direction_walk_state", "fall_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("11_lh753")
|
||||||
|
chase_state = NodePath("../ChaseLeftState")
|
||||||
|
another_direction_walk_state = NodePath("../WalkRightState")
|
||||||
|
fall_state = NodePath("../FallLeftState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="WalkRightState" parent="CultistStateMachine" unique_id=1671686910 node_paths=PackedStringArray("chase_state", "another_direction_walk_state", "fall_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("12_lh753")
|
||||||
|
chase_state = NodePath("../ChaseRightState")
|
||||||
|
another_direction_walk_state = NodePath("../WalkLeftState")
|
||||||
|
fall_state = NodePath("../FallRightState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="ChaseLeftState" parent="CultistStateMachine" unique_id=209480830 node_paths=PackedStringArray("look_around_state", "jump_state", "fall_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("13_42ivi")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
jump_state = NodePath("../JumpLeftState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="ChaseRightState" parent="CultistStateMachine" unique_id=383038915 node_paths=PackedStringArray("look_around_state", "jump_state", "fall_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("14_cqp7f")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
jump_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="JumpLeftState" parent="CultistStateMachine" unique_id=739226464 node_paths=PackedStringArray("chase_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("14_42ivi")
|
||||||
|
chase_state = NodePath("../ChaseLeftState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="JumpRightState" parent="CultistStateMachine" unique_id=756126836 node_paths=PackedStringArray("chase_state", "cultist") instance=ExtResource("5_tu2pi")]
|
||||||
|
script = ExtResource("15_cqp7f")
|
||||||
|
chase_state = NodePath("../ChaseRightState")
|
||||||
|
cultist = NodePath("../..")
|
||||||
@@ -1,326 +0,0 @@
|
|||||||
class_name AbstractEnemy
|
|
||||||
extends CharacterBody2D
|
|
||||||
|
|
||||||
|
|
||||||
enum Type {
|
|
||||||
Standing,
|
|
||||||
Walking,
|
|
||||||
Random,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Facing {
|
|
||||||
Front,
|
|
||||||
Rear,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum State {
|
|
||||||
Idle,
|
|
||||||
WalkLeft,
|
|
||||||
WalkRight,
|
|
||||||
LookAround,
|
|
||||||
ChasingLeft,
|
|
||||||
ChasingRight,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const ANIMATION_FALL_DOWN = "fall_down"
|
|
||||||
const ANIMATION_FALL_DOWN_LEFT = "fall_down_left"
|
|
||||||
const ANIMATION_FALL_DOWN_RIGHT = "fall_down_right"
|
|
||||||
const ANIMATION_FALL_UP = "fall_up"
|
|
||||||
const ANIMATION_FALL_UP_LEFT = "fall_up_left"
|
|
||||||
const ANIMATION_FALL_UP_RIGHT = "fall_up_right"
|
|
||||||
const ANIMATION_IDLE_FRONT = "idle_front"
|
|
||||||
const ANIMATION_IDLE_REAR = "idle_rear"
|
|
||||||
const ANIMATION_LOOK_AROUND_FRONT_1 = "look_around_front_1"
|
|
||||||
const ANIMATION_LOOK_AROUND_FRONT_2 = "look_around_front_2"
|
|
||||||
const ANIMATION_LOOK_AROUND_REAR_1 = "look_around_rear_1"
|
|
||||||
const ANIMATION_LOOK_AROUND_REAR_2 = "look_around_rear_2"
|
|
||||||
const ANIMATION_WALK_LEFT = "walk_left"
|
|
||||||
const ANIMATION_WALK_RIGHT = "walk_right"
|
|
||||||
const ANIMATION_CHASE_LEFT = "chase_left"
|
|
||||||
const ANIMATION_CHASE_RIGHT = "chase_right"
|
|
||||||
|
|
||||||
const LOOK_AROUND_FRONT_ANIMATIONS : Array[String] = [
|
|
||||||
ANIMATION_LOOK_AROUND_FRONT_1,
|
|
||||||
ANIMATION_LOOK_AROUND_FRONT_2,
|
|
||||||
]
|
|
||||||
const LOOK_AROUND_REAR_ANIMATIONS : Array[String] = [
|
|
||||||
ANIMATION_LOOK_AROUND_REAR_1,
|
|
||||||
ANIMATION_LOOK_AROUND_REAR_2,
|
|
||||||
]
|
|
||||||
|
|
||||||
const MAX_WALK_SPEED = 85
|
|
||||||
const MAX_CHASE_SPEED = 170
|
|
||||||
const ACCELERATION = 600.0
|
|
||||||
const LOOK_AROUND_CHANCE = 25
|
|
||||||
const WALK_CHANCE = 25
|
|
||||||
|
|
||||||
const DIRECTION_LEFT = -1
|
|
||||||
const DIRECTION_RIGHT = 1
|
|
||||||
|
|
||||||
|
|
||||||
@export var type : Type = Type.Standing
|
|
||||||
@export var facing : Facing = Facing.Front
|
|
||||||
@export var initial_state : State = State.Idle
|
|
||||||
|
|
||||||
|
|
||||||
var _target_x := 0.0
|
|
||||||
var _target_found := false
|
|
||||||
|
|
||||||
|
|
||||||
var _state : State:
|
|
||||||
set = _set_state
|
|
||||||
|
|
||||||
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
|
||||||
|
|
||||||
@onready var left_wall_ray : RayCast2D = $%LeftWallRay
|
|
||||||
@onready var right_wall_ray : RayCast2D = $%RightWallRay
|
|
||||||
|
|
||||||
@onready var left_player_close_ray : RayCast2D = $%LeftPlayerCloseRay
|
|
||||||
@onready var right_player_close_ray : RayCast2D = $%RightPlayerCloseRay
|
|
||||||
|
|
||||||
@onready var left_player_distant_ray : RayCast2D = $%LeftPlayerDistantRay
|
|
||||||
@onready var right_player_distant_ray : RayCast2D = $%RightPlayerDistantRay
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
_state = initial_state
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
|
||||||
if not is_on_floor():
|
|
||||||
velocity += get_gravity() * delta
|
|
||||||
|
|
||||||
match _state:
|
|
||||||
State.ChasingLeft:
|
|
||||||
_process_player_ray(left_player_distant_ray)
|
|
||||||
if position.x < _target_x:
|
|
||||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_player_lost, global_position)
|
|
||||||
_state = State.LookAround
|
|
||||||
else:
|
|
||||||
_update_x_velocity(DIRECTION_LEFT, MAX_CHASE_SPEED, delta)
|
|
||||||
_check_wall_collision_and_switch_state(DIRECTION_LEFT)
|
|
||||||
State.ChasingRight:
|
|
||||||
_process_player_ray(right_player_distant_ray)
|
|
||||||
if position.x > _target_x:
|
|
||||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_player_lost, global_position)
|
|
||||||
_state = State.LookAround
|
|
||||||
else:
|
|
||||||
_update_x_velocity(DIRECTION_RIGHT, MAX_CHASE_SPEED, delta)
|
|
||||||
_check_wall_collision_and_switch_state(DIRECTION_RIGHT)
|
|
||||||
State.WalkLeft:
|
|
||||||
if _process_player_ray(left_player_distant_ray):
|
|
||||||
_set_chase_state()
|
|
||||||
_update_x_velocity(DIRECTION_LEFT, MAX_WALK_SPEED, delta)
|
|
||||||
_check_wall_collision_and_switch_state(DIRECTION_LEFT)
|
|
||||||
State.WalkRight:
|
|
||||||
if _process_player_ray(right_player_distant_ray):
|
|
||||||
_set_chase_state()
|
|
||||||
_update_x_velocity(DIRECTION_RIGHT, MAX_WALK_SPEED, delta)
|
|
||||||
_check_wall_collision_and_switch_state(DIRECTION_RIGHT)
|
|
||||||
State.LookAround:
|
|
||||||
_update_x_velocity(0, MAX_WALK_SPEED * 2, delta)
|
|
||||||
if not _target_found:
|
|
||||||
var close_rays : Array[RayCast2D] = [left_player_close_ray, right_player_close_ray]
|
|
||||||
_target_found = _process_player_rays(close_rays)
|
|
||||||
|
|
||||||
_update_animation()
|
|
||||||
|
|
||||||
move_and_slide()
|
|
||||||
|
|
||||||
|
|
||||||
func _set_state(value: State) -> void:
|
|
||||||
_state = value
|
|
||||||
|
|
||||||
left_player_close_ray.process_mode = Node.PROCESS_MODE_DISABLED
|
|
||||||
right_player_close_ray.process_mode = Node.PROCESS_MODE_DISABLED
|
|
||||||
left_player_distant_ray.process_mode = Node.PROCESS_MODE_DISABLED
|
|
||||||
right_player_distant_ray.process_mode = Node.PROCESS_MODE_DISABLED
|
|
||||||
left_player_close_ray.hide()
|
|
||||||
right_player_close_ray.hide()
|
|
||||||
left_player_distant_ray.hide()
|
|
||||||
right_player_distant_ray.hide()
|
|
||||||
|
|
||||||
match _state:
|
|
||||||
State.ChasingLeft, State.WalkLeft:
|
|
||||||
left_player_distant_ray.process_mode = Node.PROCESS_MODE_INHERIT
|
|
||||||
left_player_distant_ray.show()
|
|
||||||
State.ChasingRight, State.WalkRight:
|
|
||||||
right_player_distant_ray.process_mode = Node.PROCESS_MODE_INHERIT
|
|
||||||
right_player_distant_ray.show()
|
|
||||||
State.LookAround:
|
|
||||||
left_player_close_ray.process_mode = Node.PROCESS_MODE_INHERIT
|
|
||||||
right_player_close_ray.process_mode = Node.PROCESS_MODE_INHERIT
|
|
||||||
left_player_close_ray.show()
|
|
||||||
right_player_close_ray.show()
|
|
||||||
|
|
||||||
|
|
||||||
func _process_player_ray(ray: RayCast2D) -> bool:
|
|
||||||
if ray.is_colliding():
|
|
||||||
ray.force_raycast_update()
|
|
||||||
var collider := ray.get_collider()
|
|
||||||
if collider is Player:
|
|
||||||
_target_x = collider.position.x
|
|
||||||
return true
|
|
||||||
return false
|
|
||||||
|
|
||||||
|
|
||||||
func _process_player_rays(rays: Array[RayCast2D]) -> bool:
|
|
||||||
for ray in rays:
|
|
||||||
if _process_player_ray(ray):
|
|
||||||
return true
|
|
||||||
return false
|
|
||||||
|
|
||||||
|
|
||||||
func _update_x_velocity(direction: int, max_speed: float, delta: float) -> void:
|
|
||||||
velocity.x = move_toward(velocity.x, direction * max_speed, ACCELERATION * delta)
|
|
||||||
|
|
||||||
|
|
||||||
func _check_wall_collision_and_switch_state(direction: int) -> void:
|
|
||||||
var this_wall_ray := _get_wall_ray(direction)
|
|
||||||
var other_wall_ray := _get_wall_ray(-direction)
|
|
||||||
|
|
||||||
if this_wall_ray.is_colliding():
|
|
||||||
if other_wall_ray.is_colliding():
|
|
||||||
_state = State.LookAround
|
|
||||||
else:
|
|
||||||
match _state:
|
|
||||||
State.WalkLeft:
|
|
||||||
_state = State.WalkRight
|
|
||||||
State.WalkRight:
|
|
||||||
_state = State.WalkLeft
|
|
||||||
State.ChasingLeft, State.ChasingRight:
|
|
||||||
var stream := SoundManager.sfx_stream_player_lost
|
|
||||||
SoundManager.play_sfx_stream(stream, global_position)
|
|
||||||
_state = State.LookAround
|
|
||||||
|
|
||||||
|
|
||||||
func _get_wall_ray(direction: int) -> RayCast2D:
|
|
||||||
if direction < 0:
|
|
||||||
return left_wall_ray
|
|
||||||
else:
|
|
||||||
return right_wall_ray
|
|
||||||
|
|
||||||
|
|
||||||
func _update_animation() -> void:
|
|
||||||
if is_zero_approx(velocity.y):
|
|
||||||
match _state:
|
|
||||||
State.WalkLeft:
|
|
||||||
_play_animation(ANIMATION_WALK_LEFT)
|
|
||||||
State.WalkRight:
|
|
||||||
_play_animation(ANIMATION_WALK_RIGHT)
|
|
||||||
State.ChasingLeft:
|
|
||||||
_play_animation(ANIMATION_CHASE_LEFT)
|
|
||||||
State.ChasingRight:
|
|
||||||
_play_animation(ANIMATION_CHASE_RIGHT)
|
|
||||||
State.Idle:
|
|
||||||
_play_idle_animation()
|
|
||||||
State.LookAround:
|
|
||||||
_play_look_around_animation()
|
|
||||||
else:
|
|
||||||
_play_fall_animation()
|
|
||||||
|
|
||||||
|
|
||||||
func _play_idle_animation() -> void:
|
|
||||||
match facing:
|
|
||||||
Facing.Front:
|
|
||||||
_play_animation(ANIMATION_IDLE_FRONT)
|
|
||||||
Facing.Rear:
|
|
||||||
_play_animation(ANIMATION_IDLE_REAR)
|
|
||||||
|
|
||||||
|
|
||||||
func _play_look_around_animation() -> void:
|
|
||||||
if _is_current_animation_look_around(): return
|
|
||||||
|
|
||||||
match facing:
|
|
||||||
Facing.Front:
|
|
||||||
var animation := _get_random_animation(LOOK_AROUND_FRONT_ANIMATIONS)
|
|
||||||
_play_animation(animation)
|
|
||||||
Facing.Rear:
|
|
||||||
var animation := _get_random_animation(LOOK_AROUND_REAR_ANIMATIONS)
|
|
||||||
_play_animation(animation)
|
|
||||||
|
|
||||||
|
|
||||||
func _play_fall_animation() -> void:
|
|
||||||
if is_zero_approx(velocity.x):
|
|
||||||
var animation := ANIMATION_FALL_UP if velocity.y < 0 else ANIMATION_FALL_DOWN
|
|
||||||
_play_animation(animation)
|
|
||||||
elif velocity.x < 0:
|
|
||||||
var animation := ANIMATION_FALL_UP_LEFT if velocity.y < 0 else ANIMATION_FALL_DOWN_LEFT
|
|
||||||
_play_animation(animation)
|
|
||||||
else:
|
|
||||||
var animation := ANIMATION_FALL_UP_RIGHT if velocity.y < 0 else ANIMATION_FALL_DOWN_RIGHT
|
|
||||||
_play_animation(animation)
|
|
||||||
|
|
||||||
|
|
||||||
func _is_current_animation_look_around() -> bool:
|
|
||||||
if not sprite.is_playing(): return false
|
|
||||||
if sprite.animation in LOOK_AROUND_FRONT_ANIMATIONS: return true
|
|
||||||
if sprite.animation in LOOK_AROUND_REAR_ANIMATIONS: return true
|
|
||||||
return false
|
|
||||||
|
|
||||||
|
|
||||||
func _get_random_animation(animations: Array[String]) -> String:
|
|
||||||
var index := randi_range(0, animations.size() - 1)
|
|
||||||
return animations[index]
|
|
||||||
|
|
||||||
|
|
||||||
func _play_animation(animation: String) -> void:
|
|
||||||
if not sprite.is_playing() or sprite.animation != animation:
|
|
||||||
sprite.play(animation)
|
|
||||||
|
|
||||||
|
|
||||||
func _set_walking_state() -> void:
|
|
||||||
var is_left_colliding := left_wall_ray.is_colliding()
|
|
||||||
var is_right_colliding := right_wall_ray.is_colliding()
|
|
||||||
|
|
||||||
if is_left_colliding and is_right_colliding:
|
|
||||||
_state = State.Idle
|
|
||||||
elif not is_left_colliding and not is_right_colliding:
|
|
||||||
_state = State.WalkLeft if randi_range(1, 2) == 1 else State.WalkRight
|
|
||||||
elif not is_left_colliding:
|
|
||||||
_state = State.WalkLeft
|
|
||||||
else:
|
|
||||||
_state = State.WalkRight
|
|
||||||
|
|
||||||
|
|
||||||
func _set_chase_state() -> void:
|
|
||||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_player_spoted, global_position)
|
|
||||||
if _target_x < position.x:
|
|
||||||
_state = State.ChasingLeft
|
|
||||||
else:
|
|
||||||
_state = State.ChasingRight
|
|
||||||
|
|
||||||
|
|
||||||
func _is_walking_state() -> bool:
|
|
||||||
return _state == State.WalkLeft or _state == State.WalkRight
|
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_finished() -> void:
|
|
||||||
if _target_found:
|
|
||||||
_set_chase_state()
|
|
||||||
_target_found = false
|
|
||||||
return
|
|
||||||
|
|
||||||
match type:
|
|
||||||
Type.Standing:
|
|
||||||
_state = State.Idle
|
|
||||||
Type.Walking:
|
|
||||||
_set_walking_state()
|
|
||||||
Type.Random:
|
|
||||||
if randi_range(1, 100) <= WALK_CHANCE:
|
|
||||||
_set_walking_state()
|
|
||||||
else:
|
|
||||||
_state = State.Idle
|
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_looped() -> void:
|
|
||||||
if _state == State.Idle or (type == Type.Random and _is_walking_state()):
|
|
||||||
if randi_range(1, 100) <= LOOK_AROUND_CHANCE:
|
|
||||||
_state = State.LookAround
|
|
||||||
|
|
||||||
|
|
||||||
func _on_player_touch_area_entered(body: Node2D) -> void:
|
|
||||||
if body is Player:
|
|
||||||
_target_x = body.position.x
|
|
||||||
_set_chase_state()
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://bx0luh4vdob3q"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://but5aeh7y1s0f" path="res://game/characters/enemies/abstract_enemy.gd" id="1_2wrno"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dtxiercm8dsfm" path="res://game/characters/enemies/enemy_sprite.tscn" id="2_tjvyk"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dike8xgbqdut2" path="res://game/killing_area.tscn" id="3_tjvyk"]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_mocsw"]
|
|
||||||
radius = 4.0
|
|
||||||
height = 28.0
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vecdo"]
|
|
||||||
size = Vector2(32, 28)
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_tjvyk"]
|
|
||||||
radius = 4.0
|
|
||||||
height = 28.0
|
|
||||||
|
|
||||||
[node name="AbstractEnemy" type="CharacterBody2D" unique_id=1676614852]
|
|
||||||
collision_layer = 0
|
|
||||||
script = ExtResource("1_2wrno")
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." unique_id=1997264413 instance=ExtResource("2_tjvyk")]
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=185651284]
|
|
||||||
position = Vector2(0, 2)
|
|
||||||
shape = SubResource("CapsuleShape2D_mocsw")
|
|
||||||
|
|
||||||
[node name="WallCheck" type="Node2D" parent="." unique_id=782156094]
|
|
||||||
position = Vector2(0, 9)
|
|
||||||
|
|
||||||
[node name="LeftWallRay" type="RayCast2D" parent="WallCheck" unique_id=521416854]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(-16, 0)
|
|
||||||
|
|
||||||
[node name="RightWallRay" type="RayCast2D" parent="WallCheck" unique_id=1457669135]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(16, 0)
|
|
||||||
|
|
||||||
[node name="PlayerCloseCheck" type="Node2D" parent="." unique_id=1593775088]
|
|
||||||
position = Vector2(0, 9)
|
|
||||||
|
|
||||||
[node name="LeftPlayerCloseRay" type="RayCast2D" parent="PlayerCloseCheck" unique_id=947570027]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(-48, 0)
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="RightPlayerCloseRay" type="RayCast2D" parent="PlayerCloseCheck" unique_id=1559118218]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(48, 0)
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="PlayerDistantCheck" type="Node2D" parent="." unique_id=1597489123]
|
|
||||||
position = Vector2(0, 9)
|
|
||||||
|
|
||||||
[node name="LeftPlayerDistantRay" type="RayCast2D" parent="PlayerDistantCheck" unique_id=1491085518]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(-320, 0)
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="RightPlayerDistantRay" type="RayCast2D" parent="PlayerDistantCheck" unique_id=1377654831]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
target_position = Vector2(320, 0)
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="PlayerTouchArea" type="Area2D" parent="." unique_id=2147163970]
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerTouchArea" unique_id=262478897]
|
|
||||||
position = Vector2(0, 2)
|
|
||||||
shape = SubResource("RectangleShape2D_vecdo")
|
|
||||||
|
|
||||||
[node name="KillingArea" parent="." unique_id=1891922549 instance=ExtResource("3_tjvyk")]
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KillingArea" unique_id=1710758452]
|
|
||||||
position = Vector2(0, 2)
|
|
||||||
shape = SubResource("CapsuleShape2D_tjvyk")
|
|
||||||
|
|
||||||
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
|
|
||||||
[connection signal="animation_looped" from="AnimatedSprite2D" to="." method="_on_animation_looped"]
|
|
||||||
[connection signal="body_entered" from="PlayerTouchArea" to="." method="_on_player_touch_area_entered"]
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
class_name BlackCultist
|
||||||
|
extends AbstractColorCultist
|
||||||
+8
-11
@@ -1,10 +1,10 @@
|
|||||||
[gd_scene format=3 uid="uid://cutjutvd8dqqc"]
|
[gd_scene format=3 uid="uid://cutjutvd8dqqc"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://d37eyum03h83i" path="res://game/characters/enemies/abstract_color_enemy.tscn" id="1_gj2ks"]
|
[ext_resource type="PackedScene" uid="uid://d37eyum03h83i" path="res://game/characters/enemies/abstract_color_cultist.tscn" id="1_gj2ks"]
|
||||||
[ext_resource type="Script" uid="uid://c2knsjcp6faf6" path="res://game/characters/enemies/black_enemy.gd" id="2_332ds"]
|
[ext_resource type="Script" uid="uid://c2knsjcp6faf6" path="res://game/characters/enemies/black_cultist.gd" id="2_332ds"]
|
||||||
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_3jy5n"]
|
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_3jy5n"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0u0ii"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v1if5"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource("3_3jy5n")
|
shader = ExtResource("3_3jy5n")
|
||||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||||
@@ -15,15 +15,15 @@ shader_parameter/speed = 5.0
|
|||||||
shader_parameter/intensity = 1.0
|
shader_parameter/intensity = 1.0
|
||||||
shader_parameter/scale = 20.0
|
shader_parameter/scale = 20.0
|
||||||
|
|
||||||
[node name="BlackEnemy" unique_id=1910124567 instance=ExtResource("1_gj2ks")]
|
[node name="BlackCultist" unique_id=1910124567 instance=ExtResource("1_gj2ks")]
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
script = ExtResource("2_332ds")
|
script = ExtResource("2_332ds")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." index="0" unique_id=1997264413]
|
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||||
material = SubResource("ShaderMaterial_0u0ii")
|
material = SubResource("ShaderMaterial_v1if5")
|
||||||
|
|
||||||
[node name="CollisionSwitcher" parent="." index="2"]
|
[node name="CollisionSwitcher" parent="." index="2" unique_id=991274552]
|
||||||
initial_state = 0
|
initial_state = 0
|
||||||
|
|
||||||
[node name="LeftWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
[node name="LeftWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
||||||
@@ -46,8 +46,5 @@ collision_mask = 11
|
|||||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||||
collision_mask = 11
|
collision_mask = 11
|
||||||
|
|
||||||
[node name="PlayerTouchArea" parent="." index="6" unique_id=2147163970]
|
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||||
collision_mask = 8
|
|
||||||
|
|
||||||
[node name="KillingArea" parent="." index="7" unique_id=1891922549]
|
|
||||||
collision_mask = 8
|
collision_mask = 8
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
class_name BlackEnemy
|
|
||||||
extends AbstractColorEnemy
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
class_name CultistSprite
|
||||||
|
extends AnimatedSprite2D
|
||||||
|
|
||||||
|
|
||||||
|
const ANIMATION_FALL = "fall"
|
||||||
|
const ANIMATION_FALL_LEFT = "fall_left"
|
||||||
|
const ANIMATION_FALL_RIGHT = "fall_right"
|
||||||
|
const ANIMATION_JUMP = "jump"
|
||||||
|
const ANIMATION_JUMP_LEFT = "jump_left"
|
||||||
|
const ANIMATION_JUMP_RIGHT = "jump_right"
|
||||||
|
const ANIMATION_IDLE = "idle"
|
||||||
|
const ANIMATION_LOOK_AROUND = "look_around"
|
||||||
|
const ANIMATION_LOOK_AROUND_1 = "look_around_1"
|
||||||
|
const ANIMATION_LOOK_AROUND_2 = "look_around_2"
|
||||||
|
const ANIMATION_WALK_LEFT = "walk_left"
|
||||||
|
const ANIMATION_WALK_RIGHT = "walk_right"
|
||||||
|
const ANIMATION_CHASE_LEFT = "chase_left"
|
||||||
|
const ANIMATION_CHASE_RIGHT = "chase_right"
|
||||||
|
|
||||||
|
const LOOK_AROUND_ANIMATIONS : Array[String] = [
|
||||||
|
ANIMATION_LOOK_AROUND_1,
|
||||||
|
ANIMATION_LOOK_AROUND_2,
|
||||||
|
]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dkxmwkjttbf2d
|
||||||
+91
-151
@@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=47 format=3 uid="uid://dtxiercm8dsfm"]
|
[gd_scene format=3 uid="uid://dtxiercm8dsfm"]
|
||||||
|
|
||||||
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="1_b6aoy"]
|
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="1_ew6gn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://drk8j57acajrq" path="res://images/characters/cultist.png" id="2_yjsd7"]
|
[ext_resource type="Texture2D" uid="uid://drk8j57acajrq" path="res://images/characters/cultist.png" id="2_g4n4l"]
|
||||||
|
[ext_resource type="Script" uid="uid://dkxmwkjttbf2d" path="res://game/characters/enemies/cultist_sprite.gd" id="3_ef0vi"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vecdo"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vecdo"]
|
||||||
shader = ExtResource("1_b6aoy")
|
shader = ExtResource("1_ew6gn")
|
||||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||||
shader_parameter/switch_colors = false
|
shader_parameter/switch_colors = false
|
||||||
@@ -14,173 +15,141 @@ shader_parameter/intensity = 1.0
|
|||||||
shader_parameter/scale = 20.0
|
shader_parameter/scale = 20.0
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_l58xb"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_l58xb"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 64, 32, 32)
|
region = Rect2(0, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jrclg"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jrclg"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(32, 64, 32, 32)
|
region = Rect2(32, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwee"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwee"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 64, 32, 32)
|
region = Rect2(64, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_law7y"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_law7y"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(96, 64, 32, 32)
|
region = Rect2(96, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hme24"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hme24"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(128, 64, 32, 32)
|
region = Rect2(128, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qawtf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qawtf"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(160, 64, 32, 32)
|
region = Rect2(160, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_srxh4"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_srxh4"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(192, 64, 32, 32)
|
region = Rect2(192, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x6npu"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_x6npu"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(224, 64, 32, 32)
|
region = Rect2(224, 64, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xavx3"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xavx3"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 32, 32, 32)
|
region = Rect2(0, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8t4m8"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8t4m8"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(32, 32, 32, 32)
|
region = Rect2(32, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3seah"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3seah"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 32, 32, 32)
|
region = Rect2(64, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_koyeg"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_koyeg"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(96, 32, 32, 32)
|
region = Rect2(96, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uw3v1"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_uw3v1"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(128, 32, 32, 32)
|
region = Rect2(128, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_265lf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_265lf"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(160, 32, 32, 32)
|
region = Rect2(160, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tav7c"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tav7c"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(192, 32, 32, 32)
|
region = Rect2(192, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0xs27"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0xs27"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(224, 32, 32, 32)
|
region = Rect2(224, 32, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tjvyk"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tjvyk"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(128, 96, 32, 32)
|
region = Rect2(128, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vecdo"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vecdo"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 96, 32, 32)
|
region = Rect2(64, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qly8p"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qly8p"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 96, 32, 32)
|
region = Rect2(0, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_klrad"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(160, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rjy0i"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(96, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ps2ar"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(32, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ijx3p"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ijx3p"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nm8xp"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_nm8xp"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(32, 0, 32, 32)
|
region = Rect2(32, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mocsw"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_klrad"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(128, 0, 32, 32)
|
region = Rect2(160, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y256a"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rjy0i"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(160, 0, 32, 32)
|
region = Rect2(96, 96, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ps2ar"]
|
||||||
|
atlas = ExtResource("2_g4n4l")
|
||||||
|
region = Rect2(32, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yjsd7"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_yjsd7"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 0, 32, 32)
|
region = Rect2(64, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b6aoy"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_b6aoy"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_voddl"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_voddl"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(96, 0, 32, 32)
|
region = Rect2(96, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_soo8x"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_soo8x"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vbirv"]
|
||||||
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8wpvf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8wpvf"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 0, 32, 32)
|
region = Rect2(64, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vbirv"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(0, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ntvg2"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ntvg2"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(96, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ssc8d"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(96, 0, 32, 32)
|
region = Rect2(96, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hrljr"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hrljr"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ssc8d"]
|
||||||
|
atlas = ExtResource("2_g4n4l")
|
||||||
|
region = Rect2(96, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ng7ok"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ng7ok"]
|
||||||
atlas = ExtResource("2_yjsd7")
|
atlas = ExtResource("2_g4n4l")
|
||||||
region = Rect2(64, 0, 32, 32)
|
region = Rect2(64, 0, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8s45y"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(192, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qbqct"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(128, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ga5mk"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(224, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yu2nn"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(224, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g4v8m"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(128, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_20lqo"]
|
|
||||||
atlas = ExtResource("2_yjsd7")
|
|
||||||
region = Rect2(192, 0, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_2wrno"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_2wrno"]
|
||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -246,7 +215,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_tjvyk")
|
"texture": SubResource("AtlasTexture_tjvyk")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down",
|
"name": &"fall",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -254,7 +223,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_vecdo")
|
"texture": SubResource("AtlasTexture_vecdo")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down_left",
|
"name": &"fall_left",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -262,31 +231,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_qly8p")
|
"texture": SubResource("AtlasTexture_qly8p")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down_right",
|
"name": &"fall_right",
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 5.0,
|
|
||||||
"texture": SubResource("AtlasTexture_klrad")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 5.0,
|
|
||||||
"texture": SubResource("AtlasTexture_rjy0i")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up_left",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 5.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ps2ar")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up_right",
|
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -300,21 +245,31 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_ijx3p")
|
"texture": SubResource("AtlasTexture_ijx3p")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"idle_front",
|
"name": &"idle",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 4.0,
|
|
||||||
"texture": SubResource("AtlasTexture_mocsw")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_y256a")
|
|
||||||
}, {
|
|
||||||
"duration": 5.0,
|
"duration": 5.0,
|
||||||
"texture": SubResource("AtlasTexture_mocsw")
|
"texture": SubResource("AtlasTexture_klrad")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"idle_rear",
|
"name": &"jump",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 5.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rjy0i")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump_left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 5.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ps2ar")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump_right",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -336,6 +291,9 @@ animations = [{
|
|||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vbirv")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_8wpvf")
|
"texture": SubResource("AtlasTexture_8wpvf")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -343,13 +301,19 @@ animations = [{
|
|||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ntvg2")
|
"texture": SubResource("AtlasTexture_ntvg2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vbirv")
|
||||||
}],
|
}],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": &"look_around_front_1",
|
"name": &"look_around_1",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_hrljr")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ssc8d")
|
"texture": SubResource("AtlasTexture_ssc8d")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -357,37 +321,12 @@ animations = [{
|
|||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ng7ok")
|
"texture": SubResource("AtlasTexture_ng7ok")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_hrljr")
|
||||||
}],
|
}],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": &"look_around_front_2",
|
"name": &"look_around_2",
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_8s45y")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_qbqct")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ga5mk")
|
|
||||||
}],
|
|
||||||
"loop": false,
|
|
||||||
"name": &"look_around_rear_1",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_yu2nn")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_g4v8m")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_20lqo")
|
|
||||||
}],
|
|
||||||
"loop": false,
|
|
||||||
"name": &"look_around_rear_2",
|
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -449,7 +388,8 @@ animations = [{
|
|||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D"]
|
[node name="CultistSprite" type="AnimatedSprite2D" unique_id=351120861]
|
||||||
material = SubResource("ShaderMaterial_vecdo")
|
material = SubResource("ShaderMaterial_vecdo")
|
||||||
sprite_frames = SubResource("SpriteFrames_2wrno")
|
sprite_frames = SubResource("SpriteFrames_2wrno")
|
||||||
animation = &"look_around"
|
animation = &"idle"
|
||||||
|
script = ExtResource("3_ef0vi")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
class_name GrayCultist
|
||||||
|
extends AbstractCultist
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
[gd_scene format=3 uid="uid://cb0w6mt8g4mer"]
|
[gd_scene format=3 uid="uid://cb0w6mt8g4mer"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bx0luh4vdob3q" path="res://game/characters/enemies/abstract_enemy.tscn" id="1_q3s46"]
|
[ext_resource type="PackedScene" uid="uid://bx0luh4vdob3q" path="res://game/characters/enemies/abstract_cultist.tscn" id="1_q3s46"]
|
||||||
[ext_resource type="Script" uid="uid://cern5veiqkrkc" path="res://game/characters/enemies/gray_enemy.gd" id="2_olede"]
|
[ext_resource type="Script" uid="uid://cern5veiqkrkc" path="res://game/characters/enemies/gray_cultist.gd" id="2_olede"]
|
||||||
[ext_resource type="Material" uid="uid://dbkn3k0batj5w" path="res://game/materials/enemy_gray.tres" id="3_ho47d"]
|
[ext_resource type="Material" uid="uid://dbkn3k0batj5w" path="res://game/materials/enemy_gray.tres" id="3_ho47d"]
|
||||||
|
|
||||||
[node name="GrayEnemy" unique_id=139812221 instance=ExtResource("1_q3s46")]
|
[node name="GrayCultist" unique_id=139812221 instance=ExtResource("1_q3s46")]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 35
|
collision_mask = 35
|
||||||
script = ExtResource("2_olede")
|
script = ExtResource("2_olede")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." index="0" unique_id=1997264413]
|
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||||
material = ExtResource("3_ho47d")
|
material = ExtResource("3_ho47d")
|
||||||
|
|
||||||
[node name="LeftWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
[node name="LeftWallRay" parent="WallCheckLow" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
||||||
collision_mask = 35
|
collision_mask = 35
|
||||||
|
|
||||||
[node name="RightWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="1" unique_id=1457669135]
|
[node name="RightWallRay" parent="WallCheckLow" parent_id_path=PackedInt32Array(782156094) index="1" unique_id=1457669135]
|
||||||
collision_mask = 35
|
collision_mask = 35
|
||||||
|
|
||||||
[node name="LeftPlayerCloseRay" parent="PlayerCloseCheck" parent_id_path=PackedInt32Array(1593775088) index="0" unique_id=947570027]
|
[node name="LeftPlayerCloseRay" parent="PlayerCloseCheck" parent_id_path=PackedInt32Array(1593775088) index="0" unique_id=947570027]
|
||||||
@@ -30,8 +30,5 @@ collision_mask = 171
|
|||||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||||
collision_mask = 171
|
collision_mask = 171
|
||||||
|
|
||||||
[node name="PlayerTouchArea" parent="." index="5" unique_id=2147163970]
|
|
||||||
collision_mask = 136
|
|
||||||
|
|
||||||
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||||
collision_mask = 136
|
collision_mask = 136
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
class_name GrayEnemy
|
|
||||||
extends AbstractEnemy
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
extends CultistChaseState
|
||||||
|
|
||||||
|
|
||||||
|
func init() -> void:
|
||||||
|
_direction = DIRECTION_LEFT
|
||||||
|
_wall_high_ray_cast = cultist.left_wall_high_ray
|
||||||
|
_wall_low_ray_cast = cultist.left_wall_low_ray
|
||||||
|
_player_ray_cast = cultist.left_player_distant_ray
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_CHASE_LEFT)
|
||||||
|
|
||||||
|
|
||||||
|
func _is_target_reached() -> bool:
|
||||||
|
return cultist.position.x <= cultist.target_x
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cn2lfl4kuxvjk
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
extends CultistChaseState
|
||||||
|
|
||||||
|
|
||||||
|
func init() -> void:
|
||||||
|
_direction = DIRECTION_RIGHT
|
||||||
|
_wall_high_ray_cast = cultist.right_wall_high_ray
|
||||||
|
_wall_low_ray_cast = cultist.right_wall_low_ray
|
||||||
|
_player_ray_cast = cultist.right_player_distant_ray
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_CHASE_RIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
func _is_target_reached() -> bool:
|
||||||
|
return cultist.position.x >= cultist.target_x
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://3kl84tu1vwiv
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
@abstract
|
||||||
|
class_name CultistChaseState
|
||||||
|
extends CultistMoveState
|
||||||
|
|
||||||
|
|
||||||
|
@export var look_around_state: CultistState
|
||||||
|
@export var jump_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(delta: float) -> void:
|
||||||
|
if not cultist.is_on_floor():
|
||||||
|
switch_state.emit(fall_state)
|
||||||
|
else:
|
||||||
|
var player := _get_colliding_player(_player_ray_cast)
|
||||||
|
if player != null:
|
||||||
|
cultist.target_x = player.position.x
|
||||||
|
|
||||||
|
if _is_target_reached() or _wall_high_ray_cast.is_colliding():
|
||||||
|
switch_state.emit(look_around_state)
|
||||||
|
elif _wall_low_ray_cast.is_colliding():
|
||||||
|
switch_state.emit(jump_state)
|
||||||
|
else:
|
||||||
|
cultist.update_x_velocity(_direction, cultist.MAX_CHASE_SPEED, delta)
|
||||||
|
|
||||||
|
|
||||||
|
@abstract
|
||||||
|
func _is_target_reached() -> bool
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://beu06w0gntfay
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
extends CultistJumpState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
super.enter()
|
||||||
|
_direction = DIRECTION_LEFT
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_JUMP_LEFT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cqlym4lqahsd3
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
extends CultistJumpState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
super.enter()
|
||||||
|
_direction = DIRECTION_RIGHT
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_JUMP_RIGHT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cf52bjcpasft1
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class_name CultistState
|
||||||
|
extends AbstractState
|
||||||
|
|
||||||
|
|
||||||
|
const DIRECTION_LEFT = -1
|
||||||
|
const DIRECTION_RIGHT = 1
|
||||||
|
|
||||||
|
|
||||||
|
@export var cultist: AbstractCultist
|
||||||
|
|
||||||
|
|
||||||
|
func _get_colliding_player(ray_cast: RayCast2D) -> Player:
|
||||||
|
ray_cast.force_raycast_update()
|
||||||
|
|
||||||
|
if ray_cast.is_colliding():
|
||||||
|
var collider := ray_cast.get_collider()
|
||||||
|
if collider is Player:
|
||||||
|
return collider
|
||||||
|
return null
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c2et1lt2xgk45
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene format=3 uid="uid://bq1v55jv4c6qe"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c7adrbfobmvl8" path="res://game/state_machine/abstract_state.tscn" id="1_qehp8"]
|
||||||
|
[ext_resource type="Script" uid="uid://c2et1lt2xgk45" path="res://game/characters/enemies/state_machine/cultist_state.gd" id="2_3mu4s"]
|
||||||
|
|
||||||
|
[node name="CultistState" unique_id=739226464 instance=ExtResource("1_qehp8")]
|
||||||
|
script = ExtResource("2_3mu4s")
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class_name CultistStateMachine
|
||||||
|
extends StateMachine
|
||||||
|
|
||||||
|
|
||||||
|
@export var cultist: AbstractCultist
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dhaq52d5t5eq0
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene format=3 uid="uid://bg7k6ovbk1xgm"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://3ll3i1fgktg2" path="res://game/state_machine/state_machine.tscn" id="1_xnlud"]
|
||||||
|
[ext_resource type="Script" uid="uid://dhaq52d5t5eq0" path="res://game/characters/enemies/state_machine/cultist_state_machine.gd" id="2_avauf"]
|
||||||
|
|
||||||
|
[node name="CultistStateMachine" unique_id=633169960 instance=ExtResource("1_xnlud")]
|
||||||
|
script = ExtResource("2_avauf")
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
extends CultistFallSidewaysState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_FALL_LEFT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://b8o0lvuy6a5q1
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
extends CultistFallSidewaysState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_FALL_RIGHT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cxg54u14yb6go
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class_name CultistFallSidewaysState
|
||||||
|
extends CultistFallState
|
||||||
|
|
||||||
|
|
||||||
|
@export var fall_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(delta: float) -> void:
|
||||||
|
var is_on_floor := _move_down_and_check_floor(delta)
|
||||||
|
if not is_on_floor and is_zero_approx(cultist.velocity.x):
|
||||||
|
switch_state.emit(fall_state)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dknrtf0f5wgnr
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
class_name CultistFallState
|
||||||
|
extends CultistState
|
||||||
|
|
||||||
|
|
||||||
|
@export var look_around_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_FALL)
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(delta: float) -> void:
|
||||||
|
_move_down_and_check_floor(delta)
|
||||||
|
|
||||||
|
|
||||||
|
func _move_down_and_check_floor(delta: float) -> bool:
|
||||||
|
cultist.velocity += cultist.get_gravity() * delta
|
||||||
|
cultist.move_and_slide()
|
||||||
|
if cultist.is_on_floor():
|
||||||
|
switch_state.emit(look_around_state)
|
||||||
|
return true
|
||||||
|
return false
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bqnq6m0s4etqh
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
@abstract
|
||||||
|
class_name CultistJumpState
|
||||||
|
extends CultistState
|
||||||
|
|
||||||
|
|
||||||
|
@export var chase_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
var _direction := 0
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.velocity.y -= cultist.JUMP_VELOCITY
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(delta: float) -> void:
|
||||||
|
if cultist.is_on_floor():
|
||||||
|
switch_state.emit(chase_state)
|
||||||
|
else:
|
||||||
|
cultist.velocity += cultist.get_gravity() * cultist.get_gravity_factor() * delta
|
||||||
|
cultist.update_x_velocity(_direction, cultist.MAX_WALK_SPEED, delta)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cxvl7a8o7bc1p
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
extends CultistState
|
||||||
|
|
||||||
|
|
||||||
|
@export var fall_state: CultistState
|
||||||
|
@export var walk_left_state: CultistState
|
||||||
|
@export var walk_right_state: CultistState
|
||||||
|
@export var chase_left_state: CultistState
|
||||||
|
@export var chase_right_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
var state_by_ray_cast : Dictionary[RayCast2D, CultistState]
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.animation_finished.connect(_on_animation_finished)
|
||||||
|
cultist.sprite.play(CultistSprite.LOOK_AROUND_ANIMATIONS.pick_random())
|
||||||
|
cultist.velocity = Vector2.ZERO
|
||||||
|
cultist._set_ray_cast_enable(cultist.left_player_close_ray, true)
|
||||||
|
cultist._set_ray_cast_enable(cultist.right_player_close_ray, true)
|
||||||
|
|
||||||
|
state_by_ray_cast = {
|
||||||
|
cultist.left_player_close_ray: chase_left_state,
|
||||||
|
cultist.right_player_close_ray: chase_right_state,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(_delta: float) -> void:
|
||||||
|
if not cultist.is_on_floor():
|
||||||
|
switch_state.emit(fall_state)
|
||||||
|
else:
|
||||||
|
for ray_cast in state_by_ray_cast:
|
||||||
|
var player := _get_colliding_player(ray_cast)
|
||||||
|
if player != null:
|
||||||
|
switch_state.emit(state_by_ray_cast[ray_cast])
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
cultist.sprite.animation_finished.disconnect(_on_animation_finished)
|
||||||
|
cultist._set_ray_cast_enable(cultist.left_player_close_ray, false)
|
||||||
|
cultist._set_ray_cast_enable(cultist.right_player_close_ray, false)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animation_finished() -> void:
|
||||||
|
switch_state.emit([walk_left_state, walk_right_state].pick_random())
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bfp8gywqqkju7
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
@abstract
|
||||||
|
class_name CultistMoveState
|
||||||
|
extends CultistState
|
||||||
|
|
||||||
|
|
||||||
|
@export var fall_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
@warning_ignore("unused_private_class_variable")
|
||||||
|
var _direction := 0
|
||||||
|
@warning_ignore("unused_private_class_variable")
|
||||||
|
var _wall_high_ray_cast : RayCast2D
|
||||||
|
@warning_ignore("unused_private_class_variable")
|
||||||
|
var _wall_low_ray_cast : RayCast2D
|
||||||
|
var _player_ray_cast : RayCast2D
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist._set_ray_cast_enable(_player_ray_cast, true)
|
||||||
|
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
cultist._set_ray_cast_enable(_player_ray_cast, false)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cw5hhiv8uih7d
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
extends CultistWalkState
|
||||||
|
|
||||||
|
|
||||||
|
func init() -> void:
|
||||||
|
_direction = DIRECTION_LEFT
|
||||||
|
_wall_high_ray_cast = cultist.left_wall_high_ray
|
||||||
|
_wall_low_ray_cast = cultist.left_wall_low_ray
|
||||||
|
_player_ray_cast = cultist.left_player_distant_ray
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_WALK_LEFT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://hgn4yll571hp
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
extends CultistWalkState
|
||||||
|
|
||||||
|
|
||||||
|
func init() -> void:
|
||||||
|
_direction = DIRECTION_RIGHT
|
||||||
|
_wall_high_ray_cast = cultist.right_wall_high_ray
|
||||||
|
_wall_low_ray_cast = cultist.right_wall_low_ray
|
||||||
|
_player_ray_cast = cultist.right_player_distant_ray
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
cultist.sprite.play(CultistSprite.ANIMATION_WALK_RIGHT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bwwhmjxhg2adp
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
@abstract
|
||||||
|
class_name CultistWalkState
|
||||||
|
extends CultistMoveState
|
||||||
|
|
||||||
|
|
||||||
|
@export var chase_state: CultistState
|
||||||
|
@export var another_direction_walk_state: CultistState
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(delta: float) -> void:
|
||||||
|
if not cultist.is_on_floor():
|
||||||
|
switch_state.emit(fall_state)
|
||||||
|
else:
|
||||||
|
var player := _get_colliding_player(_player_ray_cast)
|
||||||
|
if player != null:
|
||||||
|
switch_state.emit(chase_state)
|
||||||
|
else:
|
||||||
|
if _wall_low_ray_cast.is_colliding() or _wall_high_ray_cast.is_colliding():
|
||||||
|
var stream := SoundManager.sfx_stream_player_lost
|
||||||
|
SoundManager.play_sfx_stream(stream, cultist.global_position)
|
||||||
|
switch_state.emit(another_direction_walk_state)
|
||||||
|
else:
|
||||||
|
cultist.update_x_velocity(_direction, cultist.MAX_WALK_SPEED, delta)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://lplif1gcjbai
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
class_name WhiteCultist
|
||||||
|
extends AbstractColorCultist
|
||||||
+6
-9
@@ -1,10 +1,10 @@
|
|||||||
[gd_scene format=3 uid="uid://bv2gahb4wxgb1"]
|
[gd_scene format=3 uid="uid://bv2gahb4wxgb1"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://d37eyum03h83i" path="res://game/characters/enemies/abstract_color_enemy.tscn" id="1_3yi7g"]
|
[ext_resource type="PackedScene" uid="uid://d37eyum03h83i" path="res://game/characters/enemies/abstract_color_cultist.tscn" id="1_3yi7g"]
|
||||||
[ext_resource type="Script" uid="uid://dmcpkytgiuedi" path="res://game/characters/enemies/white_enemy.gd" id="2_c7pdf"]
|
[ext_resource type="Script" uid="uid://dmcpkytgiuedi" path="res://game/characters/enemies/white_cultist.gd" id="2_c7pdf"]
|
||||||
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_uj6yw"]
|
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="3_uj6yw"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gfhm1"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_36f86"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource("3_uj6yw")
|
shader = ExtResource("3_uj6yw")
|
||||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||||
@@ -20,8 +20,8 @@ collision_layer = 64
|
|||||||
collision_mask = 33
|
collision_mask = 33
|
||||||
script = ExtResource("2_c7pdf")
|
script = ExtResource("2_c7pdf")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." index="0" unique_id=1997264413]
|
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||||
material = SubResource("ShaderMaterial_gfhm1")
|
material = SubResource("ShaderMaterial_36f86")
|
||||||
|
|
||||||
[node name="LeftWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
[node name="LeftWallRay" parent="WallCheck" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
||||||
collision_mask = 33
|
collision_mask = 33
|
||||||
@@ -43,8 +43,5 @@ collision_mask = 161
|
|||||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||||
collision_mask = 161
|
collision_mask = 161
|
||||||
|
|
||||||
[node name="PlayerTouchArea" parent="." index="6" unique_id=2147163970]
|
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||||
collision_mask = 128
|
|
||||||
|
|
||||||
[node name="KillingArea" parent="." index="7" unique_id=1891922549]
|
|
||||||
collision_mask = 128
|
collision_mask = 128
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
class_name WhiteEnemy
|
|
||||||
extends AbstractColorEnemy
|
|
||||||
@@ -5,47 +5,36 @@ extends CharacterBody2D
|
|||||||
signal dead
|
signal dead
|
||||||
|
|
||||||
|
|
||||||
const ANIMATION_IDLE = "idle"
|
|
||||||
const ANIMATION_LOOK_AROUND_1 = "look_around_1"
|
|
||||||
const ANIMATION_LOOK_AROUND_2 = "look_around_2"
|
|
||||||
const ANIMATION_WALK_LEFT = "walk_left"
|
|
||||||
const ANIMATION_WALK_RIGHT = "walk_right"
|
|
||||||
const ANIMATION_FALL_DOWN = "fall_down"
|
|
||||||
const ANIMATION_FALL_DOWN_LEFT = "fall_down_left"
|
|
||||||
const ANIMATION_FALL_DOWN_RIGHT = "fall_down_right"
|
|
||||||
const ANIMATION_FALL_UP = "fall_up"
|
|
||||||
const ANIMATION_FALL_UP_LEFT = "fall_up_left"
|
|
||||||
const ANIMATION_FALL_UP_RIGHT = "fall_up_right"
|
|
||||||
const ANIMATION_DEATH = "death"
|
|
||||||
|
|
||||||
const LOOK_AROUND_CHANCE = 25
|
|
||||||
const PICKUP_OFFSET = 16.0
|
const PICKUP_OFFSET = 16.0
|
||||||
|
|
||||||
|
|
||||||
@export_range(0.0, 1000.0) var max_speed := 160
|
@export_range(0.0, 1000.0) var max_speed := 160
|
||||||
@export_range(0.0, 1000.0) var max_fall_speed := 640
|
@export_range(0.0, 1000.0) var max_fall_speed := 640
|
||||||
@export_range(0.0, 1000.0) var acceleration := 600.0
|
@export_range(0.0, 1000.0) var acceleration := 600.0
|
||||||
@export_range(0.0, 1000.0) var jump_velocity := 320.0
|
@export_range(0.0, 1000.0) var jump_velocity := 333.0
|
||||||
@export_range(0.0, 2.0) var jump_gravity_factor := 1.0
|
@export_range(0.0, 2.0) var jump_gravity_factor := 1.0
|
||||||
@export_range(0.0, 2.0) var fall_gravity_factor := 1.5
|
@export_range(0.0, 2.0) var fall_gravity_factor := 1.5
|
||||||
@export_range(0.0, 1.0) var passive_jump_factor := 0.5
|
@export_range(0.0, 1.0) var passive_jump_factor := 0.5
|
||||||
|
|
||||||
|
|
||||||
var _is_alive := true
|
var is_dead := false
|
||||||
var _is_switching_needed := false
|
var _is_switching_needed := false
|
||||||
|
|
||||||
|
|
||||||
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
@onready var sprite : AnimatedSprite2D = $PlayerSprite
|
||||||
@onready var collision_switcher : CollisionSwitcher = $CollisionSwitcher
|
@onready var collision_switcher : CollisionSwitcher = $CollisionSwitcher
|
||||||
@onready var pickups : Node2D = $Pickups
|
@onready var pickups : Node2D = $Pickups
|
||||||
@onready var jump_buffer_timer : Timer = $JumpBufferTimer
|
@onready var jump_buffer_timer : Timer = $JumpBufferTimer
|
||||||
@onready var coyote_time_timer : Timer = $CoyoteTimeTimer
|
@onready var coyote_time_timer : Timer = $CoyoteTimeTimer
|
||||||
@onready var center_area : Area2D = $CenterArea2D
|
@onready var center_area : Area2D = $CenterArea2D
|
||||||
|
@onready var state_machine : PlayerStateMachine = $PlayerStateMachine
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
collision_switcher.material = sprite.material
|
collision_switcher.material = sprite.material
|
||||||
|
|
||||||
|
state_machine.init()
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
@@ -62,8 +51,8 @@ func _physics_process(delta: float) -> void:
|
|||||||
velocity += get_gravity() * gravity_factor * delta
|
velocity += get_gravity() * gravity_factor * delta
|
||||||
velocity.y = clampf(velocity.y, -max_fall_speed, max_fall_speed)
|
velocity.y = clampf(velocity.y, -max_fall_speed, max_fall_speed)
|
||||||
|
|
||||||
if not _is_alive:
|
if is_dead:
|
||||||
_slow_down(delta)
|
_slow_down(delta*3)
|
||||||
else:
|
else:
|
||||||
if Input.is_action_just_pressed("jump"):
|
if Input.is_action_just_pressed("jump"):
|
||||||
jump_buffer_timer.start()
|
jump_buffer_timer.start()
|
||||||
@@ -72,6 +61,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_jump, global_position)
|
SoundManager.play_sfx_stream(SoundManager.sfx_stream_jump, global_position)
|
||||||
velocity.y = -jump_velocity
|
velocity.y = -jump_velocity
|
||||||
jump_buffer_timer.stop()
|
jump_buffer_timer.stop()
|
||||||
|
coyote_time_timer.stop()
|
||||||
|
|
||||||
var direction := Input.get_axis("move_left", "move_right")
|
var direction := Input.get_axis("move_left", "move_right")
|
||||||
if direction:
|
if direction:
|
||||||
@@ -79,12 +69,11 @@ func _physics_process(delta: float) -> void:
|
|||||||
else:
|
else:
|
||||||
_slow_down(delta)
|
_slow_down(delta)
|
||||||
|
|
||||||
_update_animation()
|
|
||||||
|
|
||||||
if _is_switching_needed:
|
if _is_switching_needed:
|
||||||
_switch()
|
_switch()
|
||||||
|
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
state_machine.physics_process(delta)
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
@@ -95,7 +84,7 @@ func _input(event: InputEvent) -> void:
|
|||||||
func _switch() -> void:
|
func _switch() -> void:
|
||||||
_is_switching_needed = false
|
_is_switching_needed = false
|
||||||
|
|
||||||
if not _is_alive:
|
if is_dead:
|
||||||
return
|
return
|
||||||
|
|
||||||
if center_area.get_overlapping_bodies().size() == 0:
|
if center_area.get_overlapping_bodies().size() == 0:
|
||||||
@@ -106,13 +95,12 @@ func _switch() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func kill() -> void:
|
func kill() -> void:
|
||||||
if not _is_alive: return
|
is_dead = true
|
||||||
|
|
||||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_death, global_position)
|
|
||||||
_is_alive = false
|
func process_dead() -> void:
|
||||||
get_tree().paused = true
|
dead.emit()
|
||||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
queue_free()
|
||||||
sprite.play(ANIMATION_DEATH)
|
|
||||||
|
|
||||||
|
|
||||||
func add_pickup(pickup: AbstractPickup) -> void:
|
func add_pickup(pickup: AbstractPickup) -> void:
|
||||||
@@ -131,48 +119,6 @@ func _slow_down(delta: float) -> void:
|
|||||||
velocity.x = move_toward(velocity.x, 0, acceleration * delta)
|
velocity.x = move_toward(velocity.x, 0, acceleration * delta)
|
||||||
|
|
||||||
|
|
||||||
func _is_killing_collider(collider: Object) -> bool:
|
|
||||||
if not collider is Node: return false
|
|
||||||
|
|
||||||
var node := collider as Node
|
|
||||||
return node.has_node("PlayerKiller")
|
|
||||||
|
|
||||||
|
|
||||||
func _update_animation() -> void:
|
|
||||||
var animation := _get_animation()
|
|
||||||
if sprite.animation != animation:
|
|
||||||
sprite.play(animation)
|
|
||||||
|
|
||||||
|
|
||||||
func _get_animation() -> String:
|
|
||||||
if is_on_floor():
|
|
||||||
if velocity.x > 0:
|
|
||||||
return ANIMATION_WALK_RIGHT
|
|
||||||
elif velocity.x < 0:
|
|
||||||
return ANIMATION_WALK_LEFT
|
|
||||||
else:
|
|
||||||
if is_zero_approx(velocity.x):
|
|
||||||
if velocity.y > 0:
|
|
||||||
return ANIMATION_FALL_DOWN
|
|
||||||
else:
|
|
||||||
return ANIMATION_FALL_UP
|
|
||||||
if velocity.x > 0:
|
|
||||||
if velocity.y > 0:
|
|
||||||
return ANIMATION_FALL_DOWN_RIGHT
|
|
||||||
else:
|
|
||||||
return ANIMATION_FALL_UP_RIGHT
|
|
||||||
elif velocity.x < 0:
|
|
||||||
if velocity.y > 0:
|
|
||||||
return ANIMATION_FALL_DOWN_LEFT
|
|
||||||
else:
|
|
||||||
return ANIMATION_FALL_UP_LEFT
|
|
||||||
|
|
||||||
if sprite.animation in [ANIMATION_LOOK_AROUND_1, ANIMATION_LOOK_AROUND_2]:
|
|
||||||
return sprite.animation
|
|
||||||
|
|
||||||
return ANIMATION_IDLE
|
|
||||||
|
|
||||||
|
|
||||||
func _rearrange_pickups() -> void:
|
func _rearrange_pickups() -> void:
|
||||||
var children := pickups.get_children()
|
var children := pickups.get_children()
|
||||||
var pickup_shift := (children.size() - 1) * PICKUP_OFFSET / 2.0
|
var pickup_shift := (children.size() - 1) * PICKUP_OFFSET / 2.0
|
||||||
@@ -182,23 +128,3 @@ func _rearrange_pickups() -> void:
|
|||||||
var node := children[i] as Node2D
|
var node := children[i] as Node2D
|
||||||
node.position.x = i * PICKUP_OFFSET - pickup_shift
|
node.position.x = i * PICKUP_OFFSET - pickup_shift
|
||||||
node.position.y = 0
|
node.position.y = 0
|
||||||
|
|
||||||
|
|
||||||
func _play_look_around_animation() -> void:
|
|
||||||
sprite.play(ANIMATION_LOOK_AROUND_1 if randi_range(1, 2) == 1 else ANIMATION_LOOK_AROUND_2)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_finished() -> void:
|
|
||||||
match sprite.animation:
|
|
||||||
ANIMATION_LOOK_AROUND_1, ANIMATION_LOOK_AROUND_2:
|
|
||||||
sprite.play(ANIMATION_IDLE)
|
|
||||||
ANIMATION_DEATH:
|
|
||||||
dead.emit()
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_looped() -> void:
|
|
||||||
match sprite.animation:
|
|
||||||
ANIMATION_IDLE:
|
|
||||||
if randi_range(1, 100) <= LOOK_AROUND_CHANCE:
|
|
||||||
_play_look_around_animation()
|
|
||||||
|
|||||||
@@ -3,21 +3,34 @@
|
|||||||
[ext_resource type="Script" uid="uid://bb8kc32sggrn2" path="res://game/characters/player/player.gd" id="1_xln5q"]
|
[ext_resource type="Script" uid="uid://bb8kc32sggrn2" path="res://game/characters/player/player.gd" id="1_xln5q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="2_j06tb"]
|
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="2_j06tb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cvx6akiplg21s" path="res://game/characters/player/player_sprite.tscn" id="2_n6ad3"]
|
[ext_resource type="PackedScene" uid="uid://cvx6akiplg21s" path="res://game/characters/player/player_sprite.tscn" id="2_n6ad3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bdk23k2bypj8w" path="res://game/characters/player/state_machine/player_state_machine.tscn" id="4_ybe51"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c0d4wfdg7xjti" path="res://game/characters/player/state_machine/player_state.tscn" id="5_65114"]
|
||||||
|
[ext_resource type="Script" uid="uid://bnxccvt265hlu" path="res://game/characters/player/state_machine/idle_state.gd" id="6_3qf5w"]
|
||||||
|
[ext_resource type="Script" uid="uid://nc62375vpnsw" path="res://game/characters/player/state_machine/walk_left_state.gd" id="7_btbyc"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbv84l1duwfep" path="res://game/characters/player/state_machine/look_around_state.gd" id="7_ybe51"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxa3hf7tqpeoa" path="res://game/characters/player/state_machine/jump_state.gd" id="8_ebhjm"]
|
||||||
|
[ext_resource type="Script" uid="uid://d2uiegcx4jeuk" path="res://game/characters/player/state_machine/dead_state.gd" id="9_gdxv1"]
|
||||||
|
[ext_resource type="Script" uid="uid://kufq6bwnv80t" path="res://game/characters/player/state_machine/walk_right_state.gd" id="9_wdx7h"]
|
||||||
|
[ext_resource type="Script" uid="uid://c0bbmif5ucw28" path="res://game/characters/player/state_machine/jump_left_state.gd" id="11_q2504"]
|
||||||
|
[ext_resource type="Script" uid="uid://cr0hkb4wggcys" path="res://game/characters/player/state_machine/jump_right_state.gd" id="12_l8uo5"]
|
||||||
|
[ext_resource type="Script" uid="uid://c7myrm50fnpfn" path="res://game/characters/player/state_machine/falingl_state.gd" id="13_m2bqk"]
|
||||||
|
[ext_resource type="Script" uid="uid://cmimnl6jf78ao" path="res://game/characters/player/state_machine/falling_left_state.gd" id="14_2lnxg"]
|
||||||
|
[ext_resource type="Script" uid="uid://5s7ko6pcqagy" path="res://game/characters/player/state_machine/falling_right_state.gd" id="15_bfpdl"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_xln5q"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_xln5q"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_t6gq4"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_t6gq4"]
|
||||||
radius = 2.0
|
radius = 2.0
|
||||||
height = 15.0
|
height = 20.0
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D" unique_id=508706417]
|
[node name="Player" type="CharacterBody2D" unique_id=508706417]
|
||||||
collision_layer = 128
|
collision_layer = 128
|
||||||
collision_mask = 33
|
collision_mask = 33
|
||||||
script = ExtResource("1_xln5q")
|
script = ExtResource("1_xln5q")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." unique_id=237719081 instance=ExtResource("2_n6ad3")]
|
[node name="PlayerSprite" parent="." unique_id=237719081 instance=ExtResource("2_n6ad3")]
|
||||||
animation = &"death"
|
animation = &"jump_right"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1101386361]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1101386361]
|
||||||
position = Vector2(0, 1)
|
position = Vector2(0, 1)
|
||||||
@@ -46,7 +59,154 @@ collision_layer = 0
|
|||||||
collision_mask = 35
|
collision_mask = 35
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CenterArea2D" unique_id=1350886064]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CenterArea2D" unique_id=1350886064]
|
||||||
|
position = Vector2(0, 1)
|
||||||
shape = SubResource("CapsuleShape2D_t6gq4")
|
shape = SubResource("CapsuleShape2D_t6gq4")
|
||||||
|
|
||||||
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
|
[node name="PlayerStateMachine" parent="." unique_id=633169960 node_paths=PackedStringArray("player", "initial_state") instance=ExtResource("4_ybe51")]
|
||||||
[connection signal="animation_looped" from="AnimatedSprite2D" to="." method="_on_animation_looped"]
|
player = NodePath("..")
|
||||||
|
initial_state = NodePath("IdleState")
|
||||||
|
|
||||||
|
[node name="IdleState" parent="PlayerStateMachine" unique_id=739226464 node_paths=PackedStringArray("look_around_state", "player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("6_3qf5w")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath(".")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="WalkLeftState" parent="PlayerStateMachine" unique_id=195513070 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("7_btbyc")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath(".")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="WalkRightState" parent="PlayerStateMachine" unique_id=224236087 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("9_wdx7h")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath(".")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="DeadState" parent="PlayerStateMachine" unique_id=2135733235 node_paths=PackedStringArray("player") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("9_gdxv1")
|
||||||
|
player = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="JumpState" parent="PlayerStateMachine" unique_id=1592631166 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("8_ebhjm")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="JumpLeftState" parent="PlayerStateMachine" unique_id=609248752 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("11_q2504")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath(".")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="JumpRightState" parent="PlayerStateMachine" unique_id=1936273065 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("12_l8uo5")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath(".")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="FallState" parent="PlayerStateMachine" unique_id=329927506 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("13_m2bqk")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath(".")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="FallLeftState" parent="PlayerStateMachine" unique_id=730552947 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("14_2lnxg")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath(".")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|
||||||
|
[node name="FallRightState" parent="PlayerStateMachine" unique_id=347081029 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("15_bfpdl")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath(".")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath(".")
|
||||||
|
|
||||||
|
[node name="LookAroundState" parent="PlayerStateMachine" unique_id=946166563 node_paths=PackedStringArray("player", "idle_state", "walk_left_state", "walk_right_state", "dead_state", "jump_state", "jump_left_state", "jump_right_state", "fall_state", "fall_left_state", "fall_right_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("7_ybe51")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_left_state = NodePath("../WalkLeftState")
|
||||||
|
walk_right_state = NodePath("../WalkRightState")
|
||||||
|
dead_state = NodePath("../DeadState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
jump_left_state = NodePath("../JumpLeftState")
|
||||||
|
jump_right_state = NodePath("../JumpRightState")
|
||||||
|
fall_state = NodePath("../FallState")
|
||||||
|
fall_left_state = NodePath("../FallLeftState")
|
||||||
|
fall_right_state = NodePath("../FallRightState")
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
[gd_scene format=3 uid="uid://dtcad8tdx78tg"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bb8kc32sggrn2" path="res://game/characters/player/player.gd" id="1_xln5q"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="2_j06tb"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cvx6akiplg21s" path="res://game/characters/player/player_sprite.tscn" id="2_n6ad3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bdk23k2bypj8w" path="res://game/characters/player/state_machine/player_state_machine.tscn" id="4_ybe51"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c0d4wfdg7xjti" path="res://game/characters/player/state_machine/player_state.tscn" id="5_65114"]
|
||||||
|
[ext_resource type="Script" uid="uid://bnxccvt265hlu" path="res://game/characters/player/state_machine/idle_state.gd" id="6_3qf5w"]
|
||||||
|
[ext_resource type="Script" uid="uid://nc62375vpnsw" path="res://game/characters/player/state_machine/walk_left_state.gd" id="7_btbyc"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbv84l1duwfep" path="res://game/characters/player/state_machine/look_around_state.gd" id="7_ybe51"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxa3hf7tqpeoa" path="res://game/characters/player/state_machine/jump_state.gd" id="8_ebhjm"]
|
||||||
|
[ext_resource type="Script" uid="uid://d2uiegcx4jeuk" path="res://game/characters/player/state_machine/dead_state.gd" id="9_gdxv1"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_xln5q"]
|
||||||
|
radius = 4.0
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_t6gq4"]
|
||||||
|
radius = 2.0
|
||||||
|
height = 15.0
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D" unique_id=508706417]
|
||||||
|
collision_layer = 128
|
||||||
|
collision_mask = 33
|
||||||
|
script = ExtResource("1_xln5q")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" parent="." unique_id=237719081 instance=ExtResource("2_n6ad3")]
|
||||||
|
animation = &"death"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1101386361]
|
||||||
|
position = Vector2(0, 1)
|
||||||
|
shape = SubResource("CapsuleShape2D_xln5q")
|
||||||
|
|
||||||
|
[node name="CollisionSwitcher" parent="." unique_id=601548821 node_paths=PackedStringArray("object") instance=ExtResource("2_j06tb")]
|
||||||
|
object = NodePath("..")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="." unique_id=45512317]
|
||||||
|
process_callback = 0
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
|
||||||
|
[node name="Pickups" type="Node2D" parent="." unique_id=958829860]
|
||||||
|
position = Vector2(0, -24)
|
||||||
|
|
||||||
|
[node name="JumpBufferTimer" type="Timer" parent="." unique_id=740877224]
|
||||||
|
wait_time = 0.1
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="CoyoteTimeTimer" type="Timer" parent="." unique_id=117837002]
|
||||||
|
wait_time = 0.1
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="CenterArea2D" type="Area2D" parent="." unique_id=490866430]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 35
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CenterArea2D" unique_id=1350886064]
|
||||||
|
shape = SubResource("CapsuleShape2D_t6gq4")
|
||||||
|
|
||||||
|
[node name="PlayerStateMachine" parent="." unique_id=633169960 node_paths=PackedStringArray("player", "dead_state", "initial_state") instance=ExtResource("4_ybe51")]
|
||||||
|
player = NodePath("..")
|
||||||
|
dead_state = NodePath("DeadState")
|
||||||
|
initial_state = NodePath("IdleState")
|
||||||
|
|
||||||
|
[node name="IdleState" parent="PlayerStateMachine" unique_id=739226464 node_paths=PackedStringArray("look_around_state", "player", "idle_state", "walk_state", "jump_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("6_3qf5w")
|
||||||
|
look_around_state = NodePath("../LookAroundState")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath(".")
|
||||||
|
walk_state = NodePath("../WalkLeftState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
|
||||||
|
[node name="LookAroundState" parent="PlayerStateMachine" unique_id=946166563 node_paths=PackedStringArray("player", "idle_state", "walk_state", "jump_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("7_ybe51")
|
||||||
|
player = NodePath("../..")
|
||||||
|
idle_state = NodePath("../IdleState")
|
||||||
|
walk_state = NodePath("../WalkLeftState")
|
||||||
|
jump_state = NodePath("../JumpState")
|
||||||
|
|
||||||
|
[node name="WalkLeftState" parent="PlayerStateMachine" unique_id=195513070 instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("7_btbyc")
|
||||||
|
player = Object(CharacterBody2D,"unique_name_in_owner":false,"process_mode":0,"process_priority":0,"proce
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
[gd_scene format=3 uid="uid://dtcad8tdx78tg"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bb8kc32sggrn2" path="res://game/characters/player/player.gd" id="1_xln5q"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="2_j06tb"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cvx6akiplg21s" path="res://game/characters/player/player_sprite.tscn" id="2_n6ad3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bdk23k2bypj8w" path="res://game/characters/player/state_machine/player_state_machine.tscn" id="4_ybe51"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c0d4wfdg7xjti" path="res://game/characters/player/state_machine/player_state.tscn" id="5_65114"]
|
||||||
|
[ext_resource type="Script" uid="uid://bnxccvt265hlu" path="res://game/characters/player/state_machine/idle_state.gd" id="6_3qf5w"]
|
||||||
|
[ext_resource type="Script" uid="uid://nc62375vpnsw" path="res://game/characters/player/state_machine/walk_left_state.gd" id="7_btbyc"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbv84l1duwfep" path="res://game/characters/player/state_machine/look_around_state.gd" id="7_ybe51"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxa3hf7tqpeoa" path="res://game/characters/player/state_machine/jump_state.gd" id="8_ebhjm"]
|
||||||
|
[ext_resource type="Script" uid="uid://d2uiegcx4jeuk" path="res://game/characters/player/state_machine/dead_state.gd" id="9_gdxv1"]
|
||||||
|
[ext_resource type="Script" uid="uid://kufq6bwnv80t" path="res://game/characters/player/state_machine/walk_right_state.gd" id="9_wdx7h"]
|
||||||
|
[ext_resource type="Script" uid="uid://c0bbmif5ucw28" path="res://game/characters/player/state_machine/jump_left_state.gd" id="11_q2504"]
|
||||||
|
[ext_resource type="Script" uid="uid://cr0hkb4wggcys" path="res://game/characters/player/state_machine/jump_right_state.gd" id="12_l8uo5"]
|
||||||
|
[ext_resource type="Script" uid="uid://c7myrm50fnpfn" path="res://game/characters/player/state_machine/fall_state.gd" id="13_m2bqk"]
|
||||||
|
[ext_resource type="Script" uid="uid://cmimnl6jf78ao" path="res://game/characters/player/state_machine/fall_left_state.gd" id="14_2lnxg"]
|
||||||
|
[ext_resource type="Script" uid="uid://5s7ko6pcqagy" path="res://game/characters/player/state_machine/fall_right_state.gd" id="15_bfpdl"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_xln5q"]
|
||||||
|
radius = 4.0
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_t6gq4"]
|
||||||
|
radius = 2.0
|
||||||
|
height = 15.0
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D" unique_id=508706417]
|
||||||
|
collision_layer = 128
|
||||||
|
collision_mask = 33
|
||||||
|
script = ExtResource("1_xln5q")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" parent="." unique_id=237719081 instance=ExtResource("2_n6ad3")]
|
||||||
|
animation = &"jump_right"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1101386361]
|
||||||
|
position = Vector2(0, 1)
|
||||||
|
shape = SubResource("CapsuleShape2D_xln5q")
|
||||||
|
|
||||||
|
[node name="CollisionSwitcher" parent="." unique_id=601548821 node_paths=PackedStringArray("object") instance=ExtResource("2_j06tb")]
|
||||||
|
object = NodePath("..")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="." unique_id=45512317]
|
||||||
|
process_callback = 0
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
|
||||||
|
[node name="Pickups" type="Node2D" parent="." unique_id=958829860]
|
||||||
|
position = Vector2(0, -24)
|
||||||
|
|
||||||
|
[node name="JumpBufferTimer" type="Timer" parent="." unique_id=740877224]
|
||||||
|
wait_time = 0.1
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="CoyoteTimeTimer" type="Timer" parent="." unique_id=117837002]
|
||||||
|
wait_time = 0.1
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="CenterArea2D" type="Area2D" parent="." unique_id=490866430]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 35
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CenterArea2D" unique_id=1350886064]
|
||||||
|
shape = SubResource("CapsuleShape2D_t6gq4")
|
||||||
|
|
||||||
|
[node name="PlayerStateMachine" parent="." unique_id=633169960 node_paths=PackedStringArray("player", "initial_state") instance=ExtResource("4_ybe51")]
|
||||||
|
player = NodePath("..")
|
||||||
|
initial_state = NodePath("IdleState")
|
||||||
|
|
||||||
|
[node name="IdleState" parent="PlayerStateMachine" unique_id=739226464 node_paths=PackedStringArray("look_around_state") instance=ExtResource("5_65114")]
|
||||||
|
script = ExtResource("6_3qf5w")
|
||||||
|
player = Object(CharacterBody2D,"unique_name_in_owner":false,"process_mod
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
class_name PlayerSprite
|
||||||
|
extends AnimatedSprite2D
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const ANIMATION_IDLE = "idle"
|
||||||
|
|
||||||
|
const ANIMATION_LOOK_AROUND = "look_around"
|
||||||
|
const ANIMATION_LOOK_AROUND_1 = "look_around_1"
|
||||||
|
const ANIMATION_LOOK_AROUND_2 = "look_around_2"
|
||||||
|
|
||||||
|
const ANIMATION_FALL = "fall"
|
||||||
|
const ANIMATION_FALL_LEFT = "fall_left"
|
||||||
|
const ANIMATION_FALL_RIGHT = "fall_right"
|
||||||
|
|
||||||
|
const ANIMATION_JUMP = "jump"
|
||||||
|
const ANIMATION_JUMP_LEFT = "jump_left"
|
||||||
|
const ANIMATION_JUMP_RIGHT = "jump_right"
|
||||||
|
|
||||||
|
const ANIMATION_WALK_LEFT = "walk_left"
|
||||||
|
const ANIMATION_WALK_RIGHT = "walk_right"
|
||||||
|
|
||||||
|
const ANIMATION_DEATH = "death"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bpclheyn60yp7
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=53 format=3 uid="uid://cvx6akiplg21s"]
|
[gd_scene format=3 uid="uid://cvx6akiplg21s"]
|
||||||
|
|
||||||
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="1_57ht8"]
|
[ext_resource type="Shader" uid="uid://lqq1mg6l1qqe" path="res://game/shaders/black_n_white.gdshader" id="1_57ht8"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bjccaucrio6ht" path="res://images/characters/player.png" id="2_mi53p"]
|
[ext_resource type="Texture2D" uid="uid://bjccaucrio6ht" path="res://images/characters/player.png" id="2_mi53p"]
|
||||||
|
[ext_resource type="Script" uid="uid://bpclheyn60yp7" path="res://game/characters/player/player_sprite.gd" id="3_ulfbe"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i05k5"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i05k5"]
|
||||||
shader = ExtResource("1_57ht8")
|
shader = ExtResource("1_57ht8")
|
||||||
@@ -81,18 +82,6 @@ region = Rect2(64, 96, 32, 32)
|
|||||||
atlas = ExtResource("2_mi53p")
|
atlas = ExtResource("2_mi53p")
|
||||||
region = Rect2(0, 96, 32, 32)
|
region = Rect2(0, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_htqrf"]
|
|
||||||
atlas = ExtResource("2_mi53p")
|
|
||||||
region = Rect2(160, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vkuli"]
|
|
||||||
atlas = ExtResource("2_mi53p")
|
|
||||||
region = Rect2(96, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_457no"]
|
|
||||||
atlas = ExtResource("2_mi53p")
|
|
||||||
region = Rect2(32, 96, 32, 32)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n6ad3"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_n6ad3"]
|
||||||
atlas = ExtResource("2_mi53p")
|
atlas = ExtResource("2_mi53p")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
@@ -113,6 +102,18 @@ region = Rect2(32, 0, 32, 32)
|
|||||||
atlas = ExtResource("2_mi53p")
|
atlas = ExtResource("2_mi53p")
|
||||||
region = Rect2(0, 0, 32, 32)
|
region = Rect2(0, 0, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_htqrf"]
|
||||||
|
atlas = ExtResource("2_mi53p")
|
||||||
|
region = Rect2(160, 96, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vkuli"]
|
||||||
|
atlas = ExtResource("2_mi53p")
|
||||||
|
region = Rect2(96, 96, 32, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_457no"]
|
||||||
|
atlas = ExtResource("2_mi53p")
|
||||||
|
region = Rect2(32, 96, 32, 32)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mi53p"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mi53p"]
|
||||||
atlas = ExtResource("2_mi53p")
|
atlas = ExtResource("2_mi53p")
|
||||||
region = Rect2(96, 0, 32, 32)
|
region = Rect2(96, 0, 32, 32)
|
||||||
@@ -259,7 +260,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_4u621")
|
"texture": SubResource("AtlasTexture_4u621")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down",
|
"name": &"fall",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -267,7 +268,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_tqwgk")
|
"texture": SubResource("AtlasTexture_tqwgk")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down_left",
|
"name": &"fall_left",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -275,31 +276,7 @@ animations = [{
|
|||||||
"texture": SubResource("AtlasTexture_ly4f6")
|
"texture": SubResource("AtlasTexture_ly4f6")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"fall_down_right",
|
"name": &"fall_right",
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_htqrf")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_vkuli")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up_left",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_457no")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"fall_up_right",
|
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
@@ -323,6 +300,30 @@ animations = [{
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_htqrf")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vkuli")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump_left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_457no")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump_right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
"duration": 3.0,
|
"duration": 3.0,
|
||||||
"texture": SubResource("AtlasTexture_mi53p")
|
"texture": SubResource("AtlasTexture_mi53p")
|
||||||
}, {
|
}, {
|
||||||
@@ -426,7 +427,8 @@ animations = [{
|
|||||||
"speed": 20.0
|
"speed": 20.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D"]
|
[node name="PlayerSprite2D" type="AnimatedSprite2D" unique_id=259457082]
|
||||||
material = SubResource("ShaderMaterial_i05k5")
|
material = SubResource("ShaderMaterial_i05k5")
|
||||||
sprite_frames = SubResource("SpriteFrames_v8w1g")
|
sprite_frames = SubResource("SpriteFrames_v8w1g")
|
||||||
animation = &"look_around"
|
animation = &"idle"
|
||||||
|
script = ExtResource("3_ulfbe")
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
SoundManager.play_sfx_stream(SoundManager.sfx_stream_death, player.global_position)
|
||||||
|
player.sprite.animation_finished.connect(_on_aniimation_finished)
|
||||||
|
player.process_mode = Node.PROCESS_MODE_ALWAYS
|
||||||
|
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_DEATH)
|
||||||
|
get_tree().paused = true
|
||||||
|
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
player.sprite.animation_finished.disconnect(_on_aniimation_finished)
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(_delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_aniimation_finished() -> void:
|
||||||
|
player.process_dead()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://d2uiegcx4jeuk
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_FALL)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c7myrm50fnpfn
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_FALL_LEFT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cmimnl6jf78ao
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_FALL_RIGHT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://5s7ko6pcqagy
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
const LOOK_AROUND_CHANCE = 25
|
||||||
|
|
||||||
|
|
||||||
|
@export var look_around_state: PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.animation_looped.connect(_on_animation_looped)
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_IDLE)
|
||||||
|
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
player.sprite.animation_looped.disconnect(_on_animation_looped)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animation_looped() -> void:
|
||||||
|
if randi_range(1, 100) <= LOOK_AROUND_CHANCE:
|
||||||
|
switch_state.emit(look_around_state)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bnxccvt265hlu
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_JUMP_LEFT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c0bbmif5ucw28
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_JUMP_RIGHT)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cr0hkb4wggcys
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_JUMP)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cxa3hf7tqpeoa
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.animation_finished.connect(_on_animation_finished)
|
||||||
|
player.sprite.play(_get_animation())
|
||||||
|
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
player.sprite.animation_finished.disconnect(_on_animation_finished)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animation_finished() -> void:
|
||||||
|
switch_state.emit(idle_state)
|
||||||
|
|
||||||
|
|
||||||
|
func _get_animation() -> String:
|
||||||
|
if randi_range(1, 2) == 1:
|
||||||
|
return PlayerSprite.ANIMATION_LOOK_AROUND_1
|
||||||
|
else:
|
||||||
|
return PlayerSprite.ANIMATION_LOOK_AROUND_2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cbv84l1duwfep
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
class_name PlayerState
|
||||||
|
extends AbstractState
|
||||||
|
|
||||||
|
|
||||||
|
@export var player: Player
|
||||||
|
|
||||||
|
|
||||||
|
@export var idle_state: PlayerState
|
||||||
|
@export var walk_left_state: PlayerState
|
||||||
|
@export var walk_right_state: PlayerState
|
||||||
|
@export var dead_state: PlayerState
|
||||||
|
@export var jump_state: PlayerState
|
||||||
|
@export var jump_left_state: PlayerState
|
||||||
|
@export var jump_right_state: PlayerState
|
||||||
|
@export var fall_state: PlayerState
|
||||||
|
@export var fall_left_state: PlayerState
|
||||||
|
@export var fall_right_state: PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func physics_process(_delta: float) -> void:
|
||||||
|
if player.is_dead:
|
||||||
|
switch_state.emit(dead_state)
|
||||||
|
elif player.velocity.is_zero_approx():
|
||||||
|
switch_state.emit(idle_state)
|
||||||
|
elif is_zero_approx(player.velocity.y):
|
||||||
|
if player.velocity.x < 0:
|
||||||
|
switch_state.emit(walk_left_state)
|
||||||
|
else:
|
||||||
|
switch_state.emit(walk_right_state)
|
||||||
|
else:
|
||||||
|
if player.velocity.y < 0:
|
||||||
|
if is_zero_approx(player.velocity.x):
|
||||||
|
switch_state.emit(jump_state)
|
||||||
|
elif player.velocity.x < 0:
|
||||||
|
switch_state.emit(jump_left_state)
|
||||||
|
else:
|
||||||
|
switch_state.emit(jump_right_state)
|
||||||
|
else:
|
||||||
|
if is_zero_approx(player.velocity.x):
|
||||||
|
switch_state.emit(fall_state)
|
||||||
|
elif player.velocity.x < 0:
|
||||||
|
switch_state.emit(fall_left_state)
|
||||||
|
else:
|
||||||
|
switch_state.emit(fall_right_state)
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cl4tgf5j7xxvm
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene format=3 uid="uid://c0d4wfdg7xjti"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c7adrbfobmvl8" path="res://game/state_machine/abstract_state.tscn" id="1_cun6f"]
|
||||||
|
[ext_resource type="Script" uid="uid://cl4tgf5j7xxvm" path="res://game/characters/player/state_machine/player_state.gd" id="2_h7f7n"]
|
||||||
|
|
||||||
|
[node name="PlayerState" unique_id=739226464 instance=ExtResource("1_cun6f")]
|
||||||
|
script = ExtResource("2_h7f7n")
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class_name PlayerStateMachine
|
||||||
|
extends StateMachine
|
||||||
|
|
||||||
|
|
||||||
|
@export var player: Player
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dk3t8s0lt2r8n
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene format=3 uid="uid://bdk23k2bypj8w"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://3ll3i1fgktg2" path="res://game/state_machine/state_machine.tscn" id="1_7tog0"]
|
||||||
|
[ext_resource type="Script" uid="uid://dk3t8s0lt2r8n" path="res://game/characters/player/state_machine/player_state_machine.gd" id="2_ydgfo"]
|
||||||
|
|
||||||
|
[node name="PlayerStateMachine" unique_id=633169960 instance=ExtResource("1_7tog0")]
|
||||||
|
script = ExtResource("2_ydgfo")
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_WALK_LEFT)
|
||||||
|
|
||||||
|
|
||||||
|
func process(delta: float) -> void:
|
||||||
|
player.sprite.speed_scale = -player.velocity.x / player.max_speed
|
||||||
|
super.process(delta)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://nc62375vpnsw
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
extends PlayerState
|
||||||
|
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
player.sprite.speed_scale = 1
|
||||||
|
player.sprite.play(PlayerSprite.ANIMATION_WALK_RIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
func process(delta: float) -> void:
|
||||||
|
player.sprite.speed_scale = player.velocity.x / player.max_speed
|
||||||
|
super.process(delta)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://kufq6bwnv80t
|
||||||
@@ -14,6 +14,7 @@ extends Node2D
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pause_menu.hide()
|
pause_menu.hide()
|
||||||
game_over_menu.hide()
|
game_over_menu.hide()
|
||||||
|
completion_menu.hide()
|
||||||
|
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://mpsu4g2b5h3a" path="res://game/levels/abstract_level.tscn" id="1_v1h2f"]
|
[ext_resource type="PackedScene" uid="uid://mpsu4g2b5h3a" path="res://game/levels/abstract_level.tscn" id="1_v1h2f"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b7mhdrj3b6loq" path="res://game/doors/door.tscn" id="2_h35x0"]
|
[ext_resource type="PackedScene" uid="uid://b7mhdrj3b6loq" path="res://game/doors/door.tscn" id="2_h35x0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bv2gahb4wxgb1" path="res://game/characters/enemies/white_enemy.tscn" id="3_2vfi4"]
|
[ext_resource type="PackedScene" uid="uid://bv2gahb4wxgb1" path="res://game/characters/enemies/white_cultist.tscn" id="3_2vfi4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b7imlh4sl036i" path="res://game/doors/square_door.tscn" id="3_qpxtm"]
|
[ext_resource type="PackedScene" uid="uid://b7imlh4sl036i" path="res://game/doors/square_door.tscn" id="3_qpxtm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cvhovmnl050os" path="res://game/objects/wardrobe.tscn" id="4_mpb5r"]
|
[ext_resource type="PackedScene" uid="uid://cvhovmnl050os" path="res://game/objects/wardrobe.tscn" id="4_mpb5r"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ciubf1ttwc133" path="res://game/pickups/square_key_pickup.tscn" id="4_p0pgv"]
|
[ext_resource type="PackedScene" uid="uid://ciubf1ttwc133" path="res://game/pickups/square_key_pickup.tscn" id="4_p0pgv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b8pvlnpdnfmd0" path="res://game/objects/chair_f.tscn" id="5_i374g"]
|
[ext_resource type="PackedScene" uid="uid://b8pvlnpdnfmd0" path="res://game/objects/chair_f.tscn" id="5_i374g"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cb0w6mt8g4mer" path="res://game/characters/enemies/gray_enemy.tscn" id="5_p0pgv"]
|
[ext_resource type="PackedScene" uid="uid://cb0w6mt8g4mer" path="res://game/characters/enemies/gray_cultist.tscn" id="5_p0pgv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c6qy8uybkn4x" path="res://game/objects/plate.tscn" id="6_gwfl1"]
|
[ext_resource type="PackedScene" uid="uid://c6qy8uybkn4x" path="res://game/objects/plate.tscn" id="6_gwfl1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cutjutvd8dqqc" path="res://game/characters/enemies/black_enemy.tscn" id="7_12tya"]
|
[ext_resource type="PackedScene" uid="uid://cutjutvd8dqqc" path="res://game/characters/enemies/black_cultist.tscn" id="7_12tya"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bdwbdnbenueu1" path="res://game/objects/table_m.tscn" id="7_fxyr3"]
|
[ext_resource type="PackedScene" uid="uid://bdwbdnbenueu1" path="res://game/objects/table_m.tscn" id="7_fxyr3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d3m8kf7lqmyb8" path="res://game/objects/flask_l.tscn" id="8_pp088"]
|
[ext_resource type="PackedScene" uid="uid://d3m8kf7lqmyb8" path="res://game/objects/flask_l.tscn" id="8_pp088"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bt4smb361amjj" path="res://game/objects/flask_s.tscn" id="9_gtr04"]
|
[ext_resource type="PackedScene" uid="uid://bt4smb361amjj" path="res://game/objects/flask_s.tscn" id="9_gtr04"]
|
||||||
@@ -244,17 +244,17 @@ position = Vector2(46, 25)
|
|||||||
[node name="SquareKeyPickup" parent="Pickups" parent_id_path=PackedInt32Array(1113969064) index="0" unique_id=1818750964 instance=ExtResource("4_p0pgv")]
|
[node name="SquareKeyPickup" parent="Pickups" parent_id_path=PackedInt32Array(1113969064) index="0" unique_id=1818750964 instance=ExtResource("4_p0pgv")]
|
||||||
position = Vector2(1312, 560)
|
position = Vector2(1312, 560)
|
||||||
|
|
||||||
[node name="WhiteEnemy" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="0" unique_id=1184609649 instance=ExtResource("3_2vfi4")]
|
[node name="WhiteCultist" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="0" unique_id=1184609649 instance=ExtResource("3_2vfi4")]
|
||||||
position = Vector2(258, 289)
|
position = Vector2(258, 289)
|
||||||
type = 1
|
type = 1
|
||||||
initial_state = 1
|
initial_state = 1
|
||||||
|
|
||||||
[node name="GrayEnemy" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="1" unique_id=455148405 instance=ExtResource("5_p0pgv")]
|
[node name="GrayCultist" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="1" unique_id=455148405 instance=ExtResource("5_p0pgv")]
|
||||||
position = Vector2(796, 592)
|
position = Vector2(796, 592)
|
||||||
type = 1
|
type = 1
|
||||||
initial_state = 1
|
initial_state = 1
|
||||||
|
|
||||||
[node name="BlackEnemy" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="2" unique_id=1794979765 instance=ExtResource("7_12tya")]
|
[node name="BlackCultist" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="2" unique_id=1794979765 instance=ExtResource("7_12tya")]
|
||||||
position = Vector2(1162, 592)
|
position = Vector2(1162, 592)
|
||||||
type = 1
|
type = 1
|
||||||
initial_state = 1
|
initial_state = 1
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://d330w1ygg6uxy" path="res://game/objects/painting_v_l.tscn" id="19_l40pv"]
|
[ext_resource type="PackedScene" uid="uid://d330w1ygg6uxy" path="res://game/objects/painting_v_l.tscn" id="19_l40pv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ciubf1ttwc133" path="res://game/pickups/square_key_pickup.tscn" id="20_uffr2"]
|
[ext_resource type="PackedScene" uid="uid://ciubf1ttwc133" path="res://game/pickups/square_key_pickup.tscn" id="20_uffr2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dqgmfpv2mhdpn" path="res://game/pickups/triangle_key_pickup.tscn" id="21_jk2b3"]
|
[ext_resource type="PackedScene" uid="uid://dqgmfpv2mhdpn" path="res://game/pickups/triangle_key_pickup.tscn" id="21_jk2b3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cutjutvd8dqqc" path="res://game/characters/enemies/black_enemy.tscn" id="22_b1xny"]
|
[ext_resource type="PackedScene" uid="uid://cutjutvd8dqqc" path="res://game/characters/enemies/black_cultist.tscn" id="22_b1xny"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bv2gahb4wxgb1" path="res://game/characters/enemies/white_enemy.tscn" id="23_8555i"]
|
[ext_resource type="PackedScene" uid="uid://bv2gahb4wxgb1" path="res://game/characters/enemies/white_cultist.tscn" id="23_8555i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dike8xgbqdut2" path="res://game/killing_area.tscn" id="24_te27h"]
|
[ext_resource type="PackedScene" uid="uid://dike8xgbqdut2" path="res://game/killing_area.tscn" id="24_te27h"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cjy8w"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cjy8w"]
|
||||||
@@ -315,25 +315,17 @@ position = Vector2(1113, 344)
|
|||||||
[node name="TriangleKeyPickup" parent="Pickups" parent_id_path=PackedInt32Array(1113969064) index="1" unique_id=85412946 instance=ExtResource("21_jk2b3")]
|
[node name="TriangleKeyPickup" parent="Pickups" parent_id_path=PackedInt32Array(1113969064) index="1" unique_id=85412946 instance=ExtResource("21_jk2b3")]
|
||||||
position = Vector2(857, 136)
|
position = Vector2(857, 136)
|
||||||
|
|
||||||
[node name="BlackEnemy" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="0" unique_id=129671926 instance=ExtResource("22_b1xny")]
|
[node name="BlackCultist1" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="0" unique_id=129671926 instance=ExtResource("22_b1xny")]
|
||||||
position = Vector2(1041, 352)
|
position = Vector2(1041, 352)
|
||||||
type = 1
|
|
||||||
initial_state = 1
|
|
||||||
|
|
||||||
[node name="BlackEnemy2" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="1" unique_id=1222909487 instance=ExtResource("22_b1xny")]
|
[node name="BlackCultist2" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="1" unique_id=1222909487 instance=ExtResource("22_b1xny")]
|
||||||
position = Vector2(477, 160)
|
position = Vector2(403, 160)
|
||||||
type = 1
|
|
||||||
initial_state = 1
|
|
||||||
|
|
||||||
[node name="WhiteEnemy" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="2" unique_id=503464276 instance=ExtResource("23_8555i")]
|
[node name="WhiteCultist1" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="2" unique_id=503464276 instance=ExtResource("23_8555i")]
|
||||||
position = Vector2(587, 368)
|
position = Vector2(587, 368)
|
||||||
type = 1
|
|
||||||
initial_state = 2
|
|
||||||
|
|
||||||
[node name="WhiteEnemy2" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="3" unique_id=624398972 instance=ExtResource("23_8555i")]
|
[node name="WhiteCultist2" parent="Enemies" parent_id_path=PackedInt32Array(857989772) index="3" unique_id=624398972 instance=ExtResource("23_8555i")]
|
||||||
position = Vector2(493, 160)
|
position = Vector2(549, 160)
|
||||||
type = 1
|
|
||||||
initial_state = 2
|
|
||||||
|
|
||||||
[node name="Player" parent="." index="4" unique_id=1058744997]
|
[node name="Player" parent="." index="4" unique_id=1058744997]
|
||||||
position = Vector2(208, -162)
|
position = Vector2(208, -162)
|
||||||
|
|||||||
+18
-124
@@ -1,67 +1,30 @@
|
|||||||
extends AbstractLevel
|
extends AbstractLevel
|
||||||
|
|
||||||
|
|
||||||
const CUTSCENE_CAMERA_TIME = 5
|
|
||||||
const CUTSCENE_HAZE_TIME = 0.1
|
|
||||||
|
|
||||||
const CUTSCENE_HAZE_TIME_BY_PHASE : Dictionary[int, float] = {
|
|
||||||
1: CUTSCENE_HAZE_TIME,
|
|
||||||
3: CUTSCENE_HAZE_TIME,
|
|
||||||
5: CUTSCENE_HAZE_TIME,
|
|
||||||
7: CUTSCENE_HAZE_TIME,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var _cutscene_phase := 0
|
|
||||||
var _player_walk_speed : int
|
|
||||||
var _cutscene_player_speed_factor := 0.5
|
|
||||||
|
|
||||||
var _function_by_phase : Dictionary[int, Callable] = {
|
|
||||||
1: _do_cutscene_phase_one,
|
|
||||||
4: _do_cutscene_phase_four,
|
|
||||||
6: _do_cutscene_phase_six,
|
|
||||||
7: _do_cutscene_phase_seven,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@onready var cutscene_camera : Camera2D = $Cutscene/Camera2D
|
|
||||||
@onready var cutscene_haze : Polygon2D = $%CutsceneHaze
|
@onready var cutscene_haze : Polygon2D = $%CutsceneHaze
|
||||||
@onready var cutscene_thanks : Label = $CanvasLayer/MarginContainer/ThanksLabel
|
|
||||||
|
|
||||||
@onready var cutscene_haze_timer : Timer = $Cutscene/HazeTimer
|
@onready var cutscene_haze_timer : Timer = $Cutscene/HazeTimer
|
||||||
@onready var cutscene_player_timer : Timer = $Cutscene/PlayerTimer
|
|
||||||
@onready var cutscene_enemy_timer : Timer = $Cutscene/EnemyTimer
|
|
||||||
@onready var cutscene_end_timer : Timer = $Cutscene/EndTimer
|
|
||||||
|
|
||||||
@onready var cutscene_fake_player : AnimatedSprite2D = $Cutscene/FakePlayer
|
@onready var animation_player : AnimationPlayer = $AnimationPlayer
|
||||||
@onready var cutscene_fake_enemy : AnimatedSprite2D = $Cutscene/FakeEnemy
|
@onready var cutscene_camera : Camera2D = $Cutscene/Camera2D
|
||||||
|
|
||||||
@onready var enemy_waves_by_phase : Dictionary[int, Node2D] = {
|
|
||||||
3: $Cutscene/EnemyWaves/WaveOne,
|
|
||||||
5: $Cutscene/EnemyWaves/WaveTwo,
|
|
||||||
7: $Cutscene/EnemyWaves/WaveThree,
|
|
||||||
}
|
|
||||||
|
|
||||||
@onready var cutscene_room_center : Vector2 = $Cutscene/RoomCenter.position
|
@onready var cutscene_room_center : Vector2 = $Cutscene/RoomCenter.position
|
||||||
@onready var PLAYER_TARGET_POSITION_BY_PHASE : Dictionary[int, Vector2] = {
|
|
||||||
1: $Cutscene/PlayerTargetPositions/PhaseOne.global_position,
|
|
||||||
2: $Cutscene/PlayerTargetPositions/PhaseTwo.global_position,
|
|
||||||
3: $Cutscene/PlayerTargetPositions/PhaseThree.global_position,
|
|
||||||
4: $Cutscene/PlayerTargetPositions/PhaseFour.global_position,
|
|
||||||
5: $Cutscene/PlayerTargetPositions/PhaseFive.global_position,
|
|
||||||
6: $Cutscene/FakeEnemy.global_position,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
super._ready()
|
super._ready()
|
||||||
_player_walk_speed = player.max_speed
|
animation_player.play("hide_cutscene_elements")
|
||||||
cutscene_haze.hide()
|
|
||||||
cutscene_fake_player.hide()
|
|
||||||
cutscene_fake_enemy.hide()
|
func _on_level_end_entered(body: Node2D) -> void:
|
||||||
cutscene_thanks.hide()
|
if body is Player:
|
||||||
for phase in enemy_waves_by_phase:
|
_play_cutscene()
|
||||||
enemy_waves_by_phase[phase].hide()
|
|
||||||
|
|
||||||
|
func _play_cutscene() -> void:
|
||||||
|
player.queue_free()
|
||||||
|
cutscene_camera.enabled = true
|
||||||
|
cutscene_camera.make_current()
|
||||||
|
animation_player.play("final_cutscene")
|
||||||
|
|
||||||
|
|
||||||
func _show_cutscene_haze(time: float) -> void:
|
func _show_cutscene_haze(time: float) -> void:
|
||||||
@@ -70,79 +33,10 @@ func _show_cutscene_haze(time: float) -> void:
|
|||||||
cutscene_haze_timer.start(time)
|
cutscene_haze_timer.start(time)
|
||||||
|
|
||||||
|
|
||||||
func _next_cutscene_phase() -> void:
|
|
||||||
_cutscene_phase += 1
|
|
||||||
|
|
||||||
if _function_by_phase.has(_cutscene_phase):
|
|
||||||
_function_by_phase[_cutscene_phase].call()
|
|
||||||
|
|
||||||
if CUTSCENE_HAZE_TIME_BY_PHASE.has(_cutscene_phase):
|
|
||||||
_show_cutscene_haze(CUTSCENE_HAZE_TIME_BY_PHASE[_cutscene_phase])
|
|
||||||
|
|
||||||
if enemy_waves_by_phase.has(_cutscene_phase):
|
|
||||||
enemy_waves_by_phase[_cutscene_phase].show()
|
|
||||||
|
|
||||||
if PLAYER_TARGET_POSITION_BY_PHASE.has(_cutscene_phase):
|
|
||||||
var target_pos := PLAYER_TARGET_POSITION_BY_PHASE[_cutscene_phase]
|
|
||||||
var time := _get_player_move_time(cutscene_fake_player.position, target_pos)
|
|
||||||
var tween : Tween = create_tween()
|
|
||||||
tween.tween_property(cutscene_fake_player, "position", target_pos, time)
|
|
||||||
tween.finished.connect(_next_cutscene_phase)
|
|
||||||
|
|
||||||
|
|
||||||
func _do_cutscene_phase_one() -> void:
|
|
||||||
player.queue_free()
|
|
||||||
cutscene_camera.position = player.position
|
|
||||||
cutscene_camera.enabled = true
|
|
||||||
cutscene_camera.make_current()
|
|
||||||
cutscene_fake_player.show()
|
|
||||||
cutscene_fake_player.play(Player.ANIMATION_WALK_RIGHT, _cutscene_player_speed_factor)
|
|
||||||
var tween : Tween = create_tween()
|
|
||||||
tween.set_ease(Tween.EASE_IN_OUT)
|
|
||||||
tween.set_trans(Tween.TRANS_QUAD)
|
|
||||||
tween.tween_property(cutscene_camera, "position", cutscene_room_center, CUTSCENE_CAMERA_TIME)
|
|
||||||
|
|
||||||
|
|
||||||
func _do_cutscene_phase_four() -> void:
|
|
||||||
cutscene_fake_player.play(Player.ANIMATION_WALK_LEFT,_cutscene_player_speed_factor)
|
|
||||||
|
|
||||||
|
|
||||||
func _do_cutscene_phase_six() -> void:
|
|
||||||
_cutscene_player_speed_factor = 0.25
|
|
||||||
cutscene_fake_player.play(Player.ANIMATION_WALK_RIGHT, _cutscene_player_speed_factor)
|
|
||||||
|
|
||||||
|
|
||||||
func _do_cutscene_phase_seven() -> void:
|
|
||||||
cutscene_fake_player.play("look_around", 0.5)
|
|
||||||
cutscene_player_timer.start()
|
|
||||||
|
|
||||||
|
|
||||||
func _get_player_move_time(initial_pos: Vector2, target_pos: Vector2) -> float:
|
|
||||||
var distance := initial_pos.distance_to(target_pos)
|
|
||||||
return distance / (_player_walk_speed * _cutscene_player_speed_factor)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_level_end_entered(body: Node2D) -> void:
|
|
||||||
if body is Player:
|
|
||||||
_next_cutscene_phase()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_haze_timer_timeout() -> void:
|
func _on_haze_timer_timeout() -> void:
|
||||||
cutscene_haze.hide()
|
cutscene_haze.hide()
|
||||||
|
|
||||||
|
|
||||||
func _on_player_timer_timeout() -> void:
|
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||||
_show_cutscene_haze(CUTSCENE_HAZE_TIME)
|
if anim_name == "final_cutscene":
|
||||||
cutscene_fake_player.queue_free()
|
_complete_level(cutscene_room_center)
|
||||||
cutscene_fake_enemy.show()
|
|
||||||
cutscene_fake_enemy.play("look_around", 0.5)
|
|
||||||
cutscene_enemy_timer.start()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_enemy_timer_timeout() -> void:
|
|
||||||
cutscene_thanks.show()
|
|
||||||
cutscene_end_timer.start()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_end_timer_timeout() -> void:
|
|
||||||
_complete_level(cutscene_room_center)
|
|
||||||
|
|||||||
+480
-104
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user