fixed up pipe hitboxes on smaller characters + piranha plant rotation

This commit is contained in:
JHDev2006
2025-10-01 16:16:06 +01:00
parent 8fbfbd84bf
commit 88fc0f8075
5 changed files with 49 additions and 59 deletions

View File

@@ -36,6 +36,6 @@
"can_air_turn": false, "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] "big_hitbox_scale": [1.0, 1.0]
} }

View File

@@ -184,9 +184,14 @@ _data = {
[sub_resource type="GDScript" id="GDScript_ofvpu"] [sub_resource type="GDScript" id="GDScript_ofvpu"]
script/source = "extends Node script/source = "extends Node
@onready var starting_position: Vector2 = owner.global_position
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
const OFFSETS = [Vector2.ZERO, Vector2.ZERO, Vector2(-16, 0), Vector2(16, 0)]
if Global.level_editor != null: 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"]] [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="."] [node name="EditorPropertyExposer" type="Node" parent="."]
script = ExtResource("12_ofvpu") script = ExtResource("12_ofvpu")
properties = Array[String](["pipe_direction"]) properties = Array[String](["plant_direction"])
metadata/_custom_type_script = "uid://ctfbuoxtnnl0q" metadata/_custom_type_script = "uid://ctfbuoxtnnl0q"
[node name="Node" type="Node" parent="."] [node name="Node" type="Node" parent="."]

View File

@@ -292,11 +292,11 @@ _data = {
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nbkfn"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_nbkfn"]
resource_local_to_scene = true 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 resource_local_to_scene = true
size = Vector2(9, 29.5) size = Vector2(9.2, 29.5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f6bau"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_f6bau"]
resource_local_to_scene = true resource_local_to_scene = true
@@ -498,7 +498,6 @@ collision_mask = 3
collision_priority = 10000000.0 collision_priority = 10000000.0
slide_on_ceiling = false slide_on_ceiling = false
floor_constant_speed = true floor_constant_speed = true
floor_max_angle = 0.872665
floor_snap_length = 4.0 floor_snap_length = 4.0
platform_on_leave = 2 platform_on_leave = 2
script = ExtResource("1_f6bau") script = ExtResource("1_f6bau")
@@ -668,7 +667,6 @@ editor_draw_limits = true
editor_draw_drag_margin = true editor_draw_drag_margin = true
[node name="Hitbox" type="Area2D" parent="."] [node name="Hitbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, -10) position = Vector2(0, -10)
collision_mask = 5 collision_mask = 5
@@ -681,7 +679,7 @@ offset = Vector2(0, -10)
[node name="BigShape" type="CollisionShape2D" parent="Hitbox" groups=["BigCollisions"]] [node name="BigShape" type="CollisionShape2D" parent="Hitbox" groups=["BigCollisions"]]
position = Vector2(0, -4.75) position = Vector2(0, -4.75)
shape = SubResource("RectangleShape2D_d20nf") shape = SubResource("RectangleShape2D_vijl6")
disabled = true disabled = true
debug_color = Color(1, 0, 0, 0.419608) debug_color = Color(1, 0, 0, 0.419608)
script = ExtResource("21_jl70t") script = ExtResource("21_jl70t")

View File

@@ -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://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"] [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") &"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"] [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_7urbp"]
particles_animation = true particles_animation = true
particles_anim_h_frames = 2 particles_anim_h_frames = 2
particles_anim_v_frames = 1 particles_anim_v_frames = 1
particles_anim_loop = false 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"] [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_dmpyo"]
particles_animation = true particles_animation = true
particles_anim_h_frames = 3 particles_anim_h_frames = 3
@@ -304,16 +275,6 @@ metadata/_snap_count = 3
gradient = SubResource("Gradient_dmpyo") gradient = SubResource("Gradient_dmpyo")
width = 3 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"] [sub_resource type="Gradient" id="Gradient_qkl8a"]
offsets = PackedFloat32Array(0) offsets = PackedFloat32Array(0)
colors = PackedColorArray(0.266667, 0.137255, 0.0235294, 1) colors = PackedColorArray(0.266667, 0.137255, 0.0235294, 1)
@@ -711,26 +672,34 @@ process_mode = 1
repeat_size = Vector2(512, 512) repeat_size = Vector2(512, 512)
repeat_times = 4 repeat_times = 4
[node name="Snow" type="GPUParticles2D" parent="OverlayLayer/Particles"] [node name="Snow" type="CPUParticles2D" parent="OverlayLayer/Particles"]
process_mode = 1 process_mode = 1
visible = false visible = false
position = Vector2(256, 256) position = Vector2(256, 256)
amount = 128 amount = 128
lifetime = 20.0 lifetime = 20.0
preprocess = 20.0 preprocess = 20.0
fixed_fps = 30
local_coords = true 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")] [node name="ResourceSetter" type="Node" parent="OverlayLayer/Particles/Snow" node_paths=PackedStringArray("node_to_affect")]
process_mode = 1 process_mode = 1
script = ExtResource("10_lvidp") script = ExtResource("10_lvidp")
node_to_affect = NodePath("..") node_to_affect = NodePath("")
property_name = "texture" property_name = "texture"
mode = 1 mode = 1
resource_json = ExtResource("25_aw4cr") resource_json = ExtResource("25_aw4cr")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik" 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 process_mode = 1
visible = false visible = false
material = SubResource("CanvasItemMaterial_7urbp") material = SubResource("CanvasItemMaterial_7urbp")
@@ -739,18 +708,28 @@ amount = 64
texture = ExtResource("25_q36g4") texture = ExtResource("25_q36g4")
lifetime = 30.0 lifetime = 30.0
preprocess = 20.0 preprocess = 20.0
fixed_fps = 30
local_coords = true 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")] [node name="ResourceSetterNew" type="Node" parent="OverlayLayer/Particles/Leaves" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("10_lvidp") script = ExtResource("10_lvidp")
node_to_affect = NodePath("..") node_to_affect = NodePath("")
property_name = "texture" property_name = "texture"
mode = 1 mode = 1
resource_json = ExtResource("28_ugdi7") resource_json = ExtResource("28_ugdi7")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik" 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 process_mode = 1
visibility_layer = 2 visibility_layer = 2
z_index = -50 z_index = -50
@@ -761,9 +740,17 @@ amount = 64
texture = SubResource("GradientTexture1D_78nlv") texture = SubResource("GradientTexture1D_78nlv")
lifetime = 5.0 lifetime = 5.0
preprocess = 10.0 preprocess = 10.0
fixed_fps = 30
fract_delta = false fract_delta = false
local_coords = true 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="."] [node name="FGLayer" type="Parallax2D" parent="."]
process_mode = 1 process_mode = 1

View File

@@ -2,7 +2,7 @@ extends Enemy
@export var player_range := 24 @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: func _enter_tree() -> void:
$Animation.play("Hide") $Animation.play("Hide")
@@ -15,7 +15,7 @@ func _ready() -> void:
func on_timeout() -> void: func on_timeout() -> void:
var player = get_tree().get_first_node_in_group("Players") 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: if abs(player.global_position.x - global_position.x) >= player_range:
$Animation.play("Rise") $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): elif (abs(player.global_position.y - global_position.y) >= player_range and abs(player.global_position.x - global_position.x) >= player_range * 2):