Initial commit

This commit is contained in:
2025-01-18 14:27:39 +00:00
commit 06dcdb9e4c
11 changed files with 266 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

14
.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
# Godot 4+ specific ignores
.godot/
.import/
export.cfg
export_presets.cfg
*.translation
.mono/
data_*/
mono_crash.*.json
/android/

34
ball.gd Normal file
View File

@@ -0,0 +1,34 @@
extends RigidBody2D
var speed = 300
var velocity
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
velocity = Vector2(1, -1).normalized() * speed
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta: float) -> void:
var collision = move_and_collide(velocity * delta)
if collision:
var obj = collision.get_collider()
if obj.get_parent().is_in_group('Blocks'):
print('block')
obj.on_bonk()
velocity = velocity.bounce(collision.get_normal())
pass
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
print('ball gone')
queue_free()
func _on_body_entered(body: Node) -> void:
return
# print('bonk')
# if body.get_parent().is_in_group('Blocks'):
# print('its a block')
# body.on_bonk()

26
ball.tscn Normal file
View File

@@ -0,0 +1,26 @@
[gd_scene load_steps=4 format=3 uid="uid://bbxc20gvkbtg4"]
[ext_resource type="Script" path="res://ball.gd" id="1_lxc0r"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_4pkmb"]
[sub_resource type="CircleShape2D" id="CircleShape2D_7kx4t"]
[node name="Ball" type="RigidBody2D"]
gravity_scale = 0.0
contact_monitor = true
max_contacts_reported = 50
script = ExtResource("1_lxc0r")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(30, 30)
texture = SubResource("PlaceholderTexture2D_4pkmb")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(2, 2)
shape = SubResource("CircleShape2D_7kx4t")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]

11
block.gd Normal file
View File

@@ -0,0 +1,11 @@
extends StaticBody2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func on_bonk() -> void:
print('goodbye')
queue_free()

18
block.tscn Normal file
View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://bxmatfh6hpb25"]
[ext_resource type="Script" path="res://block.gd" id="1_mhtgf"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_xujbx"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_116d2"]
size = Vector2(213, 70)
[node name="Block" type="StaticBody2D"]
script = ExtResource("1_mhtgf")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(209.188, 68.75)
texture = SubResource("PlaceholderTexture2D_xujbx")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_116d2")

1
icon.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View File

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://de3dikrdfse7d"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

28
level.gd Normal file
View File

@@ -0,0 +1,28 @@
extends Node2D
@export var ball_scene: PackedScene
var ball
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
ball = ball_scene.instantiate()
ball.position = $BallStartPos.position
var direction = randf_range(-PI/2, PI/2)
ball.rotation = direction
ball.linear_velocity = Vector2(randf_range(150.0, 250.0), 0.0).rotated(direction)
add_child(ball)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_block_removal(node: Node) -> void:
pass # Replace with function body.

73
level.tscn Normal file
View File

@@ -0,0 +1,73 @@
[gd_scene load_steps=6 format=3 uid="uid://133k2vqcsdfg"]
[ext_resource type="PackedScene" uid="uid://bxmatfh6hpb25" path="res://block.tscn" id="1_6kkux"]
[ext_resource type="PackedScene" uid="uid://bbxc20gvkbtg4" path="res://ball.tscn" id="1_dwwgw"]
[ext_resource type="Script" path="res://level.gd" id="1_gs11x"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lbv4x"]
size = Vector2(120.5, 772)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1i5ye"]
size = Vector2(555.125, 88.5)
[node name="Game" type="Node2D" groups=["Blocks"]]
script = ExtResource("1_gs11x")
ball_scene = ExtResource("1_dwwgw")
[node name="Background" type="ColorRect" parent="."]
offset_left = -11.0
offset_top = -27.0
offset_right = 504.0
offset_bottom = 753.0
color = Color(0.754947, 1, 0.998037, 1)
[node name="Blocks" type="Node" parent="." groups=["Blocks"]]
[node name="Block4" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(107, 47)
scale = Vector2(0.5, 0.5)
[node name="Block3" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(161, 325)
scale = Vector2(0.5, 0.5)
[node name="Block6" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(138, 481)
scale = Vector2(0.5, 0.5)
[node name="Block5" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(371, 545)
scale = Vector2(0.5, 0.5)
[node name="Block2" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(241, 30)
scale = Vector2(0.5, 0.5)
[node name="Block" parent="Blocks" instance=ExtResource("1_6kkux")]
position = Vector2(294, 196)
scale = Vector2(0.5, 0.5)
[node name="BallStartPos" type="Node2D" parent="."]
position = Vector2(246, 609)
[node name="Boundary" type="Node2D" parent="."]
[node name="StaticBody2D" type="StaticBody2D" parent="Boundary"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Boundary/StaticBody2D"]
position = Vector2(539, 375)
shape = SubResource("RectangleShape2D_lbv4x")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Boundary/StaticBody2D"]
position = Vector2(-62, 377)
shape = SubResource("RectangleShape2D_lbv4x")
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Boundary/StaticBody2D"]
position = Vector2(254.438, -46.25)
shape = SubResource("RectangleShape2D_1i5ye")
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Boundary/StaticBody2D"]
position = Vector2(249, 763)
shape = SubResource("RectangleShape2D_1i5ye")
[connection signal="child_exiting_tree" from="." to="." method="_on_block_removal"]

22
project.godot Normal file
View File

@@ -0,0 +1,22 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="2025-breakout"
run/main_scene="res://level.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=480
window/size/viewport_height=720
window/stretch/mode="canvas_items"