Compare commits
4 Commits
eeefca4d4e
...
53ebbbbac3
| Author | SHA1 | Date | |
|---|---|---|---|
| 53ebbbbac3 | |||
| 551dc09485 | |||
| 814d9736d0 | |||
| adaeb35fdd |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
/android/
|
/android/
|
||||||
builds/
|
builds/.worktrees/
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
[gd_scene load_steps=57 format=3 uid="uid://bqi5s710xb1ju"]
|
[gd_scene format=3 uid="uid://bqi5s710xb1ju"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
|
[ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
|
||||||
|
[ext_resource type="Resource" uid="uid://vgutbpovj8hc" path="res://resources/movement_presets/platform_movement.tres" id="2_7til7"]
|
||||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bcv8kx6bc7u5e" path="res://objects/movement_abilities/ground_ability.tscn" id="2_oefns"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
|
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d0r5edxnx5jqx" path="res://objects/movement_abilities/variable_jump_ability.tscn" id="3_bnap0"]
|
|
||||||
[ext_resource type="Script" uid="uid://bf4yclropol43" path="res://scripts/components/Movement/GroundMovementAbility.cs" id="4_7til7"]
|
[ext_resource type="Script" uid="uid://bf4yclropol43" path="res://scripts/components/Movement/GroundMovementAbility.cs" id="4_7til7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
|
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cala7bpo1v4no" path="res://objects/movement_abilities/gravity_ability.tscn" id="4_qec3q"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bty3jq8u0pxkf" path="res://objects/movement_abilities/one_way_platform_ability.tscn" id="5_dhjci"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"]
|
[ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bu3vuxlrvoo1t" path="res://objects/movement_abilities/spaceship_ability.tscn" id="6_721q0"]
|
|
||||||
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="6_xuhvf"]
|
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="6_xuhvf"]
|
||||||
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="7_bl1gx"]
|
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="7_bl1gx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chjbi5mgtwhsh" path="res://objects/movement_abilities/wall_jump_ability.tscn" id="7_bnap0"]
|
|
||||||
[ext_resource type="Script" uid="uid://ck6kmnbwhsttt" path="res://scripts/components/Movement/OneWayPlatformAbility.cs" id="7_uno3u"]
|
[ext_resource type="Script" uid="uid://ck6kmnbwhsttt" path="res://scripts/components/Movement/OneWayPlatformAbility.cs" id="7_uno3u"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"]
|
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dre1vit1m4d2n" path="res://objects/movement_abilities/grid_movement_ability.tscn" id="8_xuhvf"]
|
|
||||||
[ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
|
[ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
|
||||||
[ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
|
[ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
|
||||||
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
|
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
|
||||||
@@ -75,7 +69,7 @@ point_count = 2
|
|||||||
[sub_resource type="CurveTexture" id="CurveTexture_xoue7"]
|
[sub_resource type="CurveTexture" id="CurveTexture_xoue7"]
|
||||||
curve = SubResource("Curve_82d6e")
|
curve = SubResource("Curve_82d6e")
|
||||||
|
|
||||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_lgb3u"]
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_e5pae"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
lifetime_randomness = 1.0
|
lifetime_randomness = 1.0
|
||||||
particle_flag_disable_z = true
|
particle_flag_disable_z = true
|
||||||
@@ -92,227 +86,221 @@ scale_curve = SubResource("CurveTexture_xoue7")
|
|||||||
color = Color(0.764706, 0.443137, 0, 1)
|
color = Color(0.764706, 0.443137, 0, 1)
|
||||||
color_ramp = SubResource("GradientTexture1D_lgb3u")
|
color_ramp = SubResource("GradientTexture1D_lgb3u")
|
||||||
|
|
||||||
[node name="Brick Player" type="CharacterBody2D" node_paths=PackedStringArray("MovementAbilitiesContainer") groups=["player"]]
|
[node name="Brick Player" type="CharacterBody2D" unique_id=634211282 node_paths=PackedStringArray("MovementAbilitiesContainer") groups=["player"]]
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 107
|
collision_mask = 107
|
||||||
script = ExtResource("1_yysbb")
|
script = ExtResource("1_yysbb")
|
||||||
MovementAbilitiesContainer = NodePath("Movements")
|
MovementAbilitiesContainer = NodePath("Movements")
|
||||||
GroundMovementScene = ExtResource("2_oefns")
|
DefaultPreset = ExtResource("2_7til7")
|
||||||
JumpMovementScene = ExtResource("3_bnap0")
|
|
||||||
GravityScene = ExtResource("4_qec3q")
|
|
||||||
OneWayPlatformScene = ExtResource("5_dhjci")
|
|
||||||
SpaceshipMovementScene = ExtResource("6_721q0")
|
|
||||||
WallJumpScene = ExtResource("7_bnap0")
|
|
||||||
GridMovementScene = ExtResource("8_xuhvf")
|
|
||||||
metadata/_custom_type_script = "uid://csel4s0e4g5uf"
|
metadata/_custom_type_script = "uid://csel4s0e4g5uf"
|
||||||
|
|
||||||
[node name="Movements" type="Node" parent="."]
|
[node name="Movements" type="Node" parent="." unique_id=1545001]
|
||||||
|
|
||||||
[node name="GroundMovementAbility" type="Node" parent="Movements"]
|
[node name="GroundMovementAbility" type="Node" parent="Movements" unique_id=1025594633]
|
||||||
script = ExtResource("4_7til7")
|
script = ExtResource("4_7til7")
|
||||||
MaxSpeed = 376.0
|
MaxSpeed = 376.0
|
||||||
Friction = 2500.0
|
Friction = 2500.0
|
||||||
metadata/_custom_type_script = "uid://bf4yclropol43"
|
metadata/_custom_type_script = "uid://bf4yclropol43"
|
||||||
|
|
||||||
[node name="GravityAbility" type="Node" parent="Movements"]
|
[node name="GravityAbility" type="Node" parent="Movements" unique_id=1144662059]
|
||||||
script = ExtResource("6_xuhvf")
|
script = ExtResource("6_xuhvf")
|
||||||
metadata/_custom_type_script = "uid://chgw53qwt7rt8"
|
metadata/_custom_type_script = "uid://chgw53qwt7rt8"
|
||||||
|
|
||||||
[node name="VariableJumpAbility" type="Node" parent="Movements"]
|
[node name="VariableJumpAbility" type="Node" parent="Movements" unique_id=632375899]
|
||||||
script = ExtResource("7_bl1gx")
|
script = ExtResource("7_bl1gx")
|
||||||
JumpCutMultiplier = 0.507
|
JumpCutMultiplier = 0.507
|
||||||
metadata/_custom_type_script = "uid://ccksp2e76s7sr"
|
metadata/_custom_type_script = "uid://ccksp2e76s7sr"
|
||||||
|
|
||||||
[node name="OneWayPlatformAbility" type="Node" parent="Movements"]
|
[node name="OneWayPlatformAbility" type="Node" parent="Movements" unique_id=800681205]
|
||||||
script = ExtResource("7_uno3u")
|
script = ExtResource("7_uno3u")
|
||||||
metadata/_custom_type_script = "uid://ck6kmnbwhsttt"
|
metadata/_custom_type_script = "uid://ck6kmnbwhsttt"
|
||||||
|
|
||||||
[node name="Graphics" type="Node2D" parent="."]
|
[node name="Graphics" type="Node2D" parent="." unique_id=271317654]
|
||||||
|
|
||||||
[node name="Root" type="Node2D" parent="Graphics"]
|
[node name="Root" type="Node2D" parent="Graphics" unique_id=2012260442]
|
||||||
|
|
||||||
[node name="Base" type="Sprite2D" parent="Graphics/Root"]
|
[node name="Base" type="Sprite2D" parent="Graphics/Root" unique_id=1178176210]
|
||||||
material = SubResource("ShaderMaterial_xoue7")
|
material = SubResource("ShaderMaterial_xoue7")
|
||||||
texture = ExtResource("5_yysbb")
|
texture = ExtResource("5_yysbb")
|
||||||
hframes = 5
|
hframes = 5
|
||||||
|
|
||||||
[node name="Left Eye" type="Sprite2D" parent="Graphics/Root"]
|
[node name="Left Eye" type="Sprite2D" parent="Graphics/Root" unique_id=653633051]
|
||||||
position = Vector2(-7, -6)
|
position = Vector2(-7, -6)
|
||||||
texture = ExtResource("3_2srrh")
|
texture = ExtResource("3_2srrh")
|
||||||
hframes = 2
|
hframes = 2
|
||||||
|
|
||||||
[node name="Right Eye" type="Sprite2D" parent="Graphics/Root"]
|
[node name="Right Eye" type="Sprite2D" parent="Graphics/Root" unique_id=721230787]
|
||||||
position = Vector2(6, -5)
|
position = Vector2(6, -5)
|
||||||
texture = ExtResource("4_ccn81")
|
texture = ExtResource("4_ccn81")
|
||||||
hframes = 2
|
hframes = 2
|
||||||
|
|
||||||
[node name="Ship" type="Sprite2D" parent="Graphics"]
|
[node name="Ship" type="Sprite2D" parent="Graphics" unique_id=1074443059]
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(1, 7)
|
position = Vector2(1, 7)
|
||||||
texture = ExtResource("8_6lsog")
|
texture = ExtResource("8_6lsog")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=22428429]
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(0, 0.5)
|
position = Vector2(0, 0.5)
|
||||||
shape = SubResource("RectangleShape2D_hdsg1")
|
shape = SubResource("RectangleShape2D_hdsg1")
|
||||||
|
|
||||||
[node name="FlipPlayerComponent" type="Node2D" parent="." node_paths=PackedStringArray("LeftEye", "RightEye", "PlayerController")]
|
[node name="FlipPlayerComponent" type="Node2D" parent="." unique_id=290535881 node_paths=PackedStringArray("LeftEye", "RightEye", "PlayerController")]
|
||||||
script = ExtResource("9_yysbb")
|
script = ExtResource("9_yysbb")
|
||||||
LeftEye = NodePath("../Graphics/Root/Left Eye")
|
LeftEye = NodePath("../Graphics/Root/Left Eye")
|
||||||
RightEye = NodePath("../Graphics/Root/Right Eye")
|
RightEye = NodePath("../Graphics/Root/Right Eye")
|
||||||
PlayerController = NodePath("..")
|
PlayerController = NodePath("..")
|
||||||
|
|
||||||
[node name="StompDamageArea" type="Area2D" parent="."]
|
[node name="StompDamageArea" type="Area2D" parent="." unique_id=2071262827]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 8
|
collision_mask = 8
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StompDamageArea"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StompDamageArea" unique_id=1230518642]
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(0, 1)
|
position = Vector2(0, 1)
|
||||||
shape = SubResource("RectangleShape2D_vad0t")
|
shape = SubResource("RectangleShape2D_vad0t")
|
||||||
|
|
||||||
[node name="CanPickUpComponent" type="Node" parent="."]
|
[node name="CanPickUpComponent" type="Node" parent="." unique_id=1912343790]
|
||||||
script = ExtResource("10_yysbb")
|
script = ExtResource("10_yysbb")
|
||||||
|
|
||||||
[node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx", "HealSfx")]
|
[node name="HealthComponent" type="Node2D" parent="." unique_id=278902432 node_paths=PackedStringArray("HurtSfx", "HealSfx")]
|
||||||
script = ExtResource("12_ur2y5")
|
script = ExtResource("12_ur2y5")
|
||||||
HurtSfx = NodePath("../sfx_hurt")
|
HurtSfx = NodePath("../sfx_hurt")
|
||||||
HealSfx = NodePath("../sfx_heal")
|
HealSfx = NodePath("../sfx_heal")
|
||||||
|
|
||||||
[node name="PlayerDeathComponent" type="Node2D" parent="." node_paths=PackedStringArray("DeathSfx", "HealthComponent")]
|
[node name="PlayerDeathComponent" type="Node2D" parent="." unique_id=1989490803 node_paths=PackedStringArray("DeathSfx", "HealthComponent")]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("13_7til7")
|
script = ExtResource("13_7til7")
|
||||||
DeathSfx = NodePath("../sfx_hurt")
|
DeathSfx = NodePath("../sfx_hurt")
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("FlashingComponent")]
|
[node name="InvulnerabilityComponent" type="Node" parent="." unique_id=963173254 node_paths=PackedStringArray("FlashingComponent")]
|
||||||
script = ExtResource("15_xuhvf")
|
script = ExtResource("15_xuhvf")
|
||||||
FlashingComponent = NodePath("../FlashingComponent Base")
|
FlashingComponent = NodePath("../FlashingComponent Base")
|
||||||
|
|
||||||
[node name="FlashingComponent Base" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
[node name="FlashingComponent Base" type="Node" parent="." unique_id=533766453 node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
||||||
script = ExtResource("16_uno3u")
|
script = ExtResource("16_uno3u")
|
||||||
Sprite = NodePath("../Graphics/Root/Base")
|
Sprite = NodePath("../Graphics/Root/Base")
|
||||||
FlashDuration = 1.0
|
FlashDuration = 1.0
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="FlashingComponent LEye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
[node name="FlashingComponent LEye" type="Node" parent="." unique_id=835038717 node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
||||||
script = ExtResource("16_uno3u")
|
script = ExtResource("16_uno3u")
|
||||||
Sprite = NodePath("../Graphics/Root/Left Eye")
|
Sprite = NodePath("../Graphics/Root/Left Eye")
|
||||||
FlashDuration = 1.0
|
FlashDuration = 1.0
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="FlashingComponent REye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
[node name="FlashingComponent REye" type="Node" parent="." unique_id=601265429 node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
||||||
script = ExtResource("16_uno3u")
|
script = ExtResource("16_uno3u")
|
||||||
Sprite = NodePath("../Graphics/Root/Right Eye")
|
Sprite = NodePath("../Graphics/Root/Right Eye")
|
||||||
FlashDuration = 1.0
|
FlashDuration = 1.0
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "Root")]
|
[node name="StompDamageComponent" type="Node" parent="." unique_id=1027107459 node_paths=PackedStringArray("Area", "Root")]
|
||||||
script = ExtResource("17_bl1gx")
|
script = ExtResource("17_bl1gx")
|
||||||
Damage = 4.0
|
Damage = 4.0
|
||||||
Area = NodePath("../StompDamageArea")
|
Area = NodePath("../StompDamageArea")
|
||||||
Root = NodePath("..")
|
Root = NodePath("..")
|
||||||
|
|
||||||
[node name="SkillUnlockerComponent" type="Node" parent="."]
|
[node name="SkillUnlockerComponent" type="Node" parent="." unique_id=496647555]
|
||||||
script = ExtResource("25_yysbb")
|
script = ExtResource("25_yysbb")
|
||||||
|
|
||||||
[node name="HitComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
|
[node name="HitComponent" type="Node" parent="." unique_id=131916578 node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
|
||||||
script = ExtResource("26_6n1ss")
|
script = ExtResource("26_6n1ss")
|
||||||
Sprite = NodePath("../Graphics/Root/Base")
|
Sprite = NodePath("../Graphics/Root/Base")
|
||||||
Health = NodePath("../HealthComponent")
|
Health = NodePath("../HealthComponent")
|
||||||
HitFx = NodePath("../HitParticles")
|
HitFx = NodePath("../HitParticles")
|
||||||
|
|
||||||
[node name="MagneticArea" type="Area2D" parent="."]
|
[node name="MagneticArea" type="Area2D" parent="." unique_id=1477305842]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="MagneticArea"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="MagneticArea" unique_id=1552683633]
|
||||||
visible = false
|
visible = false
|
||||||
shape = SubResource("CircleShape2D_ps31c")
|
shape = SubResource("CircleShape2D_ps31c")
|
||||||
|
|
||||||
[node name="CanBeLaunchedComponent" type="Node" parent="."]
|
[node name="CanBeLaunchedComponent" type="Node" parent="." unique_id=1998429478]
|
||||||
script = ExtResource("27_oefns")
|
script = ExtResource("27_oefns")
|
||||||
|
|
||||||
[node name="TriggerLeverComponent" type="Node" parent="."]
|
[node name="TriggerLeverComponent" type="Node" parent="." unique_id=366225548]
|
||||||
script = ExtResource("28_bnap0")
|
script = ExtResource("28_bnap0")
|
||||||
|
|
||||||
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="." unique_id=218072388]
|
||||||
stream = ExtResource("18_pysae")
|
stream = ExtResource("18_pysae")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="." unique_id=1815263121]
|
||||||
stream = ExtResource("19_7anly")
|
stream = ExtResource("19_7anly")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="sfx_heal" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_heal" type="AudioStreamPlayer2D" parent="." unique_id=1792916109]
|
||||||
stream = ExtResource("20_bptj5")
|
stream = ExtResource("20_bptj5")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="." unique_id=1414786458]
|
||||||
stream = ExtResource("32_x2b7c")
|
stream = ExtResource("32_x2b7c")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="ChargingBarLayer" parent="." instance=ExtResource("28_3f5nm")]
|
[node name="ChargingBarLayer" parent="." unique_id=664675361 instance=ExtResource("28_3f5nm")]
|
||||||
offset_left = -17.0
|
offset_left = -17.0
|
||||||
offset_top = -30.0
|
offset_top = -30.0
|
||||||
offset_right = 23.0
|
offset_right = 23.0
|
||||||
offset_bottom = -20.0
|
offset_bottom = -20.0
|
||||||
|
|
||||||
[node name="HitParticles" parent="." instance=ExtResource("28_jh5m0")]
|
[node name="HitParticles" parent="." unique_id=1322585720 instance=ExtResource("28_jh5m0")]
|
||||||
process_material = SubResource("ParticleProcessMaterial_lgb3u")
|
process_material = SubResource("ParticleProcessMaterial_e5pae")
|
||||||
|
|
||||||
[node name="ShipShooter" type="Node" parent="." node_paths=PackedStringArray("BulletSpawn", "ShootSfx")]
|
[node name="ShipShooter" type="Node" parent="." unique_id=1147013800 node_paths=PackedStringArray("BulletSpawn", "ShootSfx")]
|
||||||
script = ExtResource("30_usc1p")
|
script = ExtResource("30_usc1p")
|
||||||
BulletScene = ExtResource("36_oxudy")
|
BulletScene = ExtResource("36_oxudy")
|
||||||
BulletSpawn = NodePath("../Ship shoot spawn")
|
BulletSpawn = NodePath("../Ship shoot spawn")
|
||||||
ShootSfx = NodePath("../sfx_shoot")
|
ShootSfx = NodePath("../sfx_shoot")
|
||||||
|
|
||||||
[node name="Ship shoot spawn" type="Marker2D" parent="."]
|
[node name="Ship shoot spawn" type="Marker2D" parent="." unique_id=1653596970]
|
||||||
position = Vector2(17, 5)
|
position = Vector2(17, 5)
|
||||||
gizmo_extents = 1.0
|
gizmo_extents = 1.0
|
||||||
|
|
||||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=65174812]
|
||||||
position = Vector2(0, 3)
|
position = Vector2(0, 3)
|
||||||
scale = Vector2(0.8, 1.9)
|
scale = Vector2(0.8, 1.9)
|
||||||
|
|
||||||
[node name="PlayerInputHandler" type="Node" parent="."]
|
[node name="PlayerInputHandler" type="Node" parent="." unique_id=1581385683]
|
||||||
script = ExtResource("42_e5pae")
|
script = ExtResource("42_e5pae")
|
||||||
metadata/_custom_type_script = "uid://dssa2taiwktis"
|
metadata/_custom_type_script = "uid://dssa2taiwktis"
|
||||||
|
|
||||||
[node name="SpriteTilterComponent" type="Node" parent="." node_paths=PackedStringArray("RotationTarget")]
|
[node name="SpriteTilterComponent" type="Node" parent="." unique_id=1433925210 node_paths=PackedStringArray("RotationTarget")]
|
||||||
script = ExtResource("43_xuhvf")
|
script = ExtResource("43_xuhvf")
|
||||||
RotationTarget = NodePath("../Graphics/Root/Base")
|
RotationTarget = NodePath("../Graphics/Root/Base")
|
||||||
metadata/_custom_type_script = "uid://ceoxet1nqws8w"
|
metadata/_custom_type_script = "uid://ceoxet1nqws8w"
|
||||||
|
|
||||||
[node name="PlayerSfxComponent" type="Node" parent="." node_paths=PackedStringArray("JumpSfx")]
|
[node name="PlayerSfxComponent" type="Node" parent="." unique_id=1375936690 node_paths=PackedStringArray("JumpSfx")]
|
||||||
script = ExtResource("49_qec3q")
|
script = ExtResource("49_qec3q")
|
||||||
JumpSfx = NodePath("../sfx_jump")
|
JumpSfx = NodePath("../sfx_jump")
|
||||||
metadata/_custom_type_script = "uid://b1h8r5irryxcx"
|
metadata/_custom_type_script = "uid://b1h8r5irryxcx"
|
||||||
|
|
||||||
[node name="PlayerGraphicsComponent" type="Node" parent="." node_paths=PackedStringArray("DefaultSprite", "SpaceshipSprite")]
|
[node name="PlayerGraphicsComponent" type="Node" parent="." unique_id=443649347 node_paths=PackedStringArray("DefaultSprite", "SpaceshipSprite")]
|
||||||
script = ExtResource("50_dhjci")
|
script = ExtResource("50_dhjci")
|
||||||
DefaultSprite = NodePath("../Graphics/Root")
|
DefaultSprite = NodePath("../Graphics/Root")
|
||||||
SpaceshipSprite = NodePath("../Graphics/Ship")
|
SpaceshipSprite = NodePath("../Graphics/Ship")
|
||||||
metadata/_custom_type_script = "uid://b2aanqykvdnev"
|
metadata/_custom_type_script = "uid://b2aanqykvdnev"
|
||||||
|
|
||||||
[node name="ProgressiveDamageComponent" type="Node" parent="." node_paths=PackedStringArray("HealthComponent", "Sprite")]
|
[node name="ProgressiveDamageComponent" type="Node" parent="." unique_id=1763641730 node_paths=PackedStringArray("HealthComponent", "Sprite")]
|
||||||
script = ExtResource("38_dhjci")
|
script = ExtResource("38_dhjci")
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
Sprite = NodePath("../Graphics/Root/Base")
|
Sprite = NodePath("../Graphics/Root/Base")
|
||||||
metadata/_custom_type_script = "uid://dupnaark1f7gm"
|
metadata/_custom_type_script = "uid://dupnaark1f7gm"
|
||||||
|
|
||||||
[node name="PacXonGridInteractor" type="Node" parent="."]
|
[node name="PacXonGridInteractor" type="Node" parent="." unique_id=1036082136]
|
||||||
script = ExtResource("42_xuhvf")
|
script = ExtResource("42_xuhvf")
|
||||||
metadata/_custom_type_script = "uid://c00siqtssccr6"
|
metadata/_custom_type_script = "uid://c00siqtssccr6"
|
||||||
|
|
||||||
[node name="PacXonTrailComponent" type="Line2D" parent="."]
|
[node name="PacXonTrailComponent" type="Line2D" parent="." unique_id=100969687]
|
||||||
script = ExtResource("44_uno3u")
|
script = ExtResource("44_uno3u")
|
||||||
metadata/_custom_type_script = "uid://cmk4m7mplqnrm"
|
metadata/_custom_type_script = "uid://cmk4m7mplqnrm"
|
||||||
|
|
||||||
[node name="Feet" type="Marker2D" parent="."]
|
[node name="Feet" type="Marker2D" parent="." unique_id=1308840991]
|
||||||
position = Vector2(0, 16)
|
position = Vector2(0, 16)
|
||||||
|
|
||||||
[node name="FootstepGfx" type="Node2D" parent="." node_paths=PackedStringArray("_controller", "_marker")]
|
[node name="FootstepGfx" type="Node2D" parent="." unique_id=362059837 node_paths=PackedStringArray("_controller", "_marker")]
|
||||||
script = ExtResource("46_6n1ss")
|
script = ExtResource("46_6n1ss")
|
||||||
_particles = ExtResource("45_bl1gx")
|
_particles = ExtResource("45_bl1gx")
|
||||||
_controller = NodePath("..")
|
_controller = NodePath("..")
|
||||||
@@ -323,7 +311,7 @@ _minMoveSpeed = 4.0
|
|||||||
_randomOffsetRange = 0.3
|
_randomOffsetRange = 0.3
|
||||||
metadata/_custom_type_script = "uid://d3ksrjt1ek4gi"
|
metadata/_custom_type_script = "uid://d3ksrjt1ek4gi"
|
||||||
|
|
||||||
[node name="JumpGfxComponent" type="Node2D" parent="." node_paths=PackedStringArray("Controller")]
|
[node name="JumpGfxComponent" type="Node2D" parent="." unique_id=1468920790 node_paths=PackedStringArray("Controller")]
|
||||||
script = ExtResource("47_oefns")
|
script = ExtResource("47_oefns")
|
||||||
ParticleScene = ExtResource("48_bnap0")
|
ParticleScene = ExtResource("48_bnap0")
|
||||||
Controller = NodePath("..")
|
Controller = NodePath("..")
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://lpovacvt3yyj"]
|
[gd_scene format=3 uid="uid://lpovacvt3yyj"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="1_r82pf"]
|
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="1_r82pf"]
|
||||||
[ext_resource type="Script" uid="uid://dtv2r7q4elgre" path="res://scripts/components/SpaceshipEnterComponent.cs" id="2_wanmd"]
|
[ext_resource type="Script" uid="uid://dtv2r7q4elgre" path="res://scripts/components/SpaceshipEnterComponent.cs" id="2_wanmd"]
|
||||||
|
[ext_resource type="Resource" uid="uid://d033qwwfs3i72" path="res://resources/movement_presets/spaceship_movement.tres" id="2_yda36"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_wanmd"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_wanmd"]
|
||||||
radius = 16.1245
|
radius = 16.1245
|
||||||
|
|
||||||
[node name="Spaceship Enter" type="Area2D"]
|
[node name="Spaceship Enter" type="Area2D" unique_id=916428603]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
script = ExtResource("2_wanmd")
|
script = ExtResource("2_wanmd")
|
||||||
|
Preset = ExtResource("2_yda36")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=433507900]
|
||||||
texture = ExtResource("1_r82pf")
|
texture = ExtResource("1_r82pf")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=993596426]
|
||||||
shape = SubResource("CircleShape2D_wanmd")
|
shape = SubResource("CircleShape2D_wanmd")
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://dkqa3q6j2gof4"]
|
[gd_scene format=3 uid="uid://dkqa3q6j2gof4"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d3gfg05ll8uw3" path="res://scripts/components/SpaceshipExitComponent.cs" id="1_1cmfv"]
|
[ext_resource type="Script" uid="uid://d3gfg05ll8uw3" path="res://scripts/components/SpaceshipExitComponent.cs" id="1_1cmfv"]
|
||||||
|
[ext_resource type="Resource" uid="uid://vgutbpovj8hc" path="res://resources/movement_presets/platform_movement.tres" id="2_njt46"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_njt46"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_njt46"]
|
||||||
|
|
||||||
[node name="Spaceship exit" type="Area2D" node_paths=PackedStringArray("Area")]
|
[node name="Spaceship exit" type="Area2D" unique_id=922920366]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
script = ExtResource("1_1cmfv")
|
script = ExtResource("1_1cmfv")
|
||||||
Area = NodePath(".")
|
Preset = ExtResource("2_njt46")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1697409658]
|
||||||
shape = SubResource("RectangleShape2D_njt46")
|
shape = SubResource("RectangleShape2D_njt46")
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://cala7bpo1v4no"]
|
[gd_scene format=3 uid="uid://cala7bpo1v4no"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="1_tn5sj"]
|
[ext_resource type="Script" uid="uid://chgw53qwt7rt8" path="res://scripts/components/Movement/GravityAbility.cs" id="1_tn5sj"]
|
||||||
|
|
||||||
[node name="GravityAbility" type="Node"]
|
[node name="GravityAbility" type="Node" unique_id=711941081]
|
||||||
script = ExtResource("1_tn5sj")
|
script = ExtResource("1_tn5sj")
|
||||||
|
DescendGravity = 1000.0
|
||||||
metadata/_custom_type_script = "uid://chgw53qwt7rt8"
|
metadata/_custom_type_script = "uid://chgw53qwt7rt8"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://d0r5edxnx5jqx"]
|
[gd_scene format=3 uid="uid://d0r5edxnx5jqx"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="1_y30i5"]
|
[ext_resource type="Script" uid="uid://ccksp2e76s7sr" path="res://scripts/components/Movement/VariableJumpAbility.cs" id="1_y30i5"]
|
||||||
|
|
||||||
[node name="VariableJumpAbility" type="Node"]
|
[node name="VariableJumpAbility" type="Node" unique_id=735694377]
|
||||||
script = ExtResource("1_y30i5")
|
script = ExtResource("1_y30i5")
|
||||||
|
JumpHeight = 120.0
|
||||||
JumpCutMultiplier = 0.507
|
JumpCutMultiplier = 0.507
|
||||||
metadata/_custom_type_script = "uid://ccksp2e76s7sr"
|
metadata/_custom_type_script = "uid://ccksp2e76s7sr"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=12 format=3 uid="uid://bi6v7u17vg1ww"]
|
[gd_scene format=3 uid="uid://bi6v7u17vg1ww"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"]
|
[ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"]
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"]
|
||||||
@@ -12,6 +12,6 @@
|
|||||||
[ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"]
|
[ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"]
|
||||||
[ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"]
|
[ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"]
|
||||||
|
|
||||||
[node name="SkillManager" type="Node"]
|
[node name="SkillManager" type="Node" unique_id=1205356464]
|
||||||
script = ExtResource("1_31033")
|
script = ExtResource("1_31033")
|
||||||
AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("10_gib8v"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")])
|
AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("10_gib8v"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")])
|
||||||
|
|||||||
12
resources/movement_presets/platform_movement.tres
Normal file
12
resources/movement_presets/platform_movement.tres
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_resource type="Resource" script_class="MovementPreset" format=3 uid="uid://vgutbpovj8hc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://tt1los3lafsi" path="res://scripts/Resources/MovementPreset.cs" id="1_0yvgi"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bcv8kx6bc7u5e" path="res://objects/movement_abilities/ground_ability.tscn" id="1_sll4h"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d0r5edxnx5jqx" path="res://objects/movement_abilities/variable_jump_ability.tscn" id="2_g20lq"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cala7bpo1v4no" path="res://objects/movement_abilities/gravity_ability.tscn" id="3_085b1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bty3jq8u0pxkf" path="res://objects/movement_abilities/one_way_platform_ability.tscn" id="4_yebn0"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_0yvgi")
|
||||||
|
Abilities = [ExtResource("1_sll4h"), ExtResource("2_g20lq"), ExtResource("3_085b1"), ExtResource("4_yebn0")]
|
||||||
|
metadata/_custom_type_script = "uid://tt1los3lafsi"
|
||||||
9
resources/movement_presets/spaceship_movement.tres
Normal file
9
resources/movement_presets/spaceship_movement.tres
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="MovementPreset" format=3 uid="uid://d033qwwfs3i72"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://tt1los3lafsi" path="res://scripts/Resources/MovementPreset.cs" id="1_dfw61"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bu3vuxlrvoo1t" path="res://objects/movement_abilities/spaceship_ability.tscn" id="1_hadk8"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_dfw61")
|
||||||
|
Abilities = [ExtResource("1_hadk8")]
|
||||||
|
metadata/_custom_type_script = "uid://tt1los3lafsi"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts;
|
namespace Mr.BrickAdventures.scripts;
|
||||||
|
|
||||||
@@ -8,17 +9,17 @@ namespace Mr.BrickAdventures.scripts;
|
|||||||
public partial class PacXonLevel : Node
|
public partial class PacXonLevel : Node
|
||||||
{
|
{
|
||||||
[Export] public PlayerController Player { get; set; }
|
[Export] public PlayerController Player { get; set; }
|
||||||
|
[Export] public MovementPreset GridPreset { get; set; }
|
||||||
[Export] public PacXonGridManager GridManager { get; set; }
|
[Export] public PacXonGridManager GridManager { get; set; }
|
||||||
[Export] public Node GhostContainer { get; set; }
|
[Export] public Node GhostContainer { get; set; }
|
||||||
[Export] public Label PercentageLabel { get; set; }
|
[Export] public Label PercentageLabel { get; set; }
|
||||||
|
|
||||||
private const float WinPercentage = 0.90f;
|
private const float WinPercentage = 0.90f;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
var ghosts = GhostContainer.GetChildren().OfType<Node2D>().ToList();
|
var ghosts = GhostContainer.GetChildren().OfType<Node2D>().ToList();
|
||||||
Player.ClearMovementAbilities();
|
Player.ApplyPreset(GridPreset);
|
||||||
Player.SetGridMovement();
|
|
||||||
|
|
||||||
foreach (var ghost in ghosts)
|
foreach (var ghost in ghosts)
|
||||||
{
|
{
|
||||||
|
|||||||
9
scripts/Resources/MovementPreset.cs
Normal file
9
scripts/Resources/MovementPreset.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class MovementPreset : Resource
|
||||||
|
{
|
||||||
|
[Export] public PackedScene[] Abilities { get; set; } = [];
|
||||||
|
}
|
||||||
1
scripts/Resources/MovementPreset.cs.uid
Normal file
1
scripts/Resources/MovementPreset.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://tt1los3lafsi
|
||||||
@@ -5,26 +5,16 @@ namespace Mr.BrickAdventures.scripts.components;
|
|||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class DoubleJumpAbility : MovementAbility
|
public partial class DoubleJumpAbility : MovementAbility
|
||||||
{
|
{
|
||||||
|
[Export] public float JumpHeight { get; set; } = 100f;
|
||||||
|
[Export] public float JumpTimeToPeak { get; set; } = 0.5f;
|
||||||
|
|
||||||
private bool _hasDoubleJumped = false;
|
private bool _hasDoubleJumped = false;
|
||||||
private float _jumpVelocity;
|
private float _jumpVelocity;
|
||||||
|
|
||||||
public override void Initialize(PlayerController controller)
|
public override void Initialize(PlayerController controller)
|
||||||
{
|
{
|
||||||
base.Initialize(controller);
|
base.Initialize(controller);
|
||||||
|
_jumpVelocity = (2.0f * JumpHeight) / JumpTimeToPeak * -1.0f;
|
||||||
foreach (var ability in _controller.GetActiveAbilities())
|
|
||||||
{
|
|
||||||
if (ability is VariableJumpAbility jumpAbility)
|
|
||||||
{
|
|
||||||
_jumpVelocity = (2.0f * jumpAbility.JumpHeight) / jumpAbility.JumpTimeToPeak * -1.0f;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_jumpVelocity == 0)
|
|
||||||
{
|
|
||||||
_jumpVelocity = -400.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector2 ProcessMovement(Vector2 velocity, double delta)
|
public override Vector2 ProcessMovement(Vector2 velocity, double delta)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace Mr.BrickAdventures.scripts.components;
|
|||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class GravityAbility : MovementAbility
|
public partial class GravityAbility : MovementAbility
|
||||||
{
|
{
|
||||||
public float AscendGravity { get; set; }
|
[Export] public float AscendGravity { get; set; } = 980f;
|
||||||
public float DescendGravity { get; set; }
|
[Export] public float DescendGravity { get; set; } = 1960f;
|
||||||
|
|
||||||
private float _gravity;
|
private float _gravity;
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ public partial class GridMovementAbility : MovementAbility
|
|||||||
|
|
||||||
public override Vector2 ProcessMovement(Vector2 currentVelocity, double delta)
|
public override Vector2 ProcessMovement(Vector2 currentVelocity, double delta)
|
||||||
{
|
{
|
||||||
GD.Print($"Player position: {_body.Position}, {_body.GlobalPosition}");
|
|
||||||
|
|
||||||
var inputDirection = _input.MoveDirection;
|
var inputDirection = _input.MoveDirection;
|
||||||
var newDirection = Vector2.Zero;
|
var newDirection = Vector2.Zero;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ public abstract partial class MovementAbility : Node
|
|||||||
SetProcess(false);
|
SetProcess(false);
|
||||||
SetPhysicsProcess(false);
|
SetPhysicsProcess(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_body.Velocity = Vector2.Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Vector2 ProcessMovement(Vector2 currentVelocity, double delta);
|
public abstract Vector2 ProcessMovement(Vector2 currentVelocity, double delta);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public partial class PlayerInputHandler : Node
|
|||||||
public bool DownReleased { get; private set; }
|
public bool DownReleased { get; private set; }
|
||||||
public bool DownHeld { get; private set; }
|
public bool DownHeld { get; private set; }
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
MoveDirection = Input.GetVector("left", "right", "up", "down");
|
MoveDirection = Input.GetVector("left", "right", "up", "down");
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,26 @@ public partial class WallJumpAbility : MovementAbility
|
|||||||
{
|
{
|
||||||
[ExportGroup("Wall Jump Design")]
|
[ExportGroup("Wall Jump Design")]
|
||||||
[Export] public Vector2 WallJumpVelocity { get; set; } = new(500.0f, -350.0f);
|
[Export] public Vector2 WallJumpVelocity { get; set; } = new(500.0f, -350.0f);
|
||||||
|
|
||||||
[ExportGroup("Wall Slide Feel")]
|
[ExportGroup("Wall Slide Feel")]
|
||||||
[Export(PropertyHint.Range, "0.0, 1.0, 0.05")] public float WallSlideGravityMultiplier { get; set; } = 0.7f;
|
[Export(PropertyHint.Range, "0.0, 1.0, 0.05")] public float WallSlideGravityMultiplier { get; set; } = 0.7f;
|
||||||
[Export] public float MaxWallSlideSpeed { get; set; } = 150.0f;
|
[Export] public float MaxWallSlideSpeed { get; set; } = 150.0f;
|
||||||
|
|
||||||
|
private float _gravity;
|
||||||
|
|
||||||
|
public override void Initialize(PlayerController controller)
|
||||||
|
{
|
||||||
|
base.Initialize(controller);
|
||||||
|
_gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity");
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector2 ProcessMovement(Vector2 velocity, double delta)
|
public override Vector2 ProcessMovement(Vector2 velocity, double delta)
|
||||||
{
|
{
|
||||||
var isOnWall = _body.IsOnWall();
|
var isOnWall = _body.IsOnWall();
|
||||||
|
|
||||||
if (isOnWall && !_body.IsOnFloor() && velocity.Y > 0f)
|
if (isOnWall && !_body.IsOnFloor() && velocity.Y > 0f)
|
||||||
{
|
{
|
||||||
var gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity");
|
var newYVelocity = velocity.Y + _gravity * WallSlideGravityMultiplier * (float)delta;
|
||||||
var newYVelocity = velocity.Y + gravity * WallSlideGravityMultiplier * (float)delta;
|
|
||||||
|
|
||||||
velocity.Y = Mathf.Min(newYVelocity, MaxWallSlideSpeed);
|
velocity.Y = Mathf.Min(newYVelocity, MaxWallSlideSpeed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Godot;
|
using Godot;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
@@ -10,15 +9,7 @@ namespace Mr.BrickAdventures.scripts.components;
|
|||||||
public partial class PlayerController : CharacterBody2D
|
public partial class PlayerController : CharacterBody2D
|
||||||
{
|
{
|
||||||
[Export] private Node MovementAbilitiesContainer { get; set; }
|
[Export] private Node MovementAbilitiesContainer { get; set; }
|
||||||
|
[Export] public MovementPreset DefaultPreset { get; set; }
|
||||||
[ExportGroup("Movement Ability Scenes")]
|
|
||||||
[Export] public PackedScene GroundMovementScene { get; set; }
|
|
||||||
[Export] public PackedScene JumpMovementScene { get; set; }
|
|
||||||
[Export] public PackedScene GravityScene { get; set; }
|
|
||||||
[Export] public PackedScene OneWayPlatformScene { get; set; }
|
|
||||||
[Export] public PackedScene SpaceshipMovementScene { get; set; }
|
|
||||||
[Export] public PackedScene WallJumpScene { get; set; }
|
|
||||||
[Export] public PackedScene GridMovementScene { get; set; }
|
|
||||||
|
|
||||||
[Signal] public delegate void JumpInitiatedEventHandler();
|
[Signal] public delegate void JumpInitiatedEventHandler();
|
||||||
[Signal] public delegate void MovementAbilitiesChangedEventHandler();
|
[Signal] public delegate void MovementAbilitiesChangedEventHandler();
|
||||||
@@ -48,16 +39,10 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
}
|
}
|
||||||
|
|
||||||
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
|
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||||
foreach (var child in MovementAbilitiesContainer.GetChildren())
|
|
||||||
{
|
|
||||||
if (child is MovementAbility ability)
|
|
||||||
{
|
|
||||||
ability.Initialize(this);
|
|
||||||
_abilities.Add(ability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = ConnectJumpAndGravityAbilities();
|
if (DefaultPreset != null)
|
||||||
|
ApplyPreset(DefaultPreset);
|
||||||
|
|
||||||
EmitSignalMovementAbilitiesChanged();
|
EmitSignalMovementAbilitiesChanged();
|
||||||
EventBus.EmitPlayerSpawned(this);
|
EventBus.EmitPlayerSpawned(this);
|
||||||
}
|
}
|
||||||
@@ -81,6 +66,19 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
MoveAndSlide();
|
MoveAndSlide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyPreset(MovementPreset preset)
|
||||||
|
{
|
||||||
|
if (preset == null) return;
|
||||||
|
ClearMovementAbilities();
|
||||||
|
Velocity = Vector2.Zero;
|
||||||
|
foreach (var scene in preset.Abilities)
|
||||||
|
{
|
||||||
|
if (scene != null)
|
||||||
|
AddAbility(scene.Instantiate<MovementAbility>());
|
||||||
|
}
|
||||||
|
EmitSignalMovementAbilitiesChanged();
|
||||||
|
}
|
||||||
|
|
||||||
public void AddAbility(MovementAbility ability)
|
public void AddAbility(MovementAbility ability)
|
||||||
{
|
{
|
||||||
MovementAbilitiesContainer.AddChild(ability);
|
MovementAbilitiesContainer.AddChild(ability);
|
||||||
@@ -110,46 +108,4 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void SetPlatformMovement()
|
|
||||||
{
|
|
||||||
ClearMovementAbilities();
|
|
||||||
|
|
||||||
if (GroundMovementScene != null) AddAbility(GroundMovementScene.Instantiate<MovementAbility>());
|
|
||||||
if (JumpMovementScene != null) AddAbility(JumpMovementScene.Instantiate<MovementAbility>());
|
|
||||||
if (GravityScene != null) AddAbility(GravityScene.Instantiate<MovementAbility>());
|
|
||||||
if (OneWayPlatformScene != null) AddAbility(OneWayPlatformScene.Instantiate<MovementAbility>());
|
|
||||||
|
|
||||||
_ = ConnectJumpAndGravityAbilities();
|
|
||||||
EmitSignalMovementAbilitiesChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetSpaceshipMovement()
|
|
||||||
{
|
|
||||||
ClearMovementAbilities();
|
|
||||||
|
|
||||||
if (SpaceshipMovementScene != null) AddAbility(SpaceshipMovementScene.Instantiate<MovementAbility>());
|
|
||||||
EmitSignalMovementAbilitiesChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetGridMovement()
|
|
||||||
{
|
|
||||||
ClearMovementAbilities();
|
|
||||||
if (GridMovementScene != null) AddAbility(GridMovementScene.Instantiate<MovementAbility>());
|
|
||||||
EmitSignalMovementAbilitiesChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ConnectJumpAndGravityAbilities()
|
|
||||||
{
|
|
||||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
|
||||||
|
|
||||||
var jumpAbility = _abilities.OfType<VariableJumpAbility>().FirstOrDefault();
|
|
||||||
var gravityAbility = _abilities.OfType<GravityAbility>().FirstOrDefault();
|
|
||||||
|
|
||||||
if (jumpAbility != null && gravityAbility != null)
|
|
||||||
{
|
|
||||||
gravityAbility.AscendGravity = jumpAbility.AscendGravity;
|
|
||||||
gravityAbility.DescendGravity = jumpAbility.DescendGravity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class SpaceshipEnterComponent : Area2D
|
public partial class SpaceshipEnterComponent : Area2D
|
||||||
{
|
{
|
||||||
|
[Export] public MovementPreset Preset { get; set; }
|
||||||
[Signal] public delegate void SpaceshipEnteredEventHandler();
|
[Signal] public delegate void SpaceshipEnteredEventHandler();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
@@ -15,7 +17,7 @@ public partial class SpaceshipEnterComponent : Area2D
|
|||||||
private void OnBodyEntered(Node2D body)
|
private void OnBodyEntered(Node2D body)
|
||||||
{
|
{
|
||||||
if (body is not PlayerController player) return;
|
if (body is not PlayerController player) return;
|
||||||
player.SetSpaceshipMovement();
|
player.ApplyPreset(Preset);
|
||||||
EmitSignalSpaceshipEntered();
|
EmitSignalSpaceshipEntered();
|
||||||
QueueFree();
|
QueueFree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class SpaceshipExitComponent : Area2D
|
public partial class SpaceshipExitComponent : Area2D
|
||||||
{
|
{
|
||||||
|
[Export] public MovementPreset Preset { get; set; }
|
||||||
[Signal] public delegate void SpaceshipExitEventHandler();
|
[Signal] public delegate void SpaceshipExitEventHandler();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
BodyEntered += OnBodyEntered;
|
BodyEntered += OnBodyEntered;
|
||||||
@@ -16,6 +18,6 @@ public partial class SpaceshipExitComponent : Area2D
|
|||||||
{
|
{
|
||||||
if (body is not PlayerController player) return;
|
if (body is not PlayerController player) return;
|
||||||
EmitSignalSpaceshipExit();
|
EmitSignalSpaceshipExit();
|
||||||
player.SetPlatformMovement();
|
player.ApplyPreset(Preset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user