Added Graphic for Blocks

This commit is contained in:
Exobyt 2024-08-20 15:48:20 +02:00
parent 71cbf96618
commit b9eec60df7
21 changed files with 92 additions and 14 deletions

View file

@ -5,6 +5,11 @@ extends Area2D
@onready var raycastRight = $RaycastRight
@onready var raycastTop = $RaycastTop
@onready var spriteBlock = $Block
@onready var spriteSpecialBlock = $SpecialBlock
@onready var spriteExpandBlock = $ExpandBlock
@onready var spriteSpecialExpandedBlock = $SpecialExpandedBlock
@export var UID = 1
var secretPosition = Vector2()
@ -56,3 +61,16 @@ func moveLeft():
move(-64, 0)
func moveRight():
move(64, 0)
func setlook():
match type:
GLOBAL.BLOCKTYPES.LIGHT:
if expand:
spriteExpandBlock.show()
else:
spriteBlock.show()
GLOBAL.BLOCKTYPES.HEAVY:
if expand:
spriteSpecialExpandedBlock.show()
else:
spriteSpecialBlock.show()

View file

@ -1,6 +1,10 @@
[gd_scene load_steps=5 format=3 uid="uid://do8gr42oq2a0y"]
[gd_scene load_steps=9 format=3 uid="uid://do8gr42oq2a0y"]
[ext_resource type="Script" path="res://scenes/Blocks/block.gd" id="1_t1hpt"]
[ext_resource type="Texture2D" uid="uid://cbuxv7iwn0qm7" path="res://assets/Blocks/Block.png" id="2_dyhpk"]
[ext_resource type="Texture2D" uid="uid://dni2qahrw2p0k" path="res://assets/Blocks/SpecialBlock.png" id="3_do2c5"]
[ext_resource type="Texture2D" uid="uid://jmobplsqdy6o" path="res://assets/Blocks/ExpandBlock.png" id="4_c0a60"]
[ext_resource type="Texture2D" uid="uid://13wfksnp806p" path="res://assets/Blocks/SpecialExpandedBlock.png" id="5_nea42"]
[sub_resource type="QuadMesh" id="QuadMesh_lsuac"]
@ -16,6 +20,7 @@ collision_mask = 14
script = ExtResource("1_t1hpt")
[node name="MeshInstance2D" type="MeshInstance2D" parent="."]
visible = false
position = Vector2(31, 31)
scale = Vector2(62, 62)
mesh = SubResource("QuadMesh_lsuac")
@ -58,3 +63,23 @@ collision_layer = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(32, 32)
shape = SubResource("RectangleShape2D_ti23g")
[node name="Block" type="Sprite2D" parent="."]
visible = false
position = Vector2(32, 32)
texture = ExtResource("2_dyhpk")
[node name="SpecialBlock" type="Sprite2D" parent="."]
visible = false
position = Vector2(32, 32)
texture = ExtResource("3_do2c5")
[node name="ExpandBlock" type="Sprite2D" parent="."]
visible = false
position = Vector2(32, 32)
texture = ExtResource("4_c0a60")
[node name="SpecialExpandedBlock" type="Sprite2D" parent="."]
visible = false
position = Vector2(32, 32)
texture = ExtResource("5_nea42")

View file

@ -175,6 +175,7 @@ func PlacePattern():
if i.turningPoint:
block.turningPoint = true
blocks.add_child(block)
block.setlook()
func getNewPatterns():