Added nearly all basic features.

Added bounce physics, collision layers, masks, and names, pins (and the extra bouncy GiantPin), walls, cup physics, a sample level, and a score system with an accompanying auto-updating GUI label.
This commit is contained in:
2022-01-28 00:03:38 -05:00
parent b5082f86b1
commit 2491055a7e
117 changed files with 799 additions and 34 deletions

View File

@@ -1,7 +1,22 @@
extends Area2D
extends StaticBody2D
signal change_score
func _on_Cup_body_entered(body: Node) -> void:
func _ready() -> void:
var score = get_tree().get_root().find_node("GUI", true, false)
score.connect("change_score", score, "handle_change_score")
print(score)
func _on_GoalArea_body_entered(body: Node) -> void:
if body.is_in_group("Balls"):
print("Yatta!")
emit_signal("change_score", 10)
body.queue_free()

View File

@@ -1,18 +1,30 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Art/Extras-07.png" type="Texture" id=1]
[ext_resource path="res://Art/Cup.png" type="Texture" id=1]
[ext_resource path="res://Cups/Cup.gd" type="Script" id=2]
[node name="Cup" type="Area2D" groups=[
"Buckets",
]]
[node name="Cup" type="StaticBody2D" groups=["Buckets"]]
collision_layer = 4
collision_mask = 8
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
flip_v = true
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( 28, 4, -28, 4, 0, 23 )
[node name="GoalArea" type="Area2D" parent="."]
[connection signal="body_entered" from="." to="." method="_on_Cup_body_entered"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="GoalArea"]
polygon = PoolVector2Array( 12, 10, -11, 10, 0, 23 )
[node name="Edge" type="CollisionPolygon2D" parent="."]
position = Vector2( -28, 15 )
rotation = -2.35619
polygon = PoolVector2Array( 28, 4, -26.1629, 14.8492, 16.9706, 15.5563 )
[node name="Edge2" type="CollisionPolygon2D" parent="."]
position = Vector2( 46, 15 )
rotation = -2.35619
polygon = PoolVector2Array( 28, 4, 26.87, -36.7696, 16.9706, 15.5563 )
[connection signal="body_entered" from="GoalArea" to="." method="_on_GoalArea_body_entered"]