diff options
Diffstat (limited to 'Characters')
-rw-r--r-- | Characters/Character.gd | 99 | ||||
-rw-r--r-- | Characters/Character.tscn | 84 | ||||
-rw-r--r-- | Characters/Dove.gd | 5 | ||||
-rw-r--r-- | Characters/Dove.tscn | 84 | ||||
-rw-r--r-- | Characters/Duck.gd | 5 | ||||
-rw-r--r-- | Characters/Duck.tscn | 84 | ||||
-rw-r--r-- | Characters/Monkey.gd | 5 | ||||
-rw-r--r-- | Characters/Monkey.tscn | 58 | ||||
-rw-r--r-- | Characters/Pidgin.gd | 5 | ||||
-rw-r--r-- | Characters/Pidgin.tscn | 84 | ||||
-rw-r--r-- | Characters/Tux.gd | 5 | ||||
-rw-r--r-- | Characters/Tux.tscn | 84 |
12 files changed, 602 insertions, 0 deletions
diff --git a/Characters/Character.gd b/Characters/Character.gd new file mode 100644 index 0000000..bf16dbf --- /dev/null +++ b/Characters/Character.gd @@ -0,0 +1,99 @@ +extends KinematicBody2D + + +const SPEED = 130 +const JUMPFORCE = -500 +const GRAVITY = 20 + +var velocity = Vector2() +var direction = Enum.DIRECTION.RIGHT + +var canDoubleJump = false +var hasPlayedFallStop = false + + +func _physics_process(_delta): + if Input.is_action_pressed("ui_left"): + velocity.x = -SPEED + direction = Enum.DIRECTION.LEFT + $Sprite.flip_h = true + if self.is_running(): + velocity.x *= 2 + $Sprite.play("run") + else: + $Sprite.play("walk") + elif Input.is_action_pressed("ui_right"): + velocity.x = SPEED + direction = Enum.DIRECTION.RIGHT + $Sprite.flip_h = false + if self.is_running(): + velocity.x *= 2 + $Sprite.play("run") + else: + $Sprite.play("walk") + else: + $Sprite.play("idle") + + + # jump and fall animation + if not is_on_floor(): + $Sprite.play("jump") + if has_node("CheckFallStop"): + if velocity.y > -JUMPFORCE: + $CheckFallLanding.set_enabled(true) + $CheckFallStop.set_enabled(true) + if $CheckFallLanding.is_colliding(): + $Sprite.play("fall_stop_landing") + elif $CheckFallStop.is_colliding(): + $Sprite.play("fall_stop") + else: + $Sprite.play("fall") + else: + $CheckFallLanding.set_enabled(false) + $CheckFallStop.set_enabled(true) + + + # fall down + velocity.y += GRAVITY + + + # jump + if Input.is_action_just_pressed("ui_up"): + if is_on_floor(): + canDoubleJump = true + velocity.y = JUMPFORCE + elif not is_on_floor() and not is_on_wall() and canDoubleJump: + canDoubleJump = false + velocity.y = JUMPFORCE + + + if is_on_wall(): + velocity.y *= 0.8 + $Sprite.play("wall") + + if Input.is_action_just_pressed("ui_up"): + Input.action_release("ui_left") + Input.action_release("ui_right") + velocity.y = JUMPFORCE * 0.75 + if direction == Enum.DIRECTION.LEFT: + velocity.x = 2000 + $Sprite.flip_h = false + elif direction == Enum.DIRECTION.RIGHT: + velocity.x = -2000 + $Sprite.flip_h = true + + + velocity = move_and_slide(velocity, Vector2.UP) + + + # stop + velocity.x = lerp(velocity.x, 0, 0.7) + + +func is_running(): + return Input.is_action_pressed("ui_accept") and is_on_floor() + + +func check_flag(): + # $Sprite.play("dance anim") + print("FLAG CHECKED") diff --git a/Characters/Character.tscn b/Characters/Character.tscn new file mode 100644 index 0000000..a444463 --- /dev/null +++ b/Characters/Character.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://Characters/Character.gd" type="Script" id=1] +[ext_resource path="res://Assets/Characters/Tux/Front.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Tux/Wall.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Tux/Back.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Tux/Walk1.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Tux/Walk2.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Tux/Jump.png" type="Texture" id=7] +[ext_resource path="res://Assets/Characters/Tux/Slide.png" type="Texture" id=8] +[ext_resource path="res://Assets/Characters/Tux/Fall1.png" type="Texture" id=9] +[ext_resource path="res://Assets/Characters/Tux/Fall1Wings.png" type="Texture" id=10] +[ext_resource path="res://Assets/Characters/Tux/Fall2Wings.png" type="Texture" id=11] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 8 ) ], +"loop": true, +"name": "slide", +"speed": 5.0 +}, { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"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", +"speed": 5.0 +}, { +"frames": [ ExtResource( 11 ) ], +"loop": true, +"name": "fall_stop_landing", +"speed": 5.0 +}, { +"frames": [ ExtResource( 9 ) ], +"loop": true, +"name": "fall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 10 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Character" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 1 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="CheckFallStop" type="RayCast2D" parent="."] +enabled = true +cast_to = Vector2( 0, 150 ) + +[node name="CheckFallLanding" type="RayCast2D" parent="."] +enabled = true diff --git a/Characters/Dove.gd b/Characters/Dove.gd new file mode 100644 index 0000000..b7c6d31 --- /dev/null +++ b/Characters/Dove.gd @@ -0,0 +1,5 @@ +extends "res://Characters/Character.gd" + + +func _ready(): + pass diff --git a/Characters/Dove.tscn b/Characters/Dove.tscn new file mode 100644 index 0000000..14f99ce --- /dev/null +++ b/Characters/Dove.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://Assets/Characters/Dove/Front.png" type="Texture" id=1] +[ext_resource path="res://Assets/Characters/Dove/Jump.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Dove/Fall1Wings.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Dove/Slide.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Dove/Walk1.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Dove/Back.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Dove/Fall2.png" type="Texture" id=7] +[ext_resource path="res://Assets/Characters/Dove/Walk2.png" type="Texture" id=8] +[ext_resource path="res://Characters/Dove.gd" type="Script" id=9] +[ext_resource path="res://Assets/Characters/Dove/Wall.png" type="Texture" id=10] +[ext_resource path="res://Assets/Characters/Dove/Fall1.png" type="Texture" id=11] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 6 ) ], +"loop": true, +"name": "back", +"speed": 5.0 +}, { +"frames": [ ExtResource( 1 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "jump", +"speed": 5.0 +}, { +"frames": [ ExtResource( 5 ), ExtResource( 8 ) ], +"loop": true, +"name": "walk", +"speed": 5.0 +}, { +"frames": [ ExtResource( 7 ) ], +"loop": true, +"name": "fall_stop_landing", +"speed": 5.0 +}, { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"name": "run", +"speed": 5.0 +}, { +"frames": [ ExtResource( 11 ) ], +"loop": true, +"name": "fall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { +"frames": [ ExtResource( 10 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Dove" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 9 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="CheckFallStop" type="RayCast2D" parent="."] +enabled = true +cast_to = Vector2( 0, 150 ) + +[node name="CheckFallLanding" type="RayCast2D" parent="."] +enabled = true diff --git a/Characters/Duck.gd b/Characters/Duck.gd new file mode 100644 index 0000000..b7c6d31 --- /dev/null +++ b/Characters/Duck.gd @@ -0,0 +1,5 @@ +extends "res://Characters/Character.gd" + + +func _ready(): + pass diff --git a/Characters/Duck.tscn b/Characters/Duck.tscn new file mode 100644 index 0000000..ef675d6 --- /dev/null +++ b/Characters/Duck.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://Characters/Duck.gd" type="Script" id=1] +[ext_resource path="res://Assets/Characters/Duck/Fall1.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Duck/Slide.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Duck/Back.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Duck/Fall2Wings.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Duck/Wall.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Duck/Jump.png" type="Texture" id=7] +[ext_resource path="res://Assets/Characters/Duck/Walk2.png" type="Texture" id=8] +[ext_resource path="res://Assets/Characters/Duck/Walk1.png" type="Texture" id=9] +[ext_resource path="res://Assets/Characters/Duck/Fall1Wings.png" type="Texture" id=10] +[ext_resource path="res://Assets/Characters/Duck/Front.png" type="Texture" id=11] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"name": "back", +"speed": 5.0 +}, { +"frames": [ ExtResource( 11 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ ExtResource( 7 ) ], +"loop": true, +"name": "jump", +"speed": 5.0 +}, { +"frames": [ ExtResource( 9 ), ExtResource( 8 ) ], +"loop": true, +"name": "walk", +"speed": 5.0 +}, { +"frames": [ ExtResource( 5 ) ], +"loop": true, +"name": "fall_stop_landing", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": true, +"name": "run", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "fall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 10 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Duck" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 1 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="CheckFallStop" type="RayCast2D" parent="."] +enabled = true +cast_to = Vector2( 0, 150 ) + +[node name="CheckFallLanding" type="RayCast2D" parent="."] +enabled = true diff --git a/Characters/Monkey.gd b/Characters/Monkey.gd new file mode 100644 index 0000000..b7c6d31 --- /dev/null +++ b/Characters/Monkey.gd @@ -0,0 +1,5 @@ +extends "res://Characters/Character.gd" + + +func _ready(): + pass diff --git a/Characters/Monkey.tscn b/Characters/Monkey.tscn new file mode 100644 index 0000000..8ed2938 --- /dev/null +++ b/Characters/Monkey.tscn @@ -0,0 +1,58 @@ +[gd_scene load_steps=10 format=2] + +[ext_resource path="res://Characters/Tux.gd" type="Script" id=1] +[ext_resource path="res://Assets/Characters/Monkey/Front.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Monkey/Wall.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Monkey/Jump.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Monkey/Back.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Monkey/Walk1.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Monkey/Walk2.png" type="Texture" id=7] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 5 ) ], +"loop": true, +"name": "back", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ), ExtResource( 7 ) ], +"loop": true, +"name": "walk", +"speed": 5.0 +}, { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"name": "jump", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ), ExtResource( 7 ) ], +"loop": true, +"name": "run", +"speed": 10.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Monkey" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 1 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) diff --git a/Characters/Pidgin.gd b/Characters/Pidgin.gd new file mode 100644 index 0000000..b7c6d31 --- /dev/null +++ b/Characters/Pidgin.gd @@ -0,0 +1,5 @@ +extends "res://Characters/Character.gd" + + +func _ready(): + pass diff --git a/Characters/Pidgin.tscn b/Characters/Pidgin.tscn new file mode 100644 index 0000000..ba42eb0 --- /dev/null +++ b/Characters/Pidgin.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://Assets/Characters/Pidgin/Fall1.png" type="Texture" id=1] +[ext_resource path="res://Assets/Characters/Pidgin/Slide.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Pidgin/Fall2.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Pidgin/Back.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Pidgin/Fall1Wings.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Pidgin/Wall.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Pidgin/Jump.png" type="Texture" id=7] +[ext_resource path="res://Assets/Characters/Pidgin/Walk2.png" type="Texture" id=8] +[ext_resource path="res://Characters/Dove.gd" type="Script" id=9] +[ext_resource path="res://Assets/Characters/Pidgin/Front.png" type="Texture" id=10] +[ext_resource path="res://Assets/Characters/Pidgin/Walk1.png" type="Texture" id=11] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"name": "back", +"speed": 5.0 +}, { +"frames": [ ExtResource( 10 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 5 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": true, +"name": "fall_stop_landing", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "run", +"speed": 5.0 +}, { +"frames": [ ExtResource( 1 ) ], +"loop": true, +"name": "fall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 11 ), ExtResource( 8 ) ], +"loop": true, +"name": "walk", +"speed": 5.0 +}, { +"frames": [ ExtResource( 7 ) ], +"loop": true, +"name": "jump", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Dove" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 9 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="CheckFallStop" type="RayCast2D" parent="."] +enabled = true +cast_to = Vector2( 0, 150 ) + +[node name="CheckFallLanding" type="RayCast2D" parent="."] +enabled = true diff --git a/Characters/Tux.gd b/Characters/Tux.gd new file mode 100644 index 0000000..b7c6d31 --- /dev/null +++ b/Characters/Tux.gd @@ -0,0 +1,5 @@ +extends "res://Characters/Character.gd" + + +func _ready(): + pass diff --git a/Characters/Tux.tscn b/Characters/Tux.tscn new file mode 100644 index 0000000..aaffa33 --- /dev/null +++ b/Characters/Tux.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://Characters/Tux.gd" type="Script" id=1] +[ext_resource path="res://Assets/Characters/Tux/Front.png" type="Texture" id=2] +[ext_resource path="res://Assets/Characters/Tux/Wall.png" type="Texture" id=3] +[ext_resource path="res://Assets/Characters/Tux/Back.png" type="Texture" id=4] +[ext_resource path="res://Assets/Characters/Tux/Walk1.png" type="Texture" id=5] +[ext_resource path="res://Assets/Characters/Tux/Walk2.png" type="Texture" id=6] +[ext_resource path="res://Assets/Characters/Tux/Jump.png" type="Texture" id=7] +[ext_resource path="res://Assets/Characters/Tux/Slide.png" type="Texture" id=8] +[ext_resource path="res://Assets/Characters/Tux/Fall1.png" type="Texture" id=9] +[ext_resource path="res://Assets/Characters/Tux/Fall1Wings.png" type="Texture" id=10] +[ext_resource path="res://Assets/Characters/Tux/Fall2Wings.png" type="Texture" id=11] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 4 ) ], +"loop": true, +"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", +"speed": 5.0 +}, { +"frames": [ ExtResource( 11 ) ], +"loop": true, +"name": "fall_stop_landing", +"speed": 5.0 +}, { +"frames": [ ExtResource( 8 ) ], +"loop": true, +"name": "run", +"speed": 5.0 +}, { +"frames": [ ExtResource( 9 ) ], +"loop": true, +"name": "fall", +"speed": 5.0 +}, { +"frames": [ ExtResource( 10 ) ], +"loop": false, +"name": "fall_stop", +"speed": 5.0 +}, { +"frames": [ ExtResource( 3 ) ], +"loop": true, +"name": "wall", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 9.21901, 11.2317 ) + +[node name="Tux" type="KinematicBody2D"] +collision_mask = 15 +script = ExtResource( 1 ) + +[node name="Sprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.7, 0.7 ) +frames = SubResource( 1 ) +animation = "idle" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 2 ) + +[node name="CheckFallStop" type="RayCast2D" parent="."] +enabled = true +cast_to = Vector2( 0, 150 ) + +[node name="CheckFallLanding" type="RayCast2D" parent="."] +enabled = true |