From 88fc0f80752bfd7ee9fc9e4c600ac770ab0e71ca Mon Sep 17 00:00:00 2001 From: JHDev2006 Date: Wed, 1 Oct 2025 16:16:06 +0100 Subject: [PATCH] fixed up pipe hitboxes on smaller characters + piranha plant rotation --- .../Sprites/Players/Mario/CharacterInfo.json | 2 +- .../Entities/Enemies/PiranhaPlant.tscn | 9 +- Scenes/Prefabs/Entities/Player.tscn | 10 +-- Scenes/Prefabs/LevelBG.tscn | 83 ++++++++----------- .../Classes/Entities/Enemies/PiranhaPlant.gd | 4 +- 5 files changed, 49 insertions(+), 59 deletions(-) diff --git a/Assets/Sprites/Players/Mario/CharacterInfo.json b/Assets/Sprites/Players/Mario/CharacterInfo.json index c5996f8..f2db13d 100644 --- a/Assets/Sprites/Players/Mario/CharacterInfo.json +++ b/Assets/Sprites/Players/Mario/CharacterInfo.json @@ -36,6 +36,6 @@ "can_air_turn": false, }, - "small_hitbox_scale": [1.0, 1.0], + "small_hitbox_scale": [0.5, 0.5], "big_hitbox_scale": [1.0, 1.0] } diff --git a/Scenes/Prefabs/Entities/Enemies/PiranhaPlant.tscn b/Scenes/Prefabs/Entities/Enemies/PiranhaPlant.tscn index daf5602..9990ded 100644 --- a/Scenes/Prefabs/Entities/Enemies/PiranhaPlant.tscn +++ b/Scenes/Prefabs/Entities/Enemies/PiranhaPlant.tscn @@ -184,9 +184,14 @@ _data = { [sub_resource type="GDScript" id="GDScript_ofvpu"] script/source = "extends Node +@onready var starting_position: Vector2 = owner.global_position + func _process(_delta: float) -> void: + const OFFSETS = [Vector2.ZERO, Vector2.ZERO, Vector2(-16, 0), Vector2(16, 0)] if Global.level_editor != null: - owner.global_rotation_degrees = [0, 180, 90, -90][owner.pipe_direction] + owner.global_rotation_degrees = [0, 180, 90, -90][owner.plant_direction] + var offset = OFFSETS[owner.plant_direction] + owner.global_position = starting_position + offset " [node name="PirannhaPlant" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder") groups=["Enemies"]] @@ -290,7 +295,7 @@ metadata/_custom_type_script = "uid://ba18grqjixded" [node name="EditorPropertyExposer" type="Node" parent="."] script = ExtResource("12_ofvpu") -properties = Array[String](["pipe_direction"]) +properties = Array[String](["plant_direction"]) metadata/_custom_type_script = "uid://ctfbuoxtnnl0q" [node name="Node" type="Node" parent="."] diff --git a/Scenes/Prefabs/Entities/Player.tscn b/Scenes/Prefabs/Entities/Player.tscn index 4491550..41e43f9 100644 --- a/Scenes/Prefabs/Entities/Player.tscn +++ b/Scenes/Prefabs/Entities/Player.tscn @@ -292,11 +292,11 @@ _data = { [sub_resource type="RectangleShape2D" id="RectangleShape2D_nbkfn"] resource_local_to_scene = true -size = Vector2(9, 14) +size = Vector2(9.2, 14) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_d20nf"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_vijl6"] resource_local_to_scene = true -size = Vector2(9, 29.5) +size = Vector2(9.2, 29.5) [sub_resource type="RectangleShape2D" id="RectangleShape2D_f6bau"] resource_local_to_scene = true @@ -498,7 +498,6 @@ collision_mask = 3 collision_priority = 10000000.0 slide_on_ceiling = false floor_constant_speed = true -floor_max_angle = 0.872665 floor_snap_length = 4.0 platform_on_leave = 2 script = ExtResource("1_f6bau") @@ -668,7 +667,6 @@ editor_draw_limits = true editor_draw_drag_margin = true [node name="Hitbox" type="Area2D" parent="."] -visible = false position = Vector2(0, -10) collision_mask = 5 @@ -681,7 +679,7 @@ offset = Vector2(0, -10) [node name="BigShape" type="CollisionShape2D" parent="Hitbox" groups=["BigCollisions"]] position = Vector2(0, -4.75) -shape = SubResource("RectangleShape2D_d20nf") +shape = SubResource("RectangleShape2D_vijl6") disabled = true debug_color = Color(1, 0, 0, 0.419608) script = ExtResource("21_jl70t") diff --git a/Scenes/Prefabs/LevelBG.tscn b/Scenes/Prefabs/LevelBG.tscn index cb068a1..d561dd2 100644 --- a/Scenes/Prefabs/LevelBG.tscn +++ b/Scenes/Prefabs/LevelBG.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=83 format=4 uid="uid://bksxgpygrdjl7"] +[gd_scene load_steps=78 format=4 uid="uid://bksxgpygrdjl7"] [ext_resource type="Script" uid="uid://erdjx03phltn" path="res://Scripts/Classes/LevelBGNew.gd" id="1_pkg8e"] [ext_resource type="Script" uid="uid://cq6f682453q6o" path="res://Scripts/Classes/Components/ResourceSetter.gd" id="3_6m0f5"] @@ -252,41 +252,12 @@ _data = { &"Turn": SubResource("Animation_lvidp") } -[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_413gx"] -emission_shape = 3 -emission_box_extents = Vector3(256, 1, 1) -direction = Vector3(0, 1, 0) -spread = 15.0 -initial_velocity_min = 20.0 -initial_velocity_max = 50.0 -gravity = Vector3(0, 0, 0) - [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_7urbp"] particles_animation = true particles_anim_h_frames = 2 particles_anim_v_frames = 1 particles_anim_loop = false -[sub_resource type="Curve" id="Curve_yxjfg"] -_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.738889, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] -point_count = 3 - -[sub_resource type="CurveTexture" id="CurveTexture_e4hrf"] -curve = SubResource("Curve_yxjfg") - -[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_b8hji"] -particle_flag_disable_z = true -emission_shape = 3 -emission_box_extents = Vector3(512, 1, 1) -direction = Vector3(0, 1, 0) -initial_velocity_min = 25.0 -initial_velocity_max = 100.0 -angular_velocity_min = -720.0 -angular_velocity_max = 720.0 -gravity = Vector3(0, 0, 0) -alpha_curve = SubResource("CurveTexture_e4hrf") -anim_offset_max = 1.0 - [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_dmpyo"] particles_animation = true particles_anim_h_frames = 3 @@ -304,16 +275,6 @@ metadata/_snap_count = 3 gradient = SubResource("Gradient_dmpyo") width = 3 -[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_dmpyo"] -particle_flag_disable_z = true -emission_shape = 3 -emission_box_extents = Vector3(256, 1, 1) -direction = Vector3(0, -1, 0) -initial_velocity_min = 5.0 -initial_velocity_max = 20.0 -gravity = Vector3(0, -10, 0) -anim_offset_max = 1.0 - [sub_resource type="Gradient" id="Gradient_qkl8a"] offsets = PackedFloat32Array(0) colors = PackedColorArray(0.266667, 0.137255, 0.0235294, 1) @@ -711,26 +672,34 @@ process_mode = 1 repeat_size = Vector2(512, 512) repeat_times = 4 -[node name="Snow" type="GPUParticles2D" parent="OverlayLayer/Particles"] +[node name="Snow" type="CPUParticles2D" parent="OverlayLayer/Particles"] process_mode = 1 visible = false position = Vector2(256, 256) amount = 128 lifetime = 20.0 preprocess = 20.0 +fixed_fps = 30 local_coords = true -process_material = SubResource("ParticleProcessMaterial_413gx") +draw_order = 1 +emission_shape = 3 +emission_rect_extents = Vector2(256, 1) +direction = Vector2(0, 1) +spread = 15.0 +gravity = Vector2(0, 0) +initial_velocity_min = 20.0 +initial_velocity_max = 50.0 [node name="ResourceSetter" type="Node" parent="OverlayLayer/Particles/Snow" node_paths=PackedStringArray("node_to_affect")] process_mode = 1 script = ExtResource("10_lvidp") -node_to_affect = NodePath("..") +node_to_affect = NodePath("") property_name = "texture" mode = 1 resource_json = ExtResource("25_aw4cr") metadata/_custom_type_script = "uid://cbal8ms2oe1ik" -[node name="Leaves" type="GPUParticles2D" parent="OverlayLayer/Particles"] +[node name="Leaves" type="CPUParticles2D" parent="OverlayLayer/Particles"] process_mode = 1 visible = false material = SubResource("CanvasItemMaterial_7urbp") @@ -739,18 +708,28 @@ amount = 64 texture = ExtResource("25_q36g4") lifetime = 30.0 preprocess = 20.0 +fixed_fps = 30 local_coords = true -process_material = SubResource("ParticleProcessMaterial_b8hji") +draw_order = 1 +emission_shape = 3 +emission_rect_extents = Vector2(512, 1) +direction = Vector2(0, 1) +gravity = Vector2(0, 0) +initial_velocity_min = 25.0 +initial_velocity_max = 100.0 +angular_velocity_min = -720.0 +angular_velocity_max = 720.0 +anim_offset_max = 1.0 [node name="ResourceSetterNew" type="Node" parent="OverlayLayer/Particles/Leaves" node_paths=PackedStringArray("node_to_affect")] script = ExtResource("10_lvidp") -node_to_affect = NodePath("..") +node_to_affect = NodePath("") property_name = "texture" mode = 1 resource_json = ExtResource("28_ugdi7") metadata/_custom_type_script = "uid://cbal8ms2oe1ik" -[node name="LavaEmber" type="GPUParticles2D" parent="OverlayLayer/Particles"] +[node name="LavaEmber" type="CPUParticles2D" parent="OverlayLayer/Particles"] process_mode = 1 visibility_layer = 2 z_index = -50 @@ -761,9 +740,17 @@ amount = 64 texture = SubResource("GradientTexture1D_78nlv") lifetime = 5.0 preprocess = 10.0 +fixed_fps = 30 fract_delta = false local_coords = true -process_material = SubResource("ParticleProcessMaterial_dmpyo") +draw_order = 1 +emission_shape = 3 +emission_rect_extents = Vector2(256, 1) +direction = Vector2(0, -1) +gravity = Vector2(0, -10) +initial_velocity_min = 5.0 +initial_velocity_max = 20.0 +anim_offset_max = 1.0 [node name="FGLayer" type="Parallax2D" parent="."] process_mode = 1 diff --git a/Scripts/Classes/Entities/Enemies/PiranhaPlant.gd b/Scripts/Classes/Entities/Enemies/PiranhaPlant.gd index 83dac5d..1f48598 100644 --- a/Scripts/Classes/Entities/Enemies/PiranhaPlant.gd +++ b/Scripts/Classes/Entities/Enemies/PiranhaPlant.gd @@ -2,7 +2,7 @@ extends Enemy @export var player_range := 24 -@export_enum("Up", "Down", "Left", "Right") var pipe_direction := 0 +@export_enum("Up", "Down", "Left", "Right") var plant_direction := 0 func _enter_tree() -> void: $Animation.play("Hide") @@ -15,7 +15,7 @@ func _ready() -> void: func on_timeout() -> void: var player = get_tree().get_first_node_in_group("Players") - if pipe_direction < 2: + if plant_direction < 2: if abs(player.global_position.x - global_position.x) >= player_range: $Animation.play("Rise") elif (abs(player.global_position.y - global_position.y) >= player_range and abs(player.global_position.x - global_position.x) >= player_range * 2):