added a speed ball and buttons to add them to the level
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
radius = 25.0
|
||||
|
||||
[node name="Ball" instance=ExtResource("1_ffml1")]
|
||||
speed = 4.0
|
||||
strength = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_gj21y")
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ooytugcohlx0"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d2r0ip6xy3a2" path="res://balls/ball.tscn" id="1_fsuj1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsqcbd2cffw6e" path="res://balls/speed/speed.webp" id="2_ttcr2"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gj21y"]
|
||||
radius = 20.0
|
||||
|
||||
[node name="Ball" instance=ExtResource("1_fsuj1")]
|
||||
speed = 8.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_gj21y")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." index="1"]
|
||||
texture = ExtResource("2_ttcr2")
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 922 B |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsqcbd2cffw6e"
|
||||
path="res://.godot/imported/speed.webp-ff30c0e30f233aee3c861d7147dba221.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://balls/speed/speed.webp"
|
||||
dest_files=["res://.godot/imported/speed.webp-ff30c0e30f233aee3c861d7147dba221.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
+12
-6
@@ -1,14 +1,20 @@
|
||||
extends Node2D
|
||||
|
||||
var _current_level = 1
|
||||
var ball_scene = preload("res://balls/basic/ball_basic.tscn")
|
||||
|
||||
func _on_button_pressed():
|
||||
var new_ball = ball_scene.instantiate()
|
||||
new_ball.global_position = $GameContent/BallSpawn.global_position
|
||||
$GameContent/Balls.add_child(new_ball)
|
||||
var ball_basic_scene = preload("res://balls/basic/ball_basic.tscn")
|
||||
var ball_speed_scene = preload("res://balls/speed/ball_speed.tscn")
|
||||
|
||||
func _physics_process(delta):
|
||||
if $GameContent/Blocks.get_children().size() == 0:
|
||||
_current_level += 1
|
||||
print("DONE")
|
||||
|
||||
func _on_button_basic_ball_pressed():
|
||||
var new_ball = ball_basic_scene.instantiate()
|
||||
new_ball.global_position = $GameContent/BallSpawn.global_position
|
||||
$GameContent/Balls.add_child(new_ball)
|
||||
|
||||
func _on_button_speed_ball_pressed():
|
||||
var new_ball = ball_speed_scene.instantiate()
|
||||
new_ball.global_position = $GameContent/BallSpawn.global_position
|
||||
$GameContent/Balls.add_child(new_ball)
|
||||
|
||||
+49
-7
@@ -1,12 +1,17 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bmscox3qtwvs2"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bmscox3qtwvs2"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/level.gd" id="1_3qps3"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7wvhwsys1ll4" path="res://resources/backgrounds/levelbg.webp" id="1_7ct6t"]
|
||||
[ext_resource type="FontFile" uid="uid://dxgnofummhosw" path="res://fonts/play_bold.ttf" id="2_musvo"]
|
||||
[ext_resource type="PackedScene" uid="uid://sl3jbnopo0yh" path="res://balls/basic/ball_basic.tscn" id="3_14yi2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbygje4vi2rkv" path="res://boundaries/world_boundary.tscn" id="4_455ct"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxi0fqy5sajh5" path="res://balls/basic/basic.webp" id="4_phqmb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsqcbd2cffw6e" path="res://balls/speed/speed.webp" id="5_mxuen"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1i1fp3xbp6ly" path="res://blocks/block.tscn" id="7_7fnx3"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3mf1b"]
|
||||
bg_color = Color(0.341176, 0.392157, 0.564706, 1)
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ybmo2"]
|
||||
normal = Vector2(0, 1)
|
||||
distance = -510.0
|
||||
@@ -33,7 +38,9 @@ offset_right = 1920.0
|
||||
offset_bottom = 1080.0
|
||||
texture = ExtResource("1_7ct6t")
|
||||
|
||||
[node name="GUI" type="VBoxContainer" parent="."]
|
||||
[node name="GUI" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 360.0
|
||||
@@ -41,6 +48,8 @@ offset_bottom = 1060.0
|
||||
|
||||
[node name="Title0" type="Label" parent="GUI"]
|
||||
layout_mode = 2
|
||||
offset_right = 340.0
|
||||
offset_bottom = 179.0
|
||||
theme_override_fonts/font = ExtResource("2_musvo")
|
||||
theme_override_font_sizes/font_size = 154
|
||||
text = "IDLE"
|
||||
@@ -48,16 +57,48 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="Title1" type="Label" parent="GUI"]
|
||||
layout_mode = 2
|
||||
offset_top = 183.0
|
||||
offset_right = 340.0
|
||||
offset_bottom = 258.0
|
||||
theme_override_fonts/font = ExtResource("2_musvo")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "BREAKOUT"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Button" type="Button" parent="GUI"]
|
||||
[node name="Panel" type="PanelContainer" parent="GUI"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("2_musvo")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "ADD BALL"
|
||||
offset_top = 260.0
|
||||
offset_right = 340.0
|
||||
offset_bottom = 1040.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_3mf1b")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="GUI/Panel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="GUI/Panel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ButtonBasicBall" type="TextureButton" parent="GUI/Panel/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
texture_normal = ExtResource("4_phqmb")
|
||||
stretch_mode = 0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="GUI/Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ButtonSpeedBall" type="TextureButton" parent="GUI/Panel/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
texture_normal = ExtResource("5_mxuen")
|
||||
stretch_mode = 0
|
||||
|
||||
[node name="GameContent" type="Node2D" parent="."]
|
||||
|
||||
@@ -128,4 +169,5 @@ position = Vector2(1635, 293)
|
||||
[node name="BallSpawn" type="Node2D" parent="GameContent"]
|
||||
position = Vector2(1140, 540)
|
||||
|
||||
[connection signal="pressed" from="GUI/Button" to="." method="_on_button_pressed"]
|
||||
[connection signal="pressed" from="GUI/Panel/MarginContainer/VBoxContainer/HBoxContainer/ButtonBasicBall" to="." method="_on_button_basic_ball_pressed"]
|
||||
[connection signal="pressed" from="GUI/Panel/MarginContainer/VBoxContainer/HBoxContainer2/ButtonSpeedBall" to="." method="_on_button_speed_ball_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user