Added first round of graphics
This commit is contained in:
17
Arkanoid.gdshader
Normal file
17
Arkanoid.gdshader
Normal file
@@ -0,0 +1,17 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
void vertex() {
|
||||
// Called for every vertex the material is visible on.
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Called for every pixel the material is visible on.
|
||||
if (COLOR.rgba == vec4(1.0, 0.0, 1.0, 1.0)) {
|
||||
COLOR.rgb = vec3(UV.y * 8.0, UV.y * 6.0, 1.0 - (UV.y * 14.0));
|
||||
}
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// Called for every pixel for every light affecting the CanvasItem.
|
||||
// Uncomment to replace the default light processing function with this one.
|
||||
//}
|
||||
@@ -12,6 +12,8 @@ var capture_object : Node2D
|
||||
var capture_offset : Vector2 = Vector2.ZERO
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
angular_velocity = 0
|
||||
rotation = 0
|
||||
if captured:
|
||||
PhysicsServer2D.body_set_state(
|
||||
get_rid(),
|
||||
@@ -27,6 +29,8 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
if body is Brick:
|
||||
if not body.visible:
|
||||
return
|
||||
#linear_velocity = (linear_velocity.normalized() + (Vector2(randf() - 0.5, randf() - 0.5) / 2.0)).normalized() * linear_velocity.length()
|
||||
$BrickSound.play()
|
||||
body.hit()
|
||||
|
||||
BIN
Ball/Ball.png
Normal file
BIN
Ball/Ball.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 591 B |
34
Ball/Ball.png.import
Normal file
34
Ball/Ball.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://wye1kea3ts48"
|
||||
path="res://.godot/imported/Ball.png-586f401d09fe0752614fb4e34d1b45f6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Ball/Ball.png"
|
||||
dest_files=["res://.godot/imported/Ball.png-586f401d09fe0752614fb4e34d1b45f6.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
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://clfo2nrropg8y"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://clfo2nrropg8y"]
|
||||
|
||||
[ext_resource type="Script" path="res://Ball/Ball.gd" id="1_2xu4j"]
|
||||
[ext_resource type="Texture2D" uid="uid://wye1kea3ts48" path="res://Ball/Ball.png" id="2_cpnep"]
|
||||
[ext_resource type="AudioStream" uid="uid://7kjt62y3t8lc" path="res://Sounds/WallHit.wav" id="3_bwkax"]
|
||||
[ext_resource type="AudioStream" uid="uid://b6vosap1la1ts" path="res://Sounds/BrickHit.wav" id="4_ly8mo"]
|
||||
[ext_resource type="AudioStream" uid="uid://d3g30x1n2ncjj" path="res://Sounds/PaddleHit.wav" id="5_f8nt3"]
|
||||
@@ -13,6 +14,7 @@ bounce = 1.0
|
||||
radius = 3.0
|
||||
|
||||
[node name="Ball" type="RigidBody2D"]
|
||||
collision_layer = 0
|
||||
physics_material_override = SubResource("PhysicsMaterial_tqihs")
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = 1
|
||||
@@ -20,8 +22,12 @@ max_contacts_reported = 5
|
||||
contact_monitor = true
|
||||
script = ExtResource("1_2xu4j")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
polygon = PackedVector2Array(-3, -3, 3, -3, 3, 3, -3, 3)
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
offset_left = -3.0
|
||||
offset_top = -3.0
|
||||
offset_right = 3.0
|
||||
offset_bottom = 3.0
|
||||
texture = ExtResource("2_cpnep")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_nwcsc")
|
||||
|
||||
BIN
Brick/BaseBrick.png
Normal file
BIN
Brick/BaseBrick.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 593 B |
34
Brick/BaseBrick.png.import
Normal file
34
Brick/BaseBrick.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cipjurqgguse7"
|
||||
path="res://.godot/imported/BaseBrick.png-df478bfc6600efb9d2bd6507b5d3c216.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Brick/BaseBrick.png"
|
||||
dest_files=["res://.godot/imported/BaseBrick.png-df478bfc6600efb9d2bd6507b5d3c216.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
|
||||
@@ -1,18 +1,18 @@
|
||||
extends StaticBody2D
|
||||
class_name Brick
|
||||
|
||||
enum {
|
||||
NORMAL,
|
||||
SHINY,
|
||||
INVULNERABLE
|
||||
}
|
||||
|
||||
signal brick_destroyed(brick : StaticBody2D)
|
||||
|
||||
@export var hits : int = 1
|
||||
@export var value : int = 100
|
||||
@export var color : Color :
|
||||
set(c):
|
||||
color = c
|
||||
if $Polygon2D != null:
|
||||
$Polygon2D.color = c
|
||||
|
||||
func _init() -> void:
|
||||
name = "Brick"
|
||||
var hits : int = 1
|
||||
var value : int = 100
|
||||
var original_color : Color = Color.WHITE
|
||||
var my_type : int = NORMAL
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
@@ -24,14 +24,47 @@ func hit() -> void:
|
||||
if hits <= 0:
|
||||
return
|
||||
hits -= 1
|
||||
var tween = create_tween()
|
||||
$Polygon2D.color = Color(1, 1, 1)
|
||||
tween.tween_property($Polygon2D, "color", color, 0.25)
|
||||
tween.tween_callback(_hitfade_done)
|
||||
if hits <= 0:
|
||||
collision_layer = 0
|
||||
if my_type == INVULNERABLE:
|
||||
hits = 2
|
||||
visible = false
|
||||
get_tree().create_timer(5).timeout.connect(_show_block)
|
||||
return
|
||||
brick_destroyed.emit(self)
|
||||
|
||||
func _hitfade_done() -> void:
|
||||
if hits <= 0:
|
||||
get_parent().remove_child(self)
|
||||
queue_free()
|
||||
else:
|
||||
var tween = create_tween()
|
||||
$TextureRect.modulate = Color(1, 1, 1)
|
||||
tween.tween_property($TextureRect, "modulate", original_color, 0.25)
|
||||
|
||||
func _show_block() -> void:
|
||||
$TextureRect.modulate = Color(1, 1, 1)
|
||||
var tween = create_tween()
|
||||
tween.tween_property($TextureRect, "modulate", original_color, 0.25)
|
||||
visible = true
|
||||
collision_layer = 1
|
||||
|
||||
|
||||
func type(base : int, color : Color) -> void:
|
||||
my_type = base
|
||||
original_color = color
|
||||
match base:
|
||||
NORMAL:
|
||||
$TextureRect.texture = load("res://Brick/BaseBrick.png")
|
||||
$TextureRect.modulate = color
|
||||
hits = 1
|
||||
value = 100
|
||||
SHINY:
|
||||
$TextureRect.texture = load("res://Brick/ShinyBrick.png")
|
||||
$TextureRect.modulate = color
|
||||
hits = 2
|
||||
value = 200
|
||||
INVULNERABLE:
|
||||
$TextureRect.texture = load("res://Brick/InvulBrick.png")
|
||||
$TextureRect.modulate = color
|
||||
hits = 2
|
||||
value = 0
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://wld2y5cseki8"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://wld2y5cseki8"]
|
||||
|
||||
[ext_resource type="Script" path="res://Brick/Brick.gd" id="1_eylhu"]
|
||||
[ext_resource type="Texture2D" uid="uid://cipjurqgguse7" path="res://Brick/BaseBrick.png" id="2_v230s"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_s6ufd"]
|
||||
rough = true
|
||||
@@ -14,13 +15,19 @@ input_pickable = true
|
||||
physics_material_override = SubResource("PhysicsMaterial_s6ufd")
|
||||
constant_linear_velocity = Vector2(0, 50)
|
||||
script = ExtResource("1_eylhu")
|
||||
color = Color(0.203922, 0.682353, 0.4, 1)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_xxkpg")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
color = Color(0.203922, 0.682353, 0.4, 1)
|
||||
polygon = PackedVector2Array(-15, -7, 15, -7, 15, 7, -15, 7)
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_v230s")
|
||||
stretch_mode = 2
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
|
||||
BIN
Brick/InvulBrick.png
Normal file
BIN
Brick/InvulBrick.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 657 B |
34
Brick/InvulBrick.png.import
Normal file
34
Brick/InvulBrick.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dn3h7kulxisb0"
|
||||
path="res://.godot/imported/InvulBrick.png-ebb3673dfb058ac03c9a8fc9a31748cd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Brick/InvulBrick.png"
|
||||
dest_files=["res://.godot/imported/InvulBrick.png-ebb3673dfb058ac03c9a8fc9a31748cd.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
|
||||
BIN
Brick/ShinyBrick.png
Normal file
BIN
Brick/ShinyBrick.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 614 B |
34
Brick/ShinyBrick.png.import
Normal file
34
Brick/ShinyBrick.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ct1ksbbjc61lr"
|
||||
path="res://.godot/imported/ShinyBrick.png-08da15e371535310e14a8c7f17275a06.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Brick/ShinyBrick.png"
|
||||
dest_files=["res://.godot/imported/ShinyBrick.png-08da15e371535310e14a8c7f17275a06.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
|
||||
185
Dunkanoid.gd
185
Dunkanoid.gd
@@ -1,51 +1,138 @@
|
||||
extends Node2D
|
||||
|
||||
var Brick = preload("res://Brick/Brick.tscn")
|
||||
var Ball = preload("res://Ball/Ball.tscn")
|
||||
var Upgrade = preload("res://Upgrade/Upgrade.tscn")
|
||||
var _Brick = preload("res://Brick/Brick.tscn")
|
||||
var _Ball = preload("res://Ball/Ball.tscn")
|
||||
var _Upgrade = preload("res://Upgrade/Upgrade.tscn")
|
||||
|
||||
var bricks : Array = []
|
||||
var balls : Array[Node] = []
|
||||
|
||||
enum {
|
||||
MODE_WAIT,
|
||||
MODE_PLAY,
|
||||
MODE_EXIT,
|
||||
MODE_LEAVE
|
||||
}
|
||||
|
||||
var mode = MODE_WAIT
|
||||
|
||||
signal update_score
|
||||
|
||||
const levels = {
|
||||
"DUNKANOID": {
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
"sssssssssssss",
|
||||
"YYYBYYsCCRCCC",
|
||||
"YYBBYYsCCRRCC",
|
||||
"YBBBBBsRRRRRC",
|
||||
"BBBBBBsRRRRRR",
|
||||
"YBBBBBsRRRRRC",
|
||||
"YYBBYYsCCRRCC",
|
||||
"YYYBYYsCCRCCC",
|
||||
"ssisssssssiss"
|
||||
],
|
||||
"left": "RAINBOW",
|
||||
"right": "SATERRANOID",
|
||||
"round": 1
|
||||
},
|
||||
"RAINBOW": {
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
" RRRRR ",
|
||||
" RRRRRRR ",
|
||||
" RROOOOORR ",
|
||||
" RROOOOORR ",
|
||||
" RROOYYYOORR ",
|
||||
" ROOYBBBYOOR ",
|
||||
" ROYBBBBBYOR ",
|
||||
"RROYB BYORR",
|
||||
"ROYBg gBYOR",
|
||||
"ROYB BYOR",
|
||||
"ROYB BYOR",
|
||||
"ROYB BYOR",
|
||||
"ROYB BYOR",
|
||||
"ROYB BYOR",
|
||||
"sssss s sssss"
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"right": "DUNKANOID",
|
||||
"round": 2
|
||||
},
|
||||
"SATERRANOID": {
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
"WWOOCCgGGRRBB",
|
||||
"WWOOCCgGGRRBB",
|
||||
"OOCCGGgRRBBMM",
|
||||
"OOCCGGgRRBBMM",
|
||||
"CCGGRRgBBMMYY",
|
||||
"CCGGRRgBBMMYY",
|
||||
"GGRRBBgMMYYWW",
|
||||
"GGRRBBgMMYYWW",
|
||||
"RRBBMMgYYWWOO",
|
||||
"RRBBMMgYYWWOO",
|
||||
"BBMMYYgWWOOCC",
|
||||
"BBMMYYgWWOOCC",
|
||||
"MMYYWWgOOCCGG",
|
||||
"MMYYWWgOOCCGG"
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"right": "DUNKANOID",
|
||||
"round": 2
|
||||
}
|
||||
}
|
||||
|
||||
var capture_mode : bool = false
|
||||
var lives : int = 3
|
||||
var score : int = 0 :
|
||||
set(x):
|
||||
score = x
|
||||
update_score.emit()
|
||||
var level : String = "SATERRANOID"
|
||||
|
||||
func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED_HIDDEN)
|
||||
new_level()
|
||||
|
||||
func _process(_delta : float) -> void:
|
||||
if mode == MODE_EXIT:
|
||||
if $Paddle.global_position.x == 32:
|
||||
level = levels[level].left
|
||||
new_level()
|
||||
if $Paddle.global_position.x == 416:
|
||||
level = levels[level].right
|
||||
new_level()
|
||||
|
||||
func new_level() -> void:
|
||||
mode = MODE_WAIT
|
||||
$Exits.visible = false
|
||||
for ball in balls:
|
||||
remove_child(ball)
|
||||
ball.queue_free()
|
||||
for y in 8:
|
||||
for x in 16:
|
||||
var brick = Brick.instantiate()
|
||||
brick.color = Color(randf(), randf(), randf())
|
||||
brick.position = Vector2(x * 32 + 16, y * 16 + 8 + 32)
|
||||
bricks.push_back(brick)
|
||||
brick.brick_destroyed.connect(_brick_destroyed)
|
||||
add_child(brick)
|
||||
var ball = Ball.instantiate()
|
||||
balls.clear()
|
||||
|
||||
$Start/Title.text = level
|
||||
$Start/Round.text = "ROUND %3d" % [levels[level].round]
|
||||
load_level(levels[level].data)
|
||||
var ball = _Ball.instantiate()
|
||||
ball.capture($Paddle, Vector2((randf() * 32) - 16, 8))
|
||||
ball.hit_paddle.connect(_on_hit_paddle)
|
||||
ball.hit_floor.connect(_on_hit_floor)
|
||||
add_child(ball)
|
||||
balls.push_back(ball)
|
||||
|
||||
|
||||
$Start.visible = true
|
||||
$StartRound.play()
|
||||
|
||||
|
||||
func _brick_destroyed(brick) -> void:
|
||||
score += brick.value
|
||||
if randf() > 0.9:
|
||||
var upgrade = Upgrade.instantiate()
|
||||
var upgrade = _Upgrade.instantiate()
|
||||
upgrade.position = brick.position
|
||||
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
||||
match randi() % 3:
|
||||
@@ -57,18 +144,27 @@ func _brick_destroyed(brick) -> void:
|
||||
upgrade.set_upgrade("X", Color.RED)
|
||||
add_child(upgrade)
|
||||
bricks.erase(brick)
|
||||
if bricks.size() == 0:
|
||||
var brick_count = 0
|
||||
for abrick in bricks:
|
||||
if abrick.my_type != Brick.INVULNERABLE:
|
||||
brick_count += 1
|
||||
|
||||
if brick_count == 0:
|
||||
for ball in balls:
|
||||
remove_child(ball)
|
||||
ball.queue_free()
|
||||
balls.erase(ball)
|
||||
balls.clear()
|
||||
mode = MODE_EXIT
|
||||
$Exits.visible = true
|
||||
$RoundWon.play()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
$Paddle.position = Vector2(min(max(16, event.position.x), 512-16), 340)
|
||||
$Paddle.position = Vector2(min(max(32, event.position.x), 432-16), 340)
|
||||
if event is InputEventMouseButton:
|
||||
if mode != MODE_PLAY:
|
||||
return
|
||||
for ball in balls:
|
||||
if (ball.captured):
|
||||
ball.release()
|
||||
@@ -80,12 +176,11 @@ func _on_hit_paddle(ball) -> void:
|
||||
|
||||
func _on_hit_floor(ball) -> void:
|
||||
$FloorSound.play()
|
||||
print("Hit floor!")
|
||||
balls.erase(ball)
|
||||
remove_child(ball)
|
||||
ball.call_deferred("queue_free")
|
||||
if balls.size() == 0:
|
||||
ball = Ball.instantiate()
|
||||
ball = _Ball.instantiate()
|
||||
ball.capture($Paddle, Vector2((randf() * 32) - 16, 8))
|
||||
ball.hit_paddle.connect(_on_hit_paddle)
|
||||
ball.hit_floor.connect(_on_hit_floor)
|
||||
@@ -95,7 +190,7 @@ func _on_hit_floor(ball) -> void:
|
||||
|
||||
|
||||
func _on_round_won_finished() -> void:
|
||||
new_level()
|
||||
pass
|
||||
|
||||
|
||||
func _on_update_score() -> void:
|
||||
@@ -115,15 +210,61 @@ func _on_upgrade_collected(code : String) -> void:
|
||||
add_ball()
|
||||
|
||||
func add_ball() -> void:
|
||||
var newball = Ball.instantiate()
|
||||
var newball = _Ball.instantiate()
|
||||
newball.position = balls[0].position
|
||||
newball.linear_velocity = balls[0].linear_velocity - Vector2((randf() - 0.5) * 30 , 0)
|
||||
newball.linear_velocity = (balls[0].linear_velocity - Vector2((randf() - 0.5) * 100 , 0)).normalized() * balls[0].linear_velocity.length()
|
||||
newball.angular_velocity = 0
|
||||
newball.hit_paddle.connect(_on_hit_paddle)
|
||||
newball.hit_floor.connect(_on_hit_floor)
|
||||
if balls[0].captured:
|
||||
newball.capture($Paddle, Vector2((randf() - 0.5) * 32, 8))
|
||||
add_child(newball)
|
||||
balls.push_back(newball)
|
||||
|
||||
|
||||
func _cancel_capture_mode() -> void:
|
||||
capture_mode = false
|
||||
|
||||
func load_level(data) -> void:
|
||||
for y in data.size():
|
||||
var line : String = data[y]
|
||||
for x in line.length():
|
||||
var c = line.substr(x, 1)
|
||||
if c == " ":
|
||||
continue
|
||||
|
||||
var brick = _Brick.instantiate()
|
||||
match c:
|
||||
"R":
|
||||
brick.type(Brick.NORMAL, Color.RED)
|
||||
"G":
|
||||
brick.type(Brick.NORMAL, Color.GREEN)
|
||||
"Y":
|
||||
brick.type(Brick.NORMAL, Color.YELLOW)
|
||||
"B":
|
||||
brick.type(Brick.NORMAL, Color.BLUE)
|
||||
"M":
|
||||
brick.type(Brick.NORMAL, Color.MAGENTA)
|
||||
"C":
|
||||
brick.type(Brick.NORMAL, Color.CYAN)
|
||||
"W":
|
||||
brick.type(Brick.NORMAL, Color.WHITE)
|
||||
"O":
|
||||
brick.type(Brick.NORMAL, Color.ORANGE)
|
||||
"s":
|
||||
brick.type(Brick.SHINY, Color.SILVER)
|
||||
"g":
|
||||
brick.type(Brick.SHINY, Color.GOLD)
|
||||
"i":
|
||||
brick.type(Brick.INVULNERABLE, Color.GRAY)
|
||||
|
||||
brick.position = Vector2(x * 32 + 16 + 16, y * 16 + 8 + 16)
|
||||
bricks.push_back(brick)
|
||||
brick.brick_destroyed.connect(_brick_destroyed)
|
||||
add_child(brick)
|
||||
|
||||
|
||||
|
||||
func _on_start_round_finished() -> void:
|
||||
$Start.visible = false
|
||||
mode = MODE_PLAY
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://4q0epdnb0x4s"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://4q0epdnb0x4s"]
|
||||
|
||||
[ext_resource type="Script" path="res://Dunkanoid.gd" id="1_kv4if"]
|
||||
[ext_resource type="PackedScene" uid="uid://dndemjw7up2r6" path="res://Paddle/Paddle.tscn" id="2_26c5i"]
|
||||
@@ -8,6 +8,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://818gpo5mes22" path="res://Sounds/Start.wav" id="6_s0pha"]
|
||||
[ext_resource type="AudioStream" uid="uid://bh2blx1uovmyt" path="res://Sounds/Win.wav" id="7_xrjor"]
|
||||
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="8_wcf7g"]
|
||||
[ext_resource type="Shader" path="res://Arkanoid.gdshader" id="9_20w5w"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_yf4r2"]
|
||||
rough = true
|
||||
@@ -15,19 +16,24 @@ bounce = 1.0
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_jsudl"]
|
||||
normal = Vector2(0, 1)
|
||||
distance = 1.0
|
||||
distance = 16.0
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_3e48c"]
|
||||
normal = Vector2(1, 0)
|
||||
distance = 16.0
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_jt2f6"]
|
||||
normal = Vector2(-1, 0)
|
||||
distance = -512.0
|
||||
distance = -432.0
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"]
|
||||
distance = -360.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6dsnv"]
|
||||
shader = ExtResource("9_20w5w")
|
||||
|
||||
[node name="Dunkanoid" type="Node2D"]
|
||||
texture_filter = 1
|
||||
script = ExtResource("1_kv4if")
|
||||
|
||||
[node name="Paddle" parent="." instance=ExtResource("2_26c5i")]
|
||||
@@ -64,21 +70,86 @@ stream = ExtResource("6_s0pha")
|
||||
stream = ExtResource("7_xrjor")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
offset_left = 551.0
|
||||
offset_top = 16.0
|
||||
offset_right = 602.0
|
||||
offset_bottom = 39.0
|
||||
offset_left = 509.0
|
||||
offset_top = 29.0
|
||||
offset_right = 560.0
|
||||
offset_bottom = 52.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "SCORE"
|
||||
|
||||
[node name="ScoreBox" type="Label" parent="."]
|
||||
offset_left = 518.0
|
||||
offset_top = 41.0
|
||||
offset_right = 636.0
|
||||
offset_bottom = 64.0
|
||||
offset_left = 479.0
|
||||
offset_top = 54.0
|
||||
offset_right = 597.0
|
||||
offset_bottom = 77.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00000000"
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 16.0
|
||||
offset_bottom = 360.0
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="."]
|
||||
offset_left = 432.0
|
||||
offset_right = 448.0
|
||||
offset_bottom = 360.0
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="."]
|
||||
offset_right = 432.0
|
||||
offset_bottom = 16.0
|
||||
|
||||
[node name="Start" type="Node2D" parent="."]
|
||||
z_index = 1
|
||||
|
||||
[node name="Title" type="Label" parent="Start"]
|
||||
material = SubResource("ShaderMaterial_6dsnv")
|
||||
offset_left = 16.0
|
||||
offset_top = 199.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 224.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
text = "DUNKANOID"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Round" type="Label" parent="Start"]
|
||||
offset_left = 16.0
|
||||
offset_top = 224.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 247.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "ROUND 1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Ready" type="Label" parent="Start"]
|
||||
offset_left = 16.0
|
||||
offset_top = 247.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 270.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "READY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Exits" type="Node2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="Left" type="ColorRect" parent="Exits"]
|
||||
offset_top = 312.0
|
||||
offset_right = 16.0
|
||||
offset_bottom = 360.0
|
||||
color = Color(0, 0, 1, 1)
|
||||
|
||||
[node name="Right" type="ColorRect" parent="Exits"]
|
||||
offset_left = 432.0
|
||||
offset_top = 312.0
|
||||
offset_right = 448.0
|
||||
offset_bottom = 360.0
|
||||
color = Color(0, 0, 1, 1)
|
||||
|
||||
[connection signal="update_score" from="." to="." method="_on_update_score"]
|
||||
[connection signal="finished" from="StartRound" to="." method="_on_start_round_finished"]
|
||||
[connection signal="finished" from="RoundWon" to="." method="_on_round_won_finished"]
|
||||
|
||||
BIN
Fonts/arkanoid/ARKANOID.TTF
Normal file
BIN
Fonts/arkanoid/ARKANOID.TTF
Normal file
Binary file not shown.
33
Fonts/arkanoid/ARKANOID.TTF.import
Normal file
33
Fonts/arkanoid/ARKANOID.TTF.import
Normal file
@@ -0,0 +1,33 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://mduic7knx6ys"
|
||||
path="res://.godot/imported/ARKANOID.TTF-e56b7bb26971286406fa1fd81ff60299.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Fonts/arkanoid/ARKANOID.TTF"
|
||||
dest_files=["res://.godot/imported/ARKANOID.TTF-e56b7bb26971286406fa1fd81ff60299.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
BIN
Fonts/arkanoid/Arka_solid.ttf
Normal file
BIN
Fonts/arkanoid/Arka_solid.ttf
Normal file
Binary file not shown.
33
Fonts/arkanoid/Arka_solid.ttf.import
Normal file
33
Fonts/arkanoid/Arka_solid.ttf.import
Normal file
@@ -0,0 +1,33 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bx41ej4o03nbx"
|
||||
path="res://.godot/imported/Arka_solid.ttf-ab8598b9789dfaf2a40c59663eefac9d.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Fonts/arkanoid/Arka_solid.ttf"
|
||||
dest_files=["res://.godot/imported/Arka_solid.ttf-ab8598b9789dfaf2a40c59663eefac9d.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
27
Fonts/arkanoid/Readme.txt
Normal file
27
Fonts/arkanoid/Readme.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
"Arkanoid" - TrueType Font
|
||||
(c) 2000 by ck! [Freaky Fonts]
|
||||
|
||||
The personal, non-commercial use of my font is free.
|
||||
But Donations are accepted and highly appreciated!
|
||||
The use of my fonts for commercial and profit purposes is prohibited,
|
||||
unless a small donation is send to me.
|
||||
Contact: ck@freakyfonts.de
|
||||
These font files may not be modified or renamed.
|
||||
This readme file must be included with each font, unchanged.
|
||||
Redistribute? Sure, but send me an e-mail.
|
||||
|
||||
If you like the font, please mail:
|
||||
ck@freakyfonts.de
|
||||
|
||||
Visit .:Freaky Fonts:. for updates and new fonts (PC & MAC) :
|
||||
http://www.freakyfonts.de
|
||||
http://www.geocities.com/Area51/Shadowlands/7677/
|
||||
|
||||
Thanks to {ths} for the Mac conversion.
|
||||
ths@higoto.de or visit: http://www.higoto.de/ths
|
||||
|
||||
Note:
|
||||
Font based on the ARKANOID Logo, the #1 arcade breakout game, by TAITO Corporation
|
||||
http://www.taito.co.jp
|
||||
play some JAVA Arkanoid Games:
|
||||
http://www.arkanoid.net
|
||||
6
Fonts/arkanoid/copy.txt
Normal file
6
Fonts/arkanoid/copy.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
Arkanoid vs. Iomanoid
|
||||
|
||||
During the development of this font the well known fontdesigner Ray Larabie
|
||||
http://www.larabiefonts.com
|
||||
also published an Arkanoid related font: Imanoid.
|
||||
Sadly only some days before i finished my own independent font-creation. ;(
|
||||
@@ -1,8 +1,15 @@
|
||||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cfvww0geatnnk"]
|
||||
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://cfvww0geatnnk"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dfkm2dibf0c3b" path="res://Fonts/fonts-DSEG_v046/DSEG7-Classic-MINI/DSEG7ClassicMini-Italic.ttf" id="1_17to7"]
|
||||
[ext_resource type="FontFile" uid="uid://bx41ej4o03nbx" path="res://Fonts/arkanoid/Arka_solid.ttf" id="1_s07ae"]
|
||||
|
||||
[resource]
|
||||
Arkanoid/base_type = &"Label"
|
||||
Arkanoid/colors/font_color = Color(1, 0, 1, 1)
|
||||
Arkanoid/colors/font_outline_color = Color(1, 0.647059, 0, 1)
|
||||
Arkanoid/constants/outline_size = 2
|
||||
Arkanoid/font_sizes/font_size = 24
|
||||
Arkanoid/fonts/font = ExtResource("1_s07ae")
|
||||
Numbers/base_type = &"Label"
|
||||
Numbers/colors/font_color = Color(1, 0.764706, 0, 1)
|
||||
Numbers/colors/font_outline_color = Color(0.996078, 0.380392, 0.137255, 0.898039)
|
||||
|
||||
@@ -24,6 +24,7 @@ color = Color(0, 0.258824, 1, 1)
|
||||
polygon = PackedVector2Array(-8, -8, 8, -8, 12, -7, 15, -4, 16, 0, 15, 4, 12, 7, 8, 8, -8, 8, -12, 7, -15, 4, -16, 0, -15, -4, -12, -7)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
texture_filter = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
|
||||
4
default_bus_layout.tres
Normal file
4
default_bus_layout.tres
Normal file
@@ -0,0 +1,4 @@
|
||||
[gd_resource type="AudioBusLayout" format=3 uid="uid://cw31i0khpovnh"]
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = 0.267241
|
||||
37
export_presets.cfg
Normal file
37
export_presets.cfg
Normal file
@@ -0,0 +1,37 @@
|
||||
[preset.0]
|
||||
|
||||
name="Web"
|
||||
platform="Web"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../../export/Dunkanoid/index.html"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/extensions_support=false
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/export_icon=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
html/canvas_resize_policy=2
|
||||
html/focus_canvas_on_start=true
|
||||
html/experimental_virtual_keyboard=false
|
||||
progressive_web_app/enabled=false
|
||||
progressive_web_app/offline_page=""
|
||||
progressive_web_app/display=1
|
||||
progressive_web_app/orientation=0
|
||||
progressive_web_app/icon_144x144=""
|
||||
progressive_web_app/icon_180x180=""
|
||||
progressive_web_app/icon_512x512=""
|
||||
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||
@@ -24,6 +24,10 @@ window/size/mode=3
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
[editor]
|
||||
|
||||
naming/screen_space_roughness_limiter/enabled=true
|
||||
|
||||
[physics]
|
||||
|
||||
2d/default_gravity=0.0
|
||||
@@ -33,4 +37,5 @@ window/stretch/scale_mode="integer"
|
||||
|
||||
[rendering]
|
||||
|
||||
anti_aliasing/screen_space_roughness_limiter/enabled=false
|
||||
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
|
||||
|
||||
Reference in New Issue
Block a user