diff options
author | rom <romangraef@gmail.com> | 2021-04-25 13:52:34 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-25 13:52:34 +0200 |
commit | c3961f5891f6a90396c6ce31ce9a62b87cb2fd55 (patch) | |
tree | 7c8160b59acdc506900c89a717b8a7581d75a6b5 | |
parent | 26900b16664922203ad658f0f561624114ac601d (diff) | |
download | ldjam48-c3961f5891f6a90396c6ce31ce9a62b87cb2fd55.tar.gz ldjam48-c3961f5891f6a90396c6ce31ce9a62b87cb2fd55.tar.bz2 ldjam48-c3961f5891f6a90396c6ce31ce9a62b87cb2fd55.zip |
fix button hitboxes
-rw-r--r-- | components/button.gd | 4 | ||||
-rw-r--r-- | components/button.tscn | 12 | ||||
-rw-r--r-- | project.godot | 2 | ||||
-rw-r--r-- | scenes/levels/base_level.tscn | 1 | ||||
-rw-r--r-- | scenes/menu.tscn | 1 | ||||
-rw-r--r-- | scenes/pause.gd | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/components/button.gd b/components/button.gd index f5f1606..734e048 100644 --- a/components/button.gd +++ b/components/button.gd @@ -44,7 +44,9 @@ func _ready(): stretcher.scale.x = width / BASE_WIDTH left.position.x = -width / 2 - BASE_WIDTH right.position.x = width / 2 + BASE_WIDTH - hitbox.shape.extents.x = width / 2 + BASE_WIDTH * 3 + hitbox.shape = RectangleShape2D.new() + hitbox.shape.extents.y = 32 + hitbox.shape.extents.x = right.position.x + right.scale.x * BASE_WIDTH / 2 diff --git a/components/button.tscn b/components/button.tscn index 580ef29..3a8029e 100644 --- a/components/button.tscn +++ b/components/button.tscn @@ -1,13 +1,10 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://textures/components/button/middle.png" type="Texture" id=1] [ext_resource path="res://textures/components/button/right.png" type="Texture" id=2] [ext_resource path="res://textures/components/button/left.png" type="Texture" id=4] [ext_resource path="res://components/button.gd" type="Script" id=5] -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 10, 32 ) - [node name="Button" type="Area2D"] script = ExtResource( 5 ) @@ -17,17 +14,16 @@ scale = Vector2( 4, 4 ) texture = ExtResource( 4 ) [node name="Right" type="Sprite" parent="."] -position = Vector2( 100, 0 ) +position = Vector2( 99, 0 ) scale = Vector2( 4, 4 ) texture = ExtResource( 2 ) [node name="Middle" type="Sprite" parent="."] -position = Vector2( -0.5, 0 ) -scale = Vector2( 30.321, 4 ) +scale = Vector2( 29, 4 ) texture = ExtResource( 1 ) [node name="Hitbox" type="CollisionShape2D" parent="."] -shape = SubResource( 1 ) + [connection signal="input_event" from="." to="." method="_on_ButtonTest_input_event"] [connection signal="mouse_entered" from="." to="." method="_on_ButtonTest_mouse_entered"] [connection signal="mouse_exited" from="." to="." method="_on_ButtonTest_mouse_exited"] diff --git a/project.godot b/project.godot index 4c5983b..82b37c7 100644 --- a/project.godot +++ b/project.godot @@ -26,7 +26,7 @@ _global_script_class_icons={ [application] -config/name="Deeper and Deeper" +config/name="Deeper but Lighter" run/main_scene="res://scenes/menu.tscn" config/icon="res://icon.png" diff --git a/scenes/levels/base_level.tscn b/scenes/levels/base_level.tscn index cd32baa..dee17e8 100644 --- a/scenes/levels/base_level.tscn +++ b/scenes/levels/base_level.tscn @@ -62,4 +62,5 @@ speed = 10.0 [node name="PauseMenu" parent="." instance=ExtResource( 5 )] visible = false position = Vector2( 155.016, 424.068 ) + [connection signal="on_click" from="MenuButton" to="." method="_on_MenuButton_on_click"] diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 991e272..34b444b 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -52,5 +52,6 @@ texture = ExtResource( 6 ) position = Vector2( 1081.89, 246.278 ) scale = Vector2( 4.35795, 4.35795 ) texture = SubResource( 1 ) + [connection signal="on_click" from="Exit" to="." method="_on_Exit_on_click"] [connection signal="on_click" from="Strart" to="." method="_on_Strart_on_click"] diff --git a/scenes/pause.gd b/scenes/pause.gd index 57ab574..43a2d5b 100644 --- a/scenes/pause.gd +++ b/scenes/pause.gd @@ -6,7 +6,7 @@ onready var backgroud = $Sprite func pause(): pause_menu.visible = true pause_menu.pause_mode = PAUSE_MODE_PROCESS # to be save - # get_tree().paused = true + get_tree().paused = true func _ready(): @@ -15,7 +15,7 @@ func _ready(): func _on_Resume_on_click(): pause_menu.visible = false - # get_tree().paused = false + get_tree().paused = false func _on_Main_Menu_on_click(): |