Added first round of graphics
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user