From ce3b060487316821484363ac0ac2ab7ab09d6b13 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 2 Dec 2019 13:42:02 +0100 Subject: [PATCH] add mock animation for piece --- game/src/Piece.tscn | 46 ++++++++++++++++++++++---------------------- game/src/Taquin.tscn | 28 ++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/game/src/Piece.tscn b/game/src/Piece.tscn index 34168ae..f89300b 100644 --- a/game/src/Piece.tscn +++ b/game/src/Piece.tscn @@ -3,35 +3,35 @@ [ext_resource path="res://src/Piece.gd" type="Script" id=1] [ext_resource path="res://assets/escher_lizards.jpg" type="Texture" id=2] -[sub_resource type="VisualShaderNodeVec3Constant" id=11] +[sub_resource type="VisualShaderNodeVec3Constant" id=1] constant = Vector3( 0.3, 0.3, 0 ) -[sub_resource type="VisualShaderNodeTexture" id=1] +[sub_resource type="VisualShaderNodeTexture" id=2] output_port_for_preview = 0 texture = ExtResource( 2 ) -[sub_resource type="VisualShaderNodeInput" id=2] +[sub_resource type="VisualShaderNodeInput" id=3] output_port_for_preview = 0 input_name = "uv" -[sub_resource type="VisualShaderNodeVectorOp" id=3] +[sub_resource type="VisualShaderNodeVectorOp" id=4] output_port_for_preview = 0 default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.25, 0.25, 1 ) ] operator = 2 -[sub_resource type="VisualShaderNodeVectorOp" id=4] +[sub_resource type="VisualShaderNodeVectorOp" id=5] default_input_values = [ 0, Vector3( 0, 0, 0 ), 1, Vector3( 0.8, 0.1, 0 ) ] -[sub_resource type="VisualShaderNodeVec3Uniform" id=5] +[sub_resource type="VisualShaderNodeVec3Uniform" id=6] uniform_name = "scale" -[sub_resource type="VisualShaderNodeVec3Uniform" id=6] +[sub_resource type="VisualShaderNodeVec3Uniform" id=7] uniform_name = "offset" -[sub_resource type="VisualShaderNodeVec3Constant" id=9] +[sub_resource type="VisualShaderNodeVec3Constant" id=8] constant = Vector3( 0.25, 0.25, 1 ) -[sub_resource type="VisualShader" id=7] +[sub_resource type="VisualShader" id=9] code = "shader_type canvas_item; uniform vec3 scale; uniform vec3 offset; @@ -81,38 +81,38 @@ void light() { } " -graph_offset = Vector2( -352.066, -39.2305 ) +graph_offset = Vector2( -286.293, 31.5315 ) mode = 1 flags/light_only = false nodes/fragment/0/position = Vector2( 1080, 160 ) -nodes/fragment/3/node = SubResource( 1 ) +nodes/fragment/3/node = SubResource( 2 ) nodes/fragment/3/position = Vector2( 820, 120 ) -nodes/fragment/4/node = SubResource( 2 ) +nodes/fragment/4/node = SubResource( 3 ) nodes/fragment/4/position = Vector2( 40, 60 ) -nodes/fragment/5/node = SubResource( 3 ) +nodes/fragment/5/node = SubResource( 4 ) nodes/fragment/5/position = Vector2( 360, 80 ) -nodes/fragment/6/node = SubResource( 4 ) +nodes/fragment/6/node = SubResource( 5 ) nodes/fragment/6/position = Vector2( 620, 240 ) -nodes/fragment/7/node = SubResource( 5 ) +nodes/fragment/7/node = SubResource( 6 ) nodes/fragment/7/position = Vector2( 40, 240 ) -nodes/fragment/8/node = SubResource( 6 ) +nodes/fragment/8/node = SubResource( 7 ) nodes/fragment/8/position = Vector2( 360, 380 ) -nodes/fragment/9/node = SubResource( 9 ) +nodes/fragment/9/node = SubResource( 8 ) nodes/fragment/9/position = Vector2( 40, 300 ) -nodes/fragment/11/node = SubResource( 11 ) +nodes/fragment/11/node = SubResource( 1 ) nodes/fragment/11/position = Vector2( 360, 440 ) nodes/fragment/connections = PoolIntArray( 3, 0, 0, 0, 4, 0, 5, 0, 5, 0, 6, 0, 6, 0, 3, 0, 7, 0, 5, 1, 8, 0, 6, 1 ) -[sub_resource type="ShaderMaterial" id=12] -shader = SubResource( 7 ) -shader_param/scale = Vector3( 1, 1, 1 ) -shader_param/offset = Vector3( 0.75, 0.75, 0 ) +[sub_resource type="ShaderMaterial" id=10] +shader = SubResource( 9 ) +shader_param/scale = Vector3( 0.25, 0.25, 1 ) +shader_param/offset = Vector3( 0, 0, 0 ) [node name="Piece" type="Node2D"] script = ExtResource( 1 ) [node name="ColorRect" type="ColorRect" parent="."] -material = SubResource( 12 ) +material = SubResource( 10 ) anchor_right = 1.0 anchor_bottom = 1.0 margin_right = 64.0 diff --git a/game/src/Taquin.tscn b/game/src/Taquin.tscn index 3e20a5b..5d8753f 100644 --- a/game/src/Taquin.tscn +++ b/game/src/Taquin.tscn @@ -1,7 +1,22 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://src/Taquin.gd" type="Script" id=1] +[sub_resource type="Animation" id=1] +resource_name = "MovingPiece" +tracks/0/type = "value" +tracks/0/path = NodePath("AnimationPlayer/MockPiece:rect_position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 176, 338 ), Vector2( 338, 338 ) ] +} + [node name="Taquin" type="Node2D"] script = ExtResource( 1 ) rows = 3 @@ -12,3 +27,14 @@ difficulty = 0 margin_right = 512.0 margin_bottom = 512.0 color = Color( 0.254902, 0.329412, 0.45098, 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/MovingPiece = SubResource( 1 ) + +[node name="MockPiece" type="ColorRect" parent="AnimationPlayer"] +visible = false +margin_left = 176.0 +margin_top = 338.0 +margin_right = 336.001 +margin_bottom = 498.0 +color = Color( 0.345098, 0.980392, 0.113725, 1 )