Some cleanup and safe area implementation
This commit is contained in:
1 parent
7de25e7c21
commit
1e54f7bb52
27 files changed
+211
-186
No files matched your search
@@ -0,0 +1,15 @@
|
||||
extends Node2D
|
||||
tool
|
||||
|
||||
|
||||
export var color: Color setget set_color
|
||||
|
||||
|
||||
func _ready():
|
||||
set_color(color)
|
||||
|
||||
|
||||
func set_color(new_color):
|
||||
color = new_color
|
||||
if is_inside_tree():
|
||||
$Sprite.material.set_shader_param("color", new_color)
|
||||
@@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/Block.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Resources/brick.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="Shader" id=1]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform vec4 color;
|
||||
|
||||
|
||||
void fragment() {
|
||||
vec4 original_color = texture(TEXTURE, UV);
|
||||
|
||||
COLOR = original_color * color;
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=2]
|
||||
resource_local_to_scene = true
|
||||
shader = SubResource( 1 )
|
||||
shader_param/color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="Block" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 2 )
|
||||
scale = Vector2( 0.125, 0.125 )
|
||||
texture = ExtResource( 2 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeI" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.717647, 1, 0.952941, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.717647, 1, 0.952941, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -96 )
|
||||
color = Color( 0.717647, 1, 0.952941, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -160 )
|
||||
color = Color( 0.717647, 1, 0.952941, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeJ" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, 32 )
|
||||
color = Color( 0.486275, 0.494118, 1, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.486275, 0.494118, 1, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.486275, 0.494118, 1, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -96 )
|
||||
color = Color( 0.486275, 0.494118, 1, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeL" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, 32 )
|
||||
color = Color( 1, 0.47451, 0.47451, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, -32 )
|
||||
color = Color( 1, 0.47451, 0.47451, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, -96 )
|
||||
color = Color( 1, 0.47451, 0.47451, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 1, 0.47451, 0.47451, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeSquare" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.827451, 1, 0.490196, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.827451, 1, 0.490196, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, -32 )
|
||||
color = Color( 0.827451, 1, 0.490196, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, 32 )
|
||||
color = Color( 0.827451, 1, 0.490196, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeS" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, 32 )
|
||||
color = Color( 0.607843, 1, 0.603922, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.607843, 1, 0.603922, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.607843, 1, 0.603922, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 96, -32 )
|
||||
color = Color( 0.607843, 1, 0.603922, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeT" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, 32 )
|
||||
color = Color( 0.968627, 0.411765, 1, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.968627, 0.411765, 1, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.968627, 0.411765, 1, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 96, 32 )
|
||||
color = Color( 0.968627, 0.411765, 1, 1 )
|
||||
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Shapes/TetrisShape.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Shapes/Block.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="ShapeZ" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Block" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( -32, -32 )
|
||||
color = Color( 0.984314, 1, 0.537255, 1 )
|
||||
|
||||
[node name="Block2" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, -32 )
|
||||
color = Color( 0.984314, 1, 0.537255, 1 )
|
||||
|
||||
[node name="Block3" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 32, 32 )
|
||||
color = Color( 0.984314, 1, 0.537255, 1 )
|
||||
|
||||
[node name="Block4" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 96, 32 )
|
||||
color = Color( 0.984314, 1, 0.537255, 1 )
|
||||
@@ -0,0 +1,6 @@
|
||||
extends Node2D
|
||||
class_name TetrisShape
|
||||
|
||||
|
||||
func get_blocks():
|
||||
return get_children()
|
||||
Reference in new issue
Block a user