[EDIT] implemented animation
This commit is contained in:
parent
123f88e38d
commit
787d20463e
BIN
Assets/spriteset test.png
Normal file
BIN
Assets/spriteset test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
34
Assets/spriteset test.png.import
Normal file
34
Assets/spriteset test.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/spriteset test.png-0553e234092c6eb7487a24328c16a2f4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/spriteset test.png"
|
||||
dest_files=[ "res://.import/spriteset test.png-0553e234092c6eb7487a24328c16a2f4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
@ -1,17 +1,237 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=26 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Placeholder.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Assets/spriteset test.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Scripts/Player.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16.1674, 5.57349 )
|
||||
extents = Vector2( 15.5015, 46.849 )
|
||||
|
||||
[sub_resource type="Animation" id=6]
|
||||
resource_name = "IdleDown"
|
||||
length = 0.1
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 7 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=7]
|
||||
resource_name = "IdleLeft"
|
||||
length = 0.1
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 14 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=8]
|
||||
resource_name = "IdleRight"
|
||||
length = 0.1
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=9]
|
||||
resource_name = "IdleTop"
|
||||
length = 0.1
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 21 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "RunDown"
|
||||
length = 0.7
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 8, 9, 10, 11, 12, 13, 7 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "RunLeft"
|
||||
length = 0.7
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 15, 16, 17, 18, 19, 20, 14 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "RunRight"
|
||||
length = 0.7
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 1, 2, 3, 4, 5, 6, 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
resource_name = "RunUp"
|
||||
length = 0.7
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 22, 23, 24, 25, 26, 27, 21 ]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=10]
|
||||
animation = "IdleLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=11]
|
||||
animation = "IdleDown"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=12]
|
||||
animation = "IdleRight"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=13]
|
||||
animation = "IdleTop"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace2D" id=14]
|
||||
blend_point_0/node = SubResource( 10 )
|
||||
blend_point_0/pos = Vector2( -1.1, 0 )
|
||||
blend_point_1/node = SubResource( 11 )
|
||||
blend_point_1/pos = Vector2( 0, 1.1 )
|
||||
blend_point_2/node = SubResource( 12 )
|
||||
blend_point_2/pos = Vector2( 1, 0 )
|
||||
blend_point_3/node = SubResource( 13 )
|
||||
blend_point_3/pos = Vector2( 0, -1 )
|
||||
min_space = Vector2( -1.1, -1 )
|
||||
max_space = Vector2( 1, 1.1 )
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=15]
|
||||
animation = "RunLeft"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=16]
|
||||
animation = "RunDown"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=17]
|
||||
animation = "RunRight"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id=18]
|
||||
animation = "RunUp"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace2D" id=19]
|
||||
blend_point_0/node = SubResource( 15 )
|
||||
blend_point_0/pos = Vector2( -1.1, 0 )
|
||||
blend_point_1/node = SubResource( 16 )
|
||||
blend_point_1/pos = Vector2( 0, 1.1 )
|
||||
blend_point_2/node = SubResource( 17 )
|
||||
blend_point_2/pos = Vector2( 1, 0 )
|
||||
blend_point_3/node = SubResource( 18 )
|
||||
blend_point_3/pos = Vector2( 0, -1 )
|
||||
min_space = Vector2( -1.1, -1 )
|
||||
max_space = Vector2( 1, 1.1 )
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=20]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=21]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=22]
|
||||
states/Idle/node = SubResource( 14 )
|
||||
states/Idle/position = Vector2( 408, 64 )
|
||||
states/Run/node = SubResource( 19 )
|
||||
states/Run/position = Vector2( 632, 64 )
|
||||
transitions = [ "Idle", "Run", SubResource( 20 ), "Run", "Idle", SubResource( 21 ) ]
|
||||
start_node = "Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachinePlayback" id=23]
|
||||
|
||||
[node name="KinematicBody2D" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 28
|
||||
frame = 9
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 0, 10.3147 )
|
||||
position = Vector2( -0.681107, -0.583321 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/IdleDown = SubResource( 6 )
|
||||
anims/IdleLeft = SubResource( 7 )
|
||||
anims/IdleRight = SubResource( 8 )
|
||||
anims/IdleTop = SubResource( 9 )
|
||||
anims/RunDown = SubResource( 2 )
|
||||
anims/RunLeft = SubResource( 3 )
|
||||
anims/RunRight = SubResource( 4 )
|
||||
anims/RunUp = SubResource( 5 )
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||
tree_root = SubResource( 22 )
|
||||
anim_player = NodePath("../AnimationPlayer")
|
||||
active = true
|
||||
parameters/playback = SubResource( 23 )
|
||||
parameters/Idle/blend_position = Vector2( -1.1, 0.0314158 )
|
||||
parameters/Run/blend_position = Vector2( -0.0925897, 0.517895 )
|
||||
|
@ -25,35 +25,35 @@ texture = ExtResource( 2 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Player2" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 221.278, 126.847 )
|
||||
position = Vector2( 221.278, 126.45 )
|
||||
|
||||
[node name="Clopinette" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 90.0584, 291.46 )
|
||||
position = Vector2( 96.6926, 271.557 )
|
||||
scriptName = "res://Scripts/PaintEffects/Invisibility.gd"
|
||||
|
||||
[node name="Clopinette2" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 354.897, 298.002 )
|
||||
position = Vector2( 305.804, 276.773 )
|
||||
scriptName = "res://Scripts/PaintEffects/Upscale.gd"
|
||||
|
||||
[node name="Clopinette3" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 589.812, 295.726 )
|
||||
position = Vector2( 580.834, 292.621 )
|
||||
scriptName = "res://Scripts/PaintEffects/Downscale.gd"
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = 60.8618
|
||||
margin_top = 252.548
|
||||
margin_right = 128.862
|
||||
margin_bottom = 266.548
|
||||
margin_left = 67.496
|
||||
margin_top = 232.645
|
||||
margin_right = 135.496
|
||||
margin_bottom = 246.645
|
||||
text = "Invisibilité"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
margin_left = 313.979
|
||||
margin_top = 250.273
|
||||
margin_right = 397.979
|
||||
margin_bottom = 264.273
|
||||
margin_left = 263.559
|
||||
margin_top = 234.351
|
||||
margin_right = 347.559
|
||||
margin_bottom = 248.351
|
||||
text = "Gigantisation"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -10,9 +10,9 @@ var curLife = MAX_LIFE
|
||||
|
||||
var coroutines = []
|
||||
|
||||
#onready var animationPlayer = $AnimationPlayer
|
||||
#onready var animationTree = $AnimationTree
|
||||
#onready var animationState = animationTree.get("parameters/playback")
|
||||
onready var animationPlayer = $AnimationPlayer
|
||||
onready var animationTree = $AnimationTree
|
||||
onready var animationState = animationTree.get("parameters/playback")
|
||||
|
||||
func _process(delta):
|
||||
updatePaintEffects(delta)
|
||||
@ -34,12 +34,12 @@ func _physics_process(delta):
|
||||
input_vector = input_vector.normalized()
|
||||
|
||||
if input_vector != Vector2.ZERO:
|
||||
# animationTree.set("parameters/Idle/blend_position", input_vector)
|
||||
# animationTree.set("parameters/Run/blend_position", input_vector)
|
||||
# animationState.travel("Run")
|
||||
animationTree.set("parameters/Idle/blend_position", input_vector)
|
||||
animationTree.set("parameters/Run/blend_position", input_vector)
|
||||
animationState.travel("Run")
|
||||
vel = vel.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
|
||||
else:
|
||||
# animationState.travel("Idle")
|
||||
animationState.travel("Idle")
|
||||
vel = vel.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
|
||||
vel = move_and_slide(vel)
|
||||
|
@ -19,6 +19,61 @@ config/name="Paint Jam 2020"
|
||||
run/main_scene="res://Scene/TestScene.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=320
|
||||
window/size/height=180
|
||||
window/size/test_width=1280
|
||||
window/size/test_height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[importer_defaults]
|
||||
|
||||
texture={
|
||||
"compress/bptc_ldr": 0,
|
||||
"compress/hdr_mode": 0,
|
||||
"compress/lossy_quality": 0.7,
|
||||
"compress/mode": 0,
|
||||
"compress/normal_map": 0,
|
||||
"detect_3d": false,
|
||||
"flags/anisotropic": false,
|
||||
"flags/filter": false,
|
||||
"flags/mipmaps": false,
|
||||
"flags/repeat": 0,
|
||||
"flags/srgb": 2,
|
||||
"process/HDR_as_SRGB": false,
|
||||
"process/fix_alpha_border": true,
|
||||
"process/invert_color": false,
|
||||
"process/premult_alpha": false,
|
||||
"size_limit": 0,
|
||||
"stream": false,
|
||||
"svg/scale": 1.0
|
||||
}
|
||||
|
||||
[input]
|
||||
|
||||
ui_right2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_left2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_up2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_down2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
|
Loading…
x
Reference in New Issue
Block a user