center taquin

master
Fabien Freling 2020-05-23 17:08:31 +02:00
parent d5edc97e5c
commit c6b9a06419
3 changed files with 20 additions and 10 deletions

View File

@ -37,10 +37,10 @@ __meta__ = {
[node name="Taquin" parent="HSplitContainer" groups=[
"Persist",
] instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 540.0
margin_bottom = 560.0
rows = 4
columns = 4
[node name="VSplitContainer" type="VBoxContainer" parent="HSplitContainer"]
margin_left = 548.0

View File

@ -20,11 +20,11 @@ const Piece = preload("res://src/Piece.tscn")
export var rows: int = 4
export var columns: int = 4
export var width: int = 512
export var height: int = 512
export var difficulty: int = 10
export(State) var current_state = State.MAIN
var width: int
var height: int
var interpiece := 4
var min_padding := 15
var padding := Vector2(min_padding, min_padding)
@ -67,10 +67,15 @@ func _ready() -> void:
print_debug("")
$AnimationPlayer/MockPiece.visible = false
$Particles2D.emitting = false
width = min(rect_size.x, rect_size.y)
height = width
$Background.rect_size.x = width
$Background.rect_size.y = height
$Background.rect_position = (rect_size - $Background.rect_size) / 2
$Background.set_anchors_preset(Control.PRESET_CENTER)
rng.randomize()
new_game("normal")

View File

@ -46,19 +46,24 @@ scale = 5.0
color_ramp = SubResource( 3 )
[node name="Taquin" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 540, 540 )
theme = ExtResource( 4 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
rows = 3
columns = 3
difficulty = 0
[node name="Background" type="ColorRect" parent="."]
margin_right = 512.0
margin_bottom = 512.0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -512.0
margin_top = -300.0
margin_right = -512.0
margin_bottom = -300.0
color = Color( 0.12549, 0.235294, 0.337255, 1 )
__meta__ = {
"_edit_use_anchors_": false