mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-22 08:04:23 +00:00
🐞 Fix weird press hitbox
This commit is contained in:
parent
5c7789677a
commit
f8efc85aeb
3 changed files with 44 additions and 23 deletions
|
@ -21,14 +21,8 @@ conveyor_speed = 100.0
|
|||
|
||||
[node name="SingleScreenWalls" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Press" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 420, 0 )
|
||||
|
||||
[node name="Conductor" parent="." instance=ExtResource( 2 )]
|
||||
song_bpm = 30.0
|
||||
|
||||
[node name="Conductor2" parent="." instance=ExtResource( 2 )]
|
||||
song_bpm = 30.0
|
||||
song_bpm = 120.0
|
||||
|
||||
[node name="ScrollingBlock" parent="." instance=ExtResource( 6 )]
|
||||
position = Vector2( 800, 660 )
|
||||
|
@ -69,3 +63,34 @@ position = Vector2( 1240, 220 )
|
|||
[node name="ScrollingBlock13" parent="." instance=ExtResource( 6 )]
|
||||
position = Vector2( 1660, 220 )
|
||||
scale = Vector2( 20, 1 )
|
||||
|
||||
[node name="ScrollingBlock14" parent="." instance=ExtResource( 6 )]
|
||||
position = Vector2( 2240, 360 )
|
||||
scale = Vector2( 5, 1 )
|
||||
|
||||
[node name="ScrollingBlock15" parent="." instance=ExtResource( 6 )]
|
||||
position = Vector2( 2540, 280 )
|
||||
scale = Vector2( 5, 1 )
|
||||
|
||||
[node name="ScrollingBlock16" parent="." instance=ExtResource( 6 )]
|
||||
position = Vector2( 2820, 400 )
|
||||
scale = Vector2( 5, 1 )
|
||||
|
||||
[node name="Press" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 160, 0 )
|
||||
scroll_velocity = Vector2( 0, 0 )
|
||||
|
||||
[node name="Press2" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 3120, 0 )
|
||||
|
||||
[node name="Press3" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 3280, 0 )
|
||||
subbeat_offset = 3
|
||||
|
||||
[node name="Press4" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 3440, 0 )
|
||||
subbeat_offset = 6
|
||||
|
||||
[node name="Press5" parent="." instance=ExtResource( 5 )]
|
||||
position = Vector2( 3600, 0 )
|
||||
subbeat_offset = 9
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/press_bottom.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Scripts/Obstacles/Press.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Sprites/press_pipes.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "Stomp"
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/path = NodePath("Bottom:position:y")
|
||||
|
@ -59,19 +59,13 @@ tracks/4/keys = {
|
|||
"values": [ true, false ]
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 78, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=5]
|
||||
extents = Vector2( 80, 76.5 )
|
||||
|
||||
[node name="Press" type="StaticBody2D"]
|
||||
[node name="Press" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
playback_process_mode = 0
|
||||
playback_speed = 3.5
|
||||
anims/Stomp = SubResource( 3 )
|
||||
anims/Stomp = SubResource( 1 )
|
||||
|
||||
[node name="Pipes" type="Node2D" parent="."]
|
||||
|
||||
|
@ -93,10 +87,8 @@ collision_mask = 2
|
|||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bottom/StompArea"]
|
||||
position = Vector2( 0, 157 )
|
||||
shape = SubResource( 4 )
|
||||
disabled = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 0, 76.5 )
|
||||
shape = SubResource( 5 )
|
||||
[connection signal="body_entered" from="Bottom/StompArea" to="." method="_on_StompArea_body_entered"]
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
extends StaticBody2D
|
||||
extends ScrollingBlock
|
||||
class_name Press
|
||||
|
||||
export(int, 0, 47) var subbeat_offset = 0
|
||||
|
||||
var root_node: Node = null
|
||||
var conductor: Conductor = null
|
||||
|
||||
|
||||
func _subbeat(subbeat_num):
|
||||
if subbeat_num % 24 == 0:
|
||||
if (subbeat_num - subbeat_offset) % 48 == 0:
|
||||
$AnimationPlayer.play("Stomp")
|
||||
elif subbeat_num % 24 == 12:
|
||||
elif (subbeat_num - subbeat_offset) % 48 == 24:
|
||||
$AnimationPlayer.play_backwards("Stomp")
|
||||
|
||||
func _enter_tree():
|
||||
$CollisionShape2D.shape = RectangleShape2D.new()
|
||||
$CollisionShape2D.shape.extents = Vector2(80, 76.5)
|
||||
$Bottom/StompArea/CollisionShape2D.shape = RectangleShape2D.new()
|
||||
$Bottom/StompArea/CollisionShape2D.shape.extents = Vector2(78, 4)
|
||||
root_node = get_tree().current_scene
|
||||
conductor = root_node.get_node("Conductor")
|
||||
conductor.connect("subbeat", self, "_subbeat")
|
||||
|
||||
|
||||
func _on_StompArea_body_entered(body):
|
||||
print(body)
|
||||
|
|
Loading…
Reference in a new issue