Initial: playable 3-level Breakout with menus, audio, and power-ups
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
[gd_scene format=3 uid="uid://b0ball00001"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/ball.gd" id="1_ball"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ball"]
|
||||
radius = 8.0
|
||||
|
||||
[node name="Ball" type="CharacterBody2D"]
|
||||
position = Vector2(640, 600)
|
||||
collision_layer = 0
|
||||
collision_mask = 3
|
||||
script = ExtResource("1_ball")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_ball")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -8.0
|
||||
offset_top = -8.0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
color = Color(1, 1, 1, 1)
|
||||
@@ -0,0 +1,21 @@
|
||||
[gd_scene format=3 uid="uid://b0brick0001"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/brick.gd" id="1_brick"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_brick"]
|
||||
size = Vector2(96, 32)
|
||||
|
||||
[node name="Brick" type="StaticBody2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_brick")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_brick")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -48.0
|
||||
offset_top = -16.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 16.0
|
||||
color = Color(0.3, 0.7, 0.4, 1)
|
||||
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://b0lose0one1"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lose"]
|
||||
size = Vector2(1280, 20)
|
||||
|
||||
[node name="LoseZone" type="Area2D"]
|
||||
position = Vector2(640, 710)
|
||||
collision_layer = 0
|
||||
collision_mask = 3
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_lose")
|
||||
@@ -0,0 +1,62 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://b0main00001"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/main.gd" id="1_main"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0paddle0001" path="res://scenes/paddle.tscn" id="2_paddle"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0ball00001" path="res://scenes/ball.tscn" id="3_ball"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0brick0001" path="res://scenes/brick.tscn" id="4_brick"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0losezone1" path="res://scenes/lose_zone.tscn" id="5_lose"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0hud000001" path="res://scenes/ui/hud.tscn" id="6_hud"]
|
||||
[ext_resource type="Script" path="res://scripts/audio.gd" id="7_audio"]
|
||||
[ext_resource type="Script" path="res://scripts/level.gd" id="8_level"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wall"]
|
||||
size = Vector2(1280, 20)
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource("1_main")
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
color = Color(0.1, 0.12, 0.16, 1)
|
||||
z_index = -10
|
||||
|
||||
[node name="Audio" type="Node" parent="."]
|
||||
script = ExtResource("7_audio")
|
||||
|
||||
[node name="World" type="Node2D" parent="."]
|
||||
|
||||
[node name="Level" type="Node2D" parent="World"]
|
||||
script = ExtResource("8_level")
|
||||
|
||||
[node name="PowerUps" type="Node2D" parent="World"]
|
||||
|
||||
[node name="Paddle" parent="World" instance=ExtResource("2_paddle")]
|
||||
position = Vector2(640, 640)
|
||||
|
||||
[node name="Ball" parent="World" instance=ExtResource("3_ball")]
|
||||
position = Vector2(640, 612)
|
||||
|
||||
[node name="LoseZone" parent="World" instance=ExtResource("5_lose")]
|
||||
|
||||
[node name="Walls" type="StaticBody2D" parent="World"]
|
||||
collision_layer = 1
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Top" type="CollisionShape2D" parent="World/Walls"]
|
||||
position = Vector2(640, 10)
|
||||
shape = SubResource("RectangleShape2D_wall")
|
||||
|
||||
[node name="LeftWall" type="CollisionShape2D" parent="World/Walls"]
|
||||
position = Vector2(10, 360)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("RectangleShape2D_wall")
|
||||
|
||||
[node name="RightWall" type="CollisionShape2D" parent="World/Walls"]
|
||||
position = Vector2(1270, 360)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("RectangleShape2D_wall")
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="HUD" parent="UI" instance=ExtResource("6_hud")]
|
||||
@@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b0paddle0001"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/paddle.gd" id="1_paddle"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_paddle"]
|
||||
size = Vector2(96, 16)
|
||||
|
||||
[node name="Paddle" type="CharacterBody2D"]
|
||||
position = Vector2(640, 640)
|
||||
collision_layer = 1
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_paddle")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_paddle")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -48.0
|
||||
offset_top = -8.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 8.0
|
||||
color = Color(0.4, 0.6, 1, 1)
|
||||
@@ -0,0 +1,32 @@
|
||||
[gd_scene format=3 uid="uid://b0powerup01"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/power_up.gd" id="1_pu"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pu"]
|
||||
size = Vector2(28, 16)
|
||||
|
||||
[node name="PowerUp" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 1
|
||||
script = ExtResource("1_pu")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_pu")
|
||||
|
||||
[node name="Visual" type="ColorRect" parent="."]
|
||||
offset_left = -14.0
|
||||
offset_top = -8.0
|
||||
offset_right = 14.0
|
||||
offset_bottom = 8.0
|
||||
color = Color(0.3, 0.9, 0.4, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="Visual"]
|
||||
offset_left = -14.0
|
||||
offset_top = -8.0
|
||||
offset_right = 14.0
|
||||
offset_bottom = 8.0
|
||||
text = "W"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
@@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b0hud000001"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/ui/hud.gd" id="1_hud"]
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource("1_hud")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 300.0
|
||||
offset_bottom = 60.0
|
||||
text = "Score: 0"
|
||||
|
||||
[node name="LivesLabel" type="Label" parent="."]
|
||||
offset_left = 1000.0
|
||||
offset_top = 20.0
|
||||
offset_right = 1260.0
|
||||
offset_bottom = 60.0
|
||||
text = "Lives: 3"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="LivesContainer" type="HBoxContainer" parent="."]
|
||||
offset_left = 900.0
|
||||
offset_top = 60.0
|
||||
offset_right = 1260.0
|
||||
offset_bottom = 80.0
|
||||
alignment = 2
|
||||
|
||||
[node name="MessageLabel" type="Label" parent="."]
|
||||
offset_left = 0.0
|
||||
offset_top = 340.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 380.0
|
||||
text = "按 空格 发球"
|
||||
horizontal_alignment = 1
|
||||
@@ -0,0 +1,68 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b0mainmenu1"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/ui/main_menu.gd" id="1_menu"]
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_menu")
|
||||
|
||||
[node name="Panel" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
color = Color(0.08, 0.1, 0.14, 1)
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_top = 180.0
|
||||
offset_bottom = 280.0
|
||||
text = "MY BRICKS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="StartButton" type="Button" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -100.0
|
||||
offset_top = -40.0
|
||||
offset_right = 100.0
|
||||
offset_bottom = 0.0
|
||||
text = "开始游戏"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -100.0
|
||||
offset_top = 20.0
|
||||
offset_right = 100.0
|
||||
offset_bottom = 60.0
|
||||
text = "退出"
|
||||
|
||||
[node name="Hint" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -40.0
|
||||
text = "空格 = 发球 / 鼠标移动挡板"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="StartButton" to="." method="_on_start_pressed"]
|
||||
[connection signal="pressed" from="QuitButton" to="." method="_on_quit_pressed"]
|
||||
Reference in New Issue
Block a user