From f4c0645b74e85607e18c58f77cc7bbd1a4931123 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 31 Jan 2021 13:34:11 +0100 Subject: Small adjustments --- Characters/Character.gd | 6 +++--- Characters/Character.tscn | 20 ++++++++++---------- Characters/Tux.tscn | 30 +++++++++++++++--------------- CheckFall.gd | 5 ----- Levels/Level.gd | 3 +-- Objects/CheckFall.gd | 5 +++++ Objects/CheckFall.tscn | 2 +- 7 files changed, 35 insertions(+), 36 deletions(-) delete mode 100644 CheckFall.gd create mode 100644 Objects/CheckFall.gd diff --git a/Characters/Character.gd b/Characters/Character.gd index 966d69d..e5623b1 100644 --- a/Characters/Character.gd +++ b/Characters/Character.gd @@ -35,6 +35,9 @@ func _physics_process(_delta): $Sprite.play("idle") + velocity = move_and_slide(velocity, Vector2.UP) + + # jump and fall animation if not is_on_floor(): $Sprite.play("jump") @@ -83,9 +86,6 @@ func _physics_process(_delta): $Sprite.flip_h = true - velocity = move_and_slide(velocity, Vector2.UP) - - # stop velocity.x = lerp(velocity.x, 0, 0.7) diff --git a/Characters/Character.tscn b/Characters/Character.tscn index a444463..5b94efc 100644 --- a/Characters/Character.tscn +++ b/Characters/Character.tscn @@ -14,6 +14,11 @@ [sub_resource type="SpriteFrames" id=1] animations = [ { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { "frames": [ ExtResource( 8 ) ], "loop": true, "name": "slide", @@ -24,16 +29,6 @@ animations = [ { "name": "back", "speed": 5.0 }, { -"frames": [ ExtResource( 2 ) ], -"loop": true, -"name": "idle", -"speed": 5.0 -}, { -"frames": [ ExtResource( 7 ) ], -"loop": true, -"name": "jump", -"speed": 5.0 -}, { "frames": [ ExtResource( 5 ), ExtResource( 6 ) ], "loop": true, "name": "walk", @@ -54,6 +49,11 @@ animations = [ { "name": "fall_stop", "speed": 5.0 }, { +"frames": [ ExtResource( 7 ) ], +"loop": true, +"name": "jump", +"speed": 5.0 +}, { "frames": [ ExtResource( 3 ) ], "loop": true, "name": "wall", diff --git a/Characters/Tux.tscn b/Characters/Tux.tscn index aaffa33..b3f110a 100644 --- a/Characters/Tux.tscn +++ b/Characters/Tux.tscn @@ -14,14 +14,14 @@ [sub_resource type="SpriteFrames" id=1] animations = [ { -"frames": [ ExtResource( 4 ) ], +"frames": [ ExtResource( 2 ) ], "loop": true, -"name": "back", +"name": "idle", "speed": 5.0 }, { -"frames": [ ExtResource( 2 ) ], +"frames": [ ExtResource( 4 ) ], "loop": true, -"name": "idle", +"name": "back", "speed": 5.0 }, { "frames": [ ExtResource( 7 ) ], @@ -29,14 +29,19 @@ animations = [ { "name": "jump", "speed": 5.0 }, { +"frames": [ ExtResource( 10 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { "frames": [ ExtResource( 5 ), ExtResource( 6 ) ], "loop": true, "name": "walk", "speed": 5.0 }, { -"frames": [ ExtResource( 11 ) ], +"frames": [ ExtResource( 9 ) ], "loop": true, -"name": "fall_stop_landing", +"name": "fall", "speed": 5.0 }, { "frames": [ ExtResource( 8 ) ], @@ -44,19 +49,14 @@ animations = [ { "name": "run", "speed": 5.0 }, { -"frames": [ ExtResource( 9 ) ], +"frames": [ ExtResource( 3 ) ], "loop": true, -"name": "fall", -"speed": 5.0 -}, { -"frames": [ ExtResource( 10 ) ], -"loop": false, -"name": "fall_stop", +"name": "wall", "speed": 5.0 }, { -"frames": [ ExtResource( 3 ) ], +"frames": [ ExtResource( 11 ) ], "loop": true, -"name": "wall", +"name": "fall_stop_landing", "speed": 5.0 } ] diff --git a/CheckFall.gd b/CheckFall.gd deleted file mode 100644 index ff28fc0..0000000 --- a/CheckFall.gd +++ /dev/null @@ -1,5 +0,0 @@ -extends Area2D - - -func _on_CheckFall_body_entered(body): - get_parent().respawn_player() diff --git a/Levels/Level.gd b/Levels/Level.gd index 34463b6..7544dd9 100644 --- a/Levels/Level.gd +++ b/Levels/Level.gd @@ -2,10 +2,9 @@ extends Node2D var idx = 0 +var timer = 0 var HUD = CanvasLayer.new() - -var timer = 0 var LabelTimer = preload("res://UI/HUD/Timer.tscn").instance() var LevelMap = preload("res://UI/HUD/LevelMap.tscn").instance() diff --git a/Objects/CheckFall.gd b/Objects/CheckFall.gd new file mode 100644 index 0000000..ff28fc0 --- /dev/null +++ b/Objects/CheckFall.gd @@ -0,0 +1,5 @@ +extends Area2D + + +func _on_CheckFall_body_entered(body): + get_parent().respawn_player() diff --git a/Objects/CheckFall.tscn b/Objects/CheckFall.tscn index 58da76e..526c2e3 100644 --- a/Objects/CheckFall.tscn +++ b/Objects/CheckFall.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://CheckFall.gd" type="Script" id=1] +[ext_resource path="res://Objects/CheckFall.gd" type="Script" id=1] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 384, 10 ) -- cgit v1.2.3