Sparkles and Powerball
This commit is contained in:
12
Ball/Ball.gd
12
Ball/Ball.gd
@@ -1,4 +1,5 @@
|
|||||||
extends RigidBody2D
|
extends RigidBody2D
|
||||||
|
class_name Ball
|
||||||
|
|
||||||
const MIN_SPEED = 50.0
|
const MIN_SPEED = 50.0
|
||||||
const MAX_SPEED = 500.0
|
const MAX_SPEED = 500.0
|
||||||
@@ -23,6 +24,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
PhysicsServer2D.BODY_STATE_TRANSFORM,
|
PhysicsServer2D.BODY_STATE_TRANSFORM,
|
||||||
Transform2D.IDENTITY.translated(capture_object.global_position - capture_offset)
|
Transform2D.IDENTITY.translated(capture_object.global_position - capture_offset)
|
||||||
)
|
)
|
||||||
|
global_position = capture_object.global_position - capture_offset
|
||||||
linear_velocity = Vector2.ZERO
|
linear_velocity = Vector2.ZERO
|
||||||
angular_velocity = 0
|
angular_velocity = 0
|
||||||
else:
|
else:
|
||||||
@@ -77,3 +79,13 @@ func _on_body_exited(body: Node) -> void:
|
|||||||
|
|
||||||
func slowdown() -> void:
|
func slowdown() -> void:
|
||||||
speed = 100
|
speed = 100
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node) -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
func enable_sparkles() -> void:
|
||||||
|
$CPUParticles2D.emitting = true
|
||||||
|
|
||||||
|
func disable_sparkles() -> void:
|
||||||
|
$CPUParticles2D.emitting = false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://clfo2nrropg8y"]
|
[gd_scene load_steps=9 format=3 uid="uid://clfo2nrropg8y"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Ball/Ball.gd" id="1_2xu4j"]
|
[ext_resource type="Script" path="res://Ball/Ball.gd" id="1_2xu4j"]
|
||||||
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="1_vk3rj"]
|
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="1_vk3rj"]
|
||||||
@@ -10,8 +10,12 @@
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_nwcsc"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_nwcsc"]
|
||||||
radius = 3.0
|
radius = 3.0
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_umh5r"]
|
||||||
|
colors = PackedColorArray(1, 1, 0, 1, 1, 1, 0, 0)
|
||||||
|
|
||||||
[node name="Ball" type="RigidBody2D"]
|
[node name="Ball" type="RigidBody2D"]
|
||||||
collision_layer = 0
|
collision_layer = 4
|
||||||
|
collision_mask = 5
|
||||||
mass = 0.01
|
mass = 0.01
|
||||||
physics_material_override = ExtResource("1_vk3rj")
|
physics_material_override = ExtResource("1_vk3rj")
|
||||||
gravity_scale = 0.0
|
gravity_scale = 0.0
|
||||||
@@ -49,5 +53,20 @@ bus = &"Effects"
|
|||||||
stream = ExtResource("5_f8nt3")
|
stream = ExtResource("5_f8nt3")
|
||||||
bus = &"Effects"
|
bus = &"Effects"
|
||||||
|
|
||||||
|
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
amount = 200
|
||||||
|
emission_shape = 1
|
||||||
|
emission_sphere_radius = 3.0
|
||||||
|
direction = Vector2(0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector2(0, 0)
|
||||||
|
initial_velocity_min = 1.0
|
||||||
|
initial_velocity_max = 1.0
|
||||||
|
color = Color(1, 1, 0, 1)
|
||||||
|
color_ramp = SubResource("Gradient_umh5r")
|
||||||
|
hue_variation_min = 1.0
|
||||||
|
hue_variation_max = 1.0
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var hits : int = 1
|
|||||||
var value : int = 100
|
var value : int = 100
|
||||||
var original_color : Color = Color.WHITE
|
var original_color : Color = Color.WHITE
|
||||||
var my_type : int = NORMAL
|
var my_type : int = NORMAL
|
||||||
|
var pass_mode : bool = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass
|
pass
|
||||||
@@ -45,7 +46,8 @@ func _show_block() -> void:
|
|||||||
var tween = create_tween()
|
var tween = create_tween()
|
||||||
tween.tween_property($TextureRect, "modulate", original_color, 0.25)
|
tween.tween_property($TextureRect, "modulate", original_color, 0.25)
|
||||||
visible = true
|
visible = true
|
||||||
collision_layer = 1
|
if not pass_mode:
|
||||||
|
collision_layer = 1
|
||||||
|
|
||||||
|
|
||||||
func type(base : int, color : Color) -> void:
|
func type(base : int, color : Color) -> void:
|
||||||
@@ -72,5 +74,17 @@ func type(base : int, color : Color) -> void:
|
|||||||
$TextureRect.modulate = color
|
$TextureRect.modulate = color
|
||||||
hits = 2
|
hits = 2
|
||||||
value = 0
|
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
|
||||||
|
|||||||
@@ -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="Script" path="res://Brick/Brick.gd" id="1_eylhu"]
|
||||||
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="1_it5u2"]
|
[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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xxkpg"]
|
||||||
size = Vector2(32, 16)
|
size = Vector2(32, 16)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wi5j7"]
|
||||||
|
size = Vector2(32, 16)
|
||||||
|
|
||||||
[node name="Brick" type="StaticBody2D"]
|
[node name="Brick" type="StaticBody2D"]
|
||||||
input_pickable = true
|
input_pickable = true
|
||||||
physics_material_override = ExtResource("1_it5u2")
|
physics_material_override = ExtResource("1_it5u2")
|
||||||
@@ -34,4 +37,12 @@ grow_vertical = 2
|
|||||||
texture = ExtResource("2_v230s")
|
texture = ExtResource("2_v230s")
|
||||||
stretch_mode = 2
|
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="input_event" from="." to="." method="_on_input_event"]
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||||
|
|||||||
26
Dunkanoid.gd
26
Dunkanoid.gd
@@ -135,7 +135,7 @@ func _brick_destroyed(brick) -> void:
|
|||||||
var upgrade = _Upgrade.instantiate()
|
var upgrade = _Upgrade.instantiate()
|
||||||
upgrade.position = brick.position
|
upgrade.position = brick.position
|
||||||
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
||||||
match randi() % 5:
|
match randi() % 6:
|
||||||
0:
|
0:
|
||||||
upgrade.set_upgrade("C", Color.BLUE)
|
upgrade.set_upgrade("C", Color.BLUE)
|
||||||
1:
|
1:
|
||||||
@@ -146,6 +146,8 @@ func _brick_destroyed(brick) -> void:
|
|||||||
upgrade.set_upgrade("E", Color.DARK_SEA_GREEN)
|
upgrade.set_upgrade("E", Color.DARK_SEA_GREEN)
|
||||||
4:
|
4:
|
||||||
upgrade.set_upgrade("R", Color.LIGHT_CORAL)
|
upgrade.set_upgrade("R", Color.LIGHT_CORAL)
|
||||||
|
5:
|
||||||
|
upgrade.set_upgrade("P", Color.AQUAMARINE)
|
||||||
add_child(upgrade)
|
add_child(upgrade)
|
||||||
bricks.erase(brick)
|
bricks.erase(brick)
|
||||||
var brick_count = 0
|
var brick_count = 0
|
||||||
@@ -174,10 +176,8 @@ func _brick_destroyed(brick) -> void:
|
|||||||
$RunTimer.pause()
|
$RunTimer.pause()
|
||||||
$NewBestTime/BestTime.text = format_time(elapsed)
|
$NewBestTime/BestTime.text = format_time(elapsed)
|
||||||
$NewBestTime.visible = true
|
$NewBestTime.visible = true
|
||||||
print($RunTimer.elapsed_time)
|
|
||||||
|
|
||||||
func format_time(time : int) -> String:
|
func format_time(time : int) -> String:
|
||||||
print(time)
|
|
||||||
if time > 3600000:
|
if time > 3600000:
|
||||||
return "--:--.--"
|
return "--:--.--"
|
||||||
return "%02d:%05.2f" % [time / 60000, time % 60000 / 1000.0]
|
return "%02d:%05.2f" % [time / 60000, time % 60000 / 1000.0]
|
||||||
@@ -263,6 +263,8 @@ func _on_upgrade_collected(code : String) -> void:
|
|||||||
$Paddle.big()
|
$Paddle.big()
|
||||||
"R":
|
"R":
|
||||||
$Paddle.small()
|
$Paddle.small()
|
||||||
|
"P":
|
||||||
|
start_powerball()
|
||||||
|
|
||||||
func add_ball() -> void:
|
func add_ball() -> void:
|
||||||
if balls.size() == 0:
|
if balls.size() == 0:
|
||||||
@@ -320,7 +322,6 @@ func load_level(data) -> void:
|
|||||||
$Bricks.add_child(brick)
|
$Bricks.add_child(brick)
|
||||||
|
|
||||||
func _on_start_round_finished(item : int) -> void:
|
func _on_start_round_finished(item : int) -> void:
|
||||||
print("Jingle done")
|
|
||||||
Music.jingle_finished.disconnect(_on_start_round_finished)
|
Music.jingle_finished.disconnect(_on_start_round_finished)
|
||||||
$Start.visible = false
|
$Start.visible = false
|
||||||
mode = MODE_PLAY
|
mode = MODE_PLAY
|
||||||
@@ -340,3 +341,20 @@ func _on_paddle_effect_finished(effect: int) -> void:
|
|||||||
for ball in balls:
|
for ball in balls:
|
||||||
if ball.captured:
|
if ball.captured:
|
||||||
ball.release()
|
ball.release()
|
||||||
|
|
||||||
|
func start_powerball() -> void:
|
||||||
|
for ball in balls:
|
||||||
|
ball.enable_sparkles()
|
||||||
|
for brick in $Bricks.get_children():
|
||||||
|
brick.enable_pass()
|
||||||
|
$PowerBallTimer.start(10)
|
||||||
|
|
||||||
|
func stop_powerball() -> void:
|
||||||
|
for ball in balls:
|
||||||
|
ball.disable_sparkles()
|
||||||
|
for brick in $Bricks.get_children():
|
||||||
|
brick.disable_pass()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_power_ball_timer_timeout() -> void:
|
||||||
|
stop_powerball()
|
||||||
|
|||||||
@@ -325,6 +325,10 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme = ExtResource("8_wcf7g")
|
theme = ExtResource("8_wcf7g")
|
||||||
|
|
||||||
|
[node name="PowerBallTimer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="update_lives" from="." to="." method="_on_update_lives"]
|
[connection signal="update_lives" from="." to="." method="_on_update_lives"]
|
||||||
[connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"]
|
[connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"]
|
||||||
[connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"]
|
[connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"]
|
||||||
|
[connection signal="timeout" from="PowerBallTimer" to="." method="_on_power_ball_timer_timeout"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://c2oboya05agti"]
|
[gd_scene load_steps=6 format=3 uid="uid://c2oboya05agti"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Intro.gd" id="1_1hnh1"]
|
[ext_resource type="Script" path="res://Intro.gd" id="1_1hnh1"]
|
||||||
[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="2_a44d8"]
|
[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="2_a44d8"]
|
||||||
@@ -10,6 +10,9 @@ max_value = 200.0
|
|||||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 200), 0.0, 0.0, 0, 0]
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 200), 0.0, 0.0, 0, 0]
|
||||||
point_count = 2
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_431mb"]
|
||||||
|
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
|
||||||
|
|
||||||
[node name="Intro" type="Node2D"]
|
[node name="Intro" type="Node2D"]
|
||||||
script = ExtResource("1_1hnh1")
|
script = ExtResource("1_1hnh1")
|
||||||
|
|
||||||
@@ -23,10 +26,12 @@ direction = Vector2(0, 0)
|
|||||||
spread = 180.0
|
spread = 180.0
|
||||||
gravity = Vector2(0, 0)
|
gravity = Vector2(0, 0)
|
||||||
initial_velocity_min = 10.0
|
initial_velocity_min = 10.0
|
||||||
initial_velocity_max = 1000.0
|
initial_velocity_max = 800.0
|
||||||
linear_accel_min = 100.0
|
linear_accel_min = 100.0
|
||||||
linear_accel_max = 1000.0
|
linear_accel_max = 1000.0
|
||||||
linear_accel_curve = SubResource("Curve_jhhjd")
|
linear_accel_curve = SubResource("Curve_jhhjd")
|
||||||
|
color_ramp = SubResource("Gradient_431mb")
|
||||||
|
hue_variation_max = 1.0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
offset_top = 104.0
|
offset_top = 104.0
|
||||||
|
|||||||
@@ -1,20 +1,37 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://dbf2kicev8ma7"]
|
[gd_scene load_steps=5 format=3 uid="uid://dbf2kicev8ma7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Upgrade/Upgrade.gd" id="1_3jp1b"]
|
[ext_resource type="Script" path="res://Upgrade/Upgrade.gd" id="1_3jp1b"]
|
||||||
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="2_iabep"]
|
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="2_iabep"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_ll6dt"]
|
||||||
|
colors = PackedColorArray(1, 1, 0, 1, 1, 1, 0, 0)
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_slgxc"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_slgxc"]
|
||||||
radius = 6.0
|
radius = 6.0
|
||||||
height = 24.0
|
height = 24.0
|
||||||
|
|
||||||
[node name="Upgrade" type="RigidBody2D"]
|
[node name="Upgrade" type="RigidBody2D"]
|
||||||
collision_layer = 4
|
collision_layer = 0
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
continuous_cd = 2
|
continuous_cd = 2
|
||||||
max_contacts_reported = 2
|
max_contacts_reported = 2
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
script = ExtResource("1_3jp1b")
|
script = ExtResource("1_3jp1b")
|
||||||
|
|
||||||
|
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
|
||||||
|
amount = 100
|
||||||
|
lifetime = 2.0
|
||||||
|
emission_shape = 3
|
||||||
|
emission_rect_extents = Vector2(10, 1)
|
||||||
|
direction = Vector2(0, -1)
|
||||||
|
gravity = Vector2(0, 0)
|
||||||
|
initial_velocity_min = 5.0
|
||||||
|
initial_velocity_max = 5.0
|
||||||
|
color = Color(1, 1, 0, 1)
|
||||||
|
color_ramp = SubResource("Gradient_ll6dt")
|
||||||
|
hue_variation_min = 1.0
|
||||||
|
hue_variation_max = 1.0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
shape = SubResource("CapsuleShape2D_slgxc")
|
shape = SubResource("CapsuleShape2D_slgxc")
|
||||||
|
|||||||
Reference in New Issue
Block a user