Compare commits
2 Commits
cbfbd9f4d8
...
22475d78c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 22475d78c2 | |||
| 59d71a4c57 |
@@ -3,24 +3,15 @@
|
||||
[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_cultist.gd" id="2_rd56i"]
|
||||
[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"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ejk4w"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("3_r5rx0")
|
||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = false
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 5.0
|
||||
shader_parameter/intensity = 1.0
|
||||
shader_parameter/scale = 20.0
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_c7l74"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="AbstractColorCultist" unique_id=644641841 instance=ExtResource("1_12hr0")]
|
||||
script = ExtResource("2_rd56i")
|
||||
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||
material = SubResource("ShaderMaterial_ejk4w")
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=797412888]
|
||||
texture = SubResource("ViewportTexture_c7l74")
|
||||
|
||||
[node name="CollisionSwitcher" parent="." index="2" unique_id=991274552 node_paths=PackedStringArray("object") instance=ExtResource("3_e5cea")]
|
||||
object = NodePath("..")
|
||||
|
||||
@@ -13,7 +13,8 @@ const FALL_GRAVITY_FACTOR = 1.5
|
||||
var target_x := 0.0
|
||||
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $CultistSprite
|
||||
@onready var sprite : Sprite2D = $CultistSprite
|
||||
@onready var animated_sprite : AnimatedSprite2D = $SubViewport/CultistSprite
|
||||
|
||||
@onready var left_wall_high_ray : RayCast2D = $WallCheckHigh/LeftWallRay
|
||||
@onready var right_wall_high_ray : RayCast2D = $WallCheckHigh/RightWallRay
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
[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="ViewportTexture" id="ViewportTexture_cqp7f"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_mocsw"]
|
||||
radius = 4.0
|
||||
height = 28.0
|
||||
@@ -28,7 +31,17 @@ height = 28.0
|
||||
collision_layer = 0
|
||||
script = ExtResource("1_2wrno")
|
||||
|
||||
[node name="CultistSprite" parent="." unique_id=1997264413 instance=ExtResource("2_tjvyk")]
|
||||
[node name="CultistSprite" type="Sprite2D" parent="." unique_id=797412888]
|
||||
texture = SubResource("ViewportTexture_cqp7f")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="." unique_id=903152885]
|
||||
transparent_bg = true
|
||||
canvas_item_default_texture_filter = 0
|
||||
size = Vector2i(16, 32)
|
||||
|
||||
[node name="CultistSprite" parent="SubViewport" unique_id=1997264413 instance=ExtResource("2_tjvyk")]
|
||||
material = null
|
||||
position = Vector2(8, 16)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=185651284]
|
||||
position = Vector2(0, 2)
|
||||
|
||||
@@ -2,34 +2,27 @@
|
||||
|
||||
[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_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="Material" uid="uid://dggr8t4b30e3n" path="res://game/materials/enemy_black.tres" id="3_v1if5"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v1if5"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("3_3jy5n")
|
||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = true
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 5.0
|
||||
shader_parameter/intensity = 1.0
|
||||
shader_parameter/scale = 20.0
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_q6bby"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="BlackCultist" unique_id=1910124567 instance=ExtResource("1_gj2ks")]
|
||||
collision_layer = 4
|
||||
collision_mask = 3
|
||||
script = ExtResource("2_332ds")
|
||||
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||
material = SubResource("ShaderMaterial_v1if5")
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=797412888]
|
||||
material = ExtResource("3_v1if5")
|
||||
texture = SubResource("ViewportTexture_q6bby")
|
||||
|
||||
[node name="CollisionSwitcher" parent="." index="2" unique_id=991274552]
|
||||
initial_state = 0
|
||||
|
||||
[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 = 3
|
||||
|
||||
[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 = 3
|
||||
|
||||
[node name="LeftPlayerCloseRay" parent="PlayerCloseCheck" parent_id_path=PackedInt32Array(1593775088) index="0" unique_id=947570027]
|
||||
@@ -46,5 +39,5 @@ collision_mask = 11
|
||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||
collision_mask = 11
|
||||
|
||||
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||
[node name="KillingArea" parent="." index="8" unique_id=1891922549]
|
||||
collision_mask = 8
|
||||
|
||||
@@ -4,13 +4,17 @@
|
||||
[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"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_b3gyl"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="GrayCultist" unique_id=139812221 instance=ExtResource("1_q3s46")]
|
||||
collision_layer = 16
|
||||
collision_mask = 35
|
||||
script = ExtResource("2_olede")
|
||||
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=797412888]
|
||||
material = ExtResource("3_ho47d")
|
||||
texture = SubResource("ViewportTexture_b3gyl")
|
||||
|
||||
[node name="LeftWallRay" parent="WallCheckLow" parent_id_path=PackedInt32Array(782156094) index="0" unique_id=521416854]
|
||||
collision_mask = 35
|
||||
@@ -30,5 +34,5 @@ collision_mask = 171
|
||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||
collision_mask = 171
|
||||
|
||||
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||
[node name="KillingArea" parent="." index="7" unique_id=1891922549]
|
||||
collision_mask = 136
|
||||
|
||||
@@ -9,7 +9,7 @@ func init() -> void:
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_CHASE_LEFT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_CHASE_LEFT)
|
||||
|
||||
|
||||
func _is_target_reached() -> bool:
|
||||
|
||||
@@ -9,7 +9,7 @@ func init() -> void:
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_CHASE_RIGHT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_CHASE_RIGHT)
|
||||
|
||||
|
||||
func _is_target_reached() -> bool:
|
||||
|
||||
@@ -4,4 +4,4 @@ extends CultistJumpState
|
||||
func enter() -> void:
|
||||
super.enter()
|
||||
_direction = DIRECTION_LEFT
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_JUMP_LEFT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_JUMP_LEFT)
|
||||
|
||||
@@ -4,4 +4,4 @@ extends CultistJumpState
|
||||
func enter() -> void:
|
||||
super.enter()
|
||||
_direction = DIRECTION_RIGHT
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_JUMP_RIGHT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_JUMP_RIGHT)
|
||||
|
||||
@@ -2,4 +2,4 @@ extends CultistFallSidewaysState
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_FALL_LEFT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_FALL_LEFT)
|
||||
|
||||
@@ -2,4 +2,4 @@ extends CultistFallSidewaysState
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_FALL_RIGHT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_FALL_RIGHT)
|
||||
|
||||
@@ -6,7 +6,7 @@ extends CultistState
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_FALL)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_FALL)
|
||||
|
||||
|
||||
func physics_process(delta: float) -> void:
|
||||
|
||||
@@ -12,8 +12,8 @@ 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.animated_sprite.animation_finished.connect(_on_animation_finished)
|
||||
cultist.animated_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)
|
||||
@@ -36,7 +36,7 @@ func physics_process(_delta: float) -> void:
|
||||
|
||||
|
||||
func exit() -> void:
|
||||
cultist.sprite.animation_finished.disconnect(_on_animation_finished)
|
||||
cultist.animated_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)
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@ func init() -> void:
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_WALK_LEFT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_WALK_LEFT)
|
||||
|
||||
@@ -9,4 +9,4 @@ func init() -> void:
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
cultist.sprite.play(CultistSprite.ANIMATION_WALK_RIGHT)
|
||||
cultist.animated_sprite.play(CultistSprite.ANIMATION_WALK_RIGHT)
|
||||
|
||||
@@ -2,31 +2,24 @@
|
||||
|
||||
[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_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="Material" uid="uid://ci7xuso12af5" path="res://game/materials/enemy_white.tres" id="3_36f86"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_36f86"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("3_uj6yw")
|
||||
shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = false
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 5.0
|
||||
shader_parameter/intensity = 1.0
|
||||
shader_parameter/scale = 20.0
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_fb5t4"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="WhiteEnemy" unique_id=486389199 instance=ExtResource("1_3yi7g")]
|
||||
collision_layer = 64
|
||||
collision_mask = 33
|
||||
script = ExtResource("2_c7pdf")
|
||||
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=1997264413]
|
||||
material = SubResource("ShaderMaterial_36f86")
|
||||
[node name="CultistSprite" parent="." index="0" unique_id=797412888]
|
||||
material = ExtResource("3_36f86")
|
||||
texture = SubResource("ViewportTexture_fb5t4")
|
||||
|
||||
[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 = 33
|
||||
|
||||
[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 = 33
|
||||
|
||||
[node name="LeftPlayerCloseRay" parent="PlayerCloseCheck" parent_id_path=PackedInt32Array(1593775088) index="0" unique_id=947570027]
|
||||
@@ -43,5 +36,5 @@ collision_mask = 161
|
||||
[node name="RightPlayerDistantRay" parent="PlayerDistantCheck" parent_id_path=PackedInt32Array(1597489123) index="1" unique_id=1377654831]
|
||||
collision_mask = 161
|
||||
|
||||
[node name="KillingArea" parent="." index="6" unique_id=1891922549]
|
||||
[node name="KillingArea" parent="." index="8" unique_id=1891922549]
|
||||
collision_mask = 128
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
[ext_resource type="PackedScene" uid="uid://mpsu4g2b5h3a" path="res://game/levels/abstract_level.tscn" id="1_15okj"]
|
||||
[ext_resource type="Script" uid="uid://bc114fx0hcb6s" path="res://game/levels/test_level.gd" id="2_a2sw7"]
|
||||
[ext_resource type="PackedScene" uid="uid://ct6n0u0iegynv" path="res://game/doors/lever_door.tscn" id="2_r01v2"]
|
||||
[ext_resource type="PackedScene" uid="uid://guvijso3k6eq" path="res://game/platform/abstract_platform.tscn" id="3_pmn5w"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3kyqvuxmfn8f" path="res://game/objects/decorative/fireplace.tscn" id="3_tuvkr"]
|
||||
[ext_resource type="PackedScene" uid="uid://jab32eoyc523" path="res://game/platform/self_moving_platform.tscn" id="4_h1708"]
|
||||
[ext_resource type="PackedScene" uid="uid://g0n5npbt3hb2" path="res://game/doors/circle_door.tscn" id="4_yrqjd"]
|
||||
[ext_resource type="PackedScene" uid="uid://cojxqx5al7kyv" path="res://game/doors/locked_door.tscn" id="5_1skah"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwvv5dj8lqif2" path="res://game/doors/triangle_door.tscn" id="6_75eok"]
|
||||
@@ -25,13 +25,38 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bv2gahb4wxgb1" path="res://game/characters/enemies/white_cultist.tscn" id="20_rt0xo"]
|
||||
[ext_resource type="PackedScene" uid="uid://wpkj48bqyuy2" path="res://game/platform/abstract_color_platform.tscn" id="24_h1708"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_h1708"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 229, -75, 0, 0, 0, 0, 47, -75, 0, 0, 0, 0, 160, -26, 0, 0, 0, 0, 229, -75)
|
||||
}
|
||||
point_count = 4
|
||||
|
||||
[node name="TestLevel" unique_id=600627332 instance=ExtResource("1_15okj")]
|
||||
script = ExtResource("2_a2sw7")
|
||||
|
||||
[node name="AbstractPlatform" parent="Platforms" parent_id_path=PackedInt32Array(1140671629) index="0" unique_id=1226827206 instance=ExtResource("3_pmn5w")]
|
||||
position = Vector2(180, -51)
|
||||
[node name="AbstractColoredPlatform" parent="Platforms" parent_id_path=PackedInt32Array(1140671629) index="0" unique_id=137546339 instance=ExtResource("24_h1708")]
|
||||
position = Vector2(274, -81)
|
||||
platform_width = 48
|
||||
|
||||
[node name="SelfMovingPlatform" parent="Platforms" parent_id_path=PackedInt32Array(1140671629) index="1" unique_id=349378100 node_paths=PackedStringArray("path_follow") instance=ExtResource("4_h1708")]
|
||||
position = Vector2(201.03143, -75)
|
||||
rotation = -3.1415925
|
||||
is_loop = true
|
||||
path_follow = NodePath("../Path2D/PathFollow2D")
|
||||
platform_width = 104
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="Platforms" parent_id_path=PackedInt32Array(1140671629) index="2" unique_id=1306055237]
|
||||
curve = SubResource("Curve2D_h1708")
|
||||
|
||||
[node name="PathFollow2D" type="PathFollow2D" parent="Platforms/Path2D" index="0" unique_id=1206016336]
|
||||
position = Vector2(201.03143, -75)
|
||||
rotation = 3.1415927
|
||||
progress = 27.97701
|
||||
rotates = false
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Platforms/Path2D/PathFollow2D" index="0" unique_id=1642833722]
|
||||
remote_path = NodePath("../../../SelfMovingPlatform")
|
||||
|
||||
[node name="LeverDoor" parent="Doors" parent_id_path=PackedInt32Array(1468144392) index="0" unique_id=1575363350 instance=ExtResource("2_r01v2")]
|
||||
position = Vector2(416, -56)
|
||||
|
||||
@@ -115,7 +140,3 @@ position = Vector2(1334, 103)
|
||||
|
||||
[node name="CollisionShape2D" parent="LevelEnd" index="0" unique_id=937956890]
|
||||
position = Vector2(42, 59)
|
||||
|
||||
[node name="AbstractColoredPlatform" parent="." index="10" unique_id=137546339 instance=ExtResource("24_h1708")]
|
||||
position = Vector2(274, -81)
|
||||
platform_width = 48
|
||||
|
||||
@@ -9,7 +9,7 @@ shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = true
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 1.0
|
||||
shader_parameter/speed = 3.0
|
||||
shader_parameter/intensity = 1.0
|
||||
shader_parameter/scale = 50.0
|
||||
shader_parameter/scale = 5.0
|
||||
shader_parameter/use_world_pos = false
|
||||
|
||||
@@ -8,7 +8,7 @@ shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = false
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 1.0
|
||||
shader_parameter/speed = 3.0
|
||||
shader_parameter/intensity = 0.5
|
||||
shader_parameter/scale = 50.0
|
||||
shader_parameter/scale = 5.0
|
||||
shader_parameter/use_world_pos = false
|
||||
|
||||
@@ -9,7 +9,7 @@ shader_parameter/black_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/white_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/switch_colors = false
|
||||
shader_parameter/threshold = 0.5
|
||||
shader_parameter/speed = 1.0
|
||||
shader_parameter/speed = 3.0
|
||||
shader_parameter/intensity = 1.0
|
||||
shader_parameter/scale = 50.0
|
||||
shader_parameter/scale = 5.0
|
||||
shader_parameter/use_world_pos = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@tool
|
||||
class_name AbstractPlatform
|
||||
extends Node2D
|
||||
extends AnimatableBody2D
|
||||
|
||||
|
||||
const TILE_SIZE = 8
|
||||
@@ -23,8 +23,9 @@ const MAX_WIDTH = TILE_SIZE * 32
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if not Engine.is_editor_hint():
|
||||
platform_rect.material.set_shader_parameter("seed", randf())
|
||||
platform_rect.material.set_shader_parameter("tile_size", TILE_SIZE)
|
||||
platform_rect.material.set_shader_parameter("seed", randf())
|
||||
rebuild_platform()
|
||||
|
||||
|
||||
@@ -32,14 +33,11 @@ func rebuild_platform() -> void:
|
||||
var shape := collision.shape as RectangleShape2D
|
||||
shape.size.x = platform_width
|
||||
|
||||
sub_viewport.size = Vector2(platform_width, TILE_SIZE)
|
||||
var platfor_size := Vector2(platform_width, TILE_SIZE)
|
||||
|
||||
sub_viewport.size = platfor_size
|
||||
icon_sprite.position = platfor_size/2
|
||||
platform_rect.size.x = platform_width
|
||||
platform_rect.position = Vector2.ZERO
|
||||
icon_sprite.position = Vector2.ZERO
|
||||
|
||||
platform_rect.material.set_shader_parameter("platform_width", platform_width)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://egknefyib2ui"]
|
||||
|
||||
[node name="PlatformPath" type="Line2D" unique_id=2089103569]
|
||||
@@ -0,0 +1,50 @@
|
||||
@tool
|
||||
class_name SelfMovingPlatform
|
||||
extends AbstractPlatform
|
||||
|
||||
|
||||
const SPEED_FACTOR = 0.025
|
||||
const ANIMATION_ACTIVE = "active"
|
||||
|
||||
|
||||
@export var is_loop := false
|
||||
@export var path_follow : PathFollow2D
|
||||
@export_range(0, 25, 0.1) var speed : float = 10.0
|
||||
|
||||
|
||||
var is_reverse := false
|
||||
var tween: Tween
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
icon_sprite.play(ANIMATION_ACTIVE)
|
||||
if not Engine.is_editor_hint():
|
||||
_start_movement()
|
||||
|
||||
|
||||
func _start_movement() -> void:
|
||||
if tween and tween.is_running():
|
||||
tween.kill()
|
||||
|
||||
var target := 0.0 if is_reverse else 1.0
|
||||
var distance := absf(target - path_follow.progress_ratio)
|
||||
var duration := distance / (speed * SPEED_FACTOR)
|
||||
|
||||
tween = create_tween()
|
||||
|
||||
if not is_loop:
|
||||
tween.set_trans(Tween.TRANS_SINE)
|
||||
tween.set_ease(Tween.EASE_IN_OUT)
|
||||
tween.finished.connect(_on_tween_finished)
|
||||
|
||||
tween.tween_property(path_follow, "progress_ratio", target, duration)
|
||||
|
||||
|
||||
func _on_tween_finished() -> void:
|
||||
if is_loop:
|
||||
path_follow.progress_ratio = 0
|
||||
else:
|
||||
is_reverse = not is_reverse
|
||||
|
||||
_start_movement()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cwji3vqis6w6b
|
||||
@@ -0,0 +1,119 @@
|
||||
[gd_scene format=3 uid="uid://jab32eoyc523"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://guvijso3k6eq" path="res://game/platform/abstract_platform.tscn" id="1_jmy7p"]
|
||||
[ext_resource type="Script" uid="uid://cwji3vqis6w6b" path="res://game/platform/self_moving_platform.gd" id="2_ayqtn"]
|
||||
[ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="2_ex4q8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="3_ayqtn"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi2h4g71bro7v" path="res://images/level/platform-icons.png" id="5_ayqtn"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_ayqtn"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v7ftt"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("2_ex4q8")
|
||||
shader_parameter/tile_size = 8.0
|
||||
shader_parameter/platform_width = 24.0
|
||||
shader_parameter/atlas = ExtResource("3_ayqtn")
|
||||
shader_parameter/seed = 0.94376683
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_v7ftt"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(0, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xuyth"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(8, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4wvh7"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(16, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q6fss"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(24, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_myyrw"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(32, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q3dcw"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(40, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gb0pd"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(32, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sqmiv"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(24, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mvt4t"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(16, 48, 8, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ppe0t"]
|
||||
atlas = ExtResource("5_ayqtn")
|
||||
region = Rect2(8, 48, 8, 8)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_22kvf"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_v7ftt")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xuyth")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4wvh7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_q6fss")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_myyrw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_q3dcw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gb0pd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sqmiv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mvt4t")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ppe0t")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"active",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xuyth"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(16, 7)
|
||||
|
||||
[node name="SelfMovingPlatform" unique_id=137546339 instance=ExtResource("1_jmy7p")]
|
||||
script = ExtResource("2_ayqtn")
|
||||
speed = 10.0
|
||||
|
||||
[node name="Sprite2D" parent="." index="0" unique_id=264863796]
|
||||
texture = SubResource("ViewportTexture_ayqtn")
|
||||
|
||||
[node name="PlatformRect" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="0" unique_id=794315918]
|
||||
material = SubResource("ShaderMaterial_v7ftt")
|
||||
|
||||
[node name="IconSprite" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="1" unique_id=1917841765]
|
||||
position = Vector2(8, 4)
|
||||
sprite_frames = SubResource("SpriteFrames_22kvf")
|
||||
animation = &"active"
|
||||
frame_progress = 0.974508
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="2" unique_id=175449124]
|
||||
shape = SubResource("RectangleShape2D_xuyth")
|
||||
Reference in New Issue
Block a user