Load sandbox level when starting, make cards scale up on hover

This commit is contained in:
Sebastian Morr 2020-10-15 15:02:43 +02:00
parent a9c96e478d
commit 8e49efe906
5 changed files with 37 additions and 13 deletions

23
card.gd
View file

@ -10,6 +10,7 @@ export var description = "" setget set_description
var _first_argument = null
var _home_position = null
var _home_rotation = null
func _ready():
set_process_unhandled_input(true)
@ -18,6 +19,25 @@ func _process(delta):
if dragged:
var mousepos = get_viewport().get_mouse_position()
global_position = mousepos - drag_offset
var target_scale = 1
if hovered and not dragged:
target_scale = 1.5
# if hovered:
# rotation = 0
# else:
# if _home_rotation:
# rotation_degrees = _home_rotation
var speed = 5
scale = lerp(scale, Vector2(target_scale, target_scale), 10*delta)
# if scale.x < target_scale:
# scale += speed*delta*Vector2(1, 1)
# elif scale.x > target_scale:
# scale -= speed*delta*Vector2(1, 1)
func _unhandled_input(event):
if event is InputEventMouseButton:
@ -44,9 +64,11 @@ func _unhandled_input(event):
func _mouse_entered():
hovered = true
z_index = 1
func _mouse_exited():
hovered = false
z_index = 0
func set_command(new_command):
command = new_command
@ -58,6 +80,7 @@ func set_description(new_description):
func move_back():
position = _home_position
rotation_degrees = _home_rotation
func buuurn():
queue_free()

View file

@ -71,6 +71,7 @@ func arrange_cards():
target_position += translation_vec
current_angle += angle_between_cards
card._home_position = target_position
card._home_rotation = target_rotation
var tween = Tween.new()
tween.interpolate_property(card, "position", card.position, target_position, 0.5, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)

View file

@ -0,0 +1 @@
sandbox

View file

@ -27,7 +27,7 @@ func _ready():
helpers.crash("Could not change to sandbox scene")
return
current_chapter = 2
current_chapter = 1
current_level = 0
# Initialize level select.

View file

@ -57,7 +57,7 @@ __meta__ = {
[node name="Columns" type="HSplitContainer" parent="Rows"]
margin_right = 1904.0
margin_bottom = 1064.0
margin_bottom = 784.0
mouse_filter = 2
size_flags_vertical = 3
__meta__ = {
@ -66,7 +66,7 @@ __meta__ = {
[node name="Repositories" type="HBoxContainer" parent="Rows/Columns"]
margin_right = 1263.0
margin_bottom = 1064.0
margin_bottom = 784.0
mouse_filter = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 2.0
@ -78,12 +78,12 @@ __meta__ = {
[node name="RightSide" type="VSplitContainer" parent="Rows/Columns"]
margin_left = 1275.0
margin_right = 1904.0
margin_bottom = 1064.0
margin_bottom = 784.0
size_flags_horizontal = 3
[node name="TopStuff" type="VBoxContainer" parent="Rows/Columns/RightSide"]
margin_right = 629.0
margin_bottom = 526.0
margin_bottom = 386.0
size_flags_vertical = 3
[node name="Menu" type="HBoxContainer" parent="Rows/Columns/RightSide/TopStuff"]
@ -144,7 +144,7 @@ __meta__ = {
[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/TopStuff"]
margin_top = 40.0
margin_right = 629.0
margin_bottom = 526.0
margin_bottom = 386.0
size_flags_vertical = 3
[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/TopStuff/LevelPanel"]
@ -160,7 +160,7 @@ __meta__ = {
[node name="Text" type="Control" parent="Rows/Columns/RightSide/TopStuff/LevelPanel"]
margin_top = 65.0
margin_right = 629.0
margin_bottom = 486.0
margin_bottom = 346.0
size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/TopStuff/LevelPanel/Text"]
@ -189,18 +189,17 @@ __meta__ = {
[node name="Terminal" parent="Rows/Columns/RightSide" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 538.0
margin_top = 398.0
margin_right = 629.0
margin_bottom = 1064.0
margin_bottom = 784.0
size_flags_vertical = 3
[node name="Cards" parent="Rows" instance=ExtResource( 3 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 801.0
margin_right = 1920.0
margin_bottom = 1080.0
margin_top = 789.0
margin_right = 1904.0
margin_bottom = 1064.0
size_flags_vertical = 3
size_flags_stretch_ratio = 0.35