Sparkles and Powerball

This commit is contained in:
2024-05-07 23:12:23 +01:00
parent 0017d49923
commit 0cc0b4a40b
8 changed files with 113 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ var hits : int = 1
var value : int = 100
var original_color : Color = Color.WHITE
var my_type : int = NORMAL
var pass_mode : bool = false
func _ready() -> void:
pass
@@ -45,7 +46,8 @@ func _show_block() -> void:
var tween = create_tween()
tween.tween_property($TextureRect, "modulate", original_color, 0.25)
visible = true
collision_layer = 1
if not pass_mode:
collision_layer = 1
func type(base : int, color : Color) -> void:
@@ -72,5 +74,17 @@ func type(base : int, color : Color) -> void:
$TextureRect.modulate = color
hits = 2
value = 0
func _on_area_2d_body_entered(body: Node2D) -> void:
if body is Ball:
body._on_body_exited(self)
pass # Replace with function body.
func enable_pass() -> void:
collision_layer = 0
pass_mode = true
func disable_pass() -> void:
if visible:
collision_layer = 1
pass_mode = false

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://wld2y5cseki8"]
[gd_scene load_steps=6 format=3 uid="uid://wld2y5cseki8"]
[ext_resource type="Script" path="res://Brick/Brick.gd" id="1_eylhu"]
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="1_it5u2"]
@@ -7,6 +7,9 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xxkpg"]
size = Vector2(32, 16)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wi5j7"]
size = Vector2(32, 16)
[node name="Brick" type="StaticBody2D"]
input_pickable = true
physics_material_override = ExtResource("1_it5u2")
@@ -34,4 +37,12 @@ grow_vertical = 2
texture = ExtResource("2_v230s")
stretch_mode = 2
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 4
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_wi5j7")
[connection signal="input_event" from="." to="." method="_on_input_event"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]