Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added animal and player animation #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions animal/logic/animal.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends CharacterBody2D

@export_category("Select animal")
@export_enum("boris", "cow", "eagle", "goat", "pig", "wolf")
var animal_type: String = "eagle"


func _process(delta):
$AnimatedSprite2D.play(animal_type)
181 changes: 181 additions & 0 deletions animal/logic/animal.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
[gd_scene load_steps=25 format=3 uid="uid://c1qhe5nhhlm4o"]

[ext_resource type="Texture2D" uid="uid://cuts2whx8udow" path="res://assets/animals/animals3.png" id="1_2etul"]
[ext_resource type="Script" path="res://animal/logic/animal.gd" id="1_vk5pl"]
[ext_resource type="Texture2D" uid="uid://dqfj3ncvy2tsb" path="res://assets/animals/birds2.png" id="2_f3rib"]
[ext_resource type="Texture2D" uid="uid://guix6uchwx5g" path="res://assets/animals/animals1.png" id="3_7sdht"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_pkgbs"]
radius = 12.625
height = 40.0

[sub_resource type="AtlasTexture" id="AtlasTexture_wgd33"]
atlas = ExtResource("1_2etul")
region = Rect2(252, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_dfruc"]
atlas = ExtResource("1_2etul")
region = Rect2(294, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_6snq7"]
atlas = ExtResource("1_2etul")
region = Rect2(336, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_wvfvy"]
atlas = ExtResource("1_2etul")
region = Rect2(84, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_wx2s2"]
atlas = ExtResource("1_2etul")
region = Rect2(0, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_utirk"]
atlas = ExtResource("1_2etul")
region = Rect2(42, 0, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_q7sln"]
atlas = ExtResource("2_f3rib")
region = Rect2(0, 36, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_gxi8u"]
atlas = ExtResource("2_f3rib")
region = Rect2(42, 36, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_pq870"]
atlas = ExtResource("2_f3rib")
region = Rect2(84, 36, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_enegv"]
atlas = ExtResource("1_2etul")
region = Rect2(252, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_rma82"]
atlas = ExtResource("1_2etul")
region = Rect2(294, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_dx4ep"]
atlas = ExtResource("1_2etul")
region = Rect2(336, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_kw0t3"]
atlas = ExtResource("1_2etul")
region = Rect2(0, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_2iegb"]
atlas = ExtResource("1_2etul")
region = Rect2(42, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_odqsp"]
atlas = ExtResource("1_2etul")
region = Rect2(84, 144, 42, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_4kh3h"]
atlas = ExtResource("3_7sdht")
region = Rect2(78, 0, 26, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_pwx0o"]
atlas = ExtResource("3_7sdht")
region = Rect2(104, 0, 26, 36)

[sub_resource type="AtlasTexture" id="AtlasTexture_voqku"]
atlas = ExtResource("3_7sdht")
region = Rect2(130, 0, 26, 36)

[sub_resource type="SpriteFrames" id="SpriteFrames_rxtr0"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_wgd33")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dfruc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6snq7")
}],
"loop": true,
"name": &"boris",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_wvfvy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wx2s2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_utirk")
}],
"loop": true,
"name": &"cow",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_q7sln")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gxi8u")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pq870")
}],
"loop": true,
"name": &"eagle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_enegv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rma82")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dx4ep")
}],
"loop": true,
"name": &"goat",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_kw0t3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2iegb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_odqsp")
}],
"loop": true,
"name": &"pig",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_4kh3h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pwx0o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_voqku")
}],
"loop": true,
"name": &"wolf",
"speed": 5.0
}]

[node name="Animal" type="CharacterBody2D"]
script = ExtResource("1_vk5pl")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -2)
shape = SubResource("CapsuleShape2D_pkgbs")
debug_color = Color(0, 0.6, 0.701961, 0.419608)

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_rxtr0")
animation = &"eagle"
Binary file added assets/animals/animals1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/animals/animals1.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://guix6uchwx5g"
path="res://.godot/imported/animals1.png-3611653d17519d57ce6469421893a31f.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/animals/animals1.png"
dest_files=["res://.godot/imported/animals1.png-3611653d17519d57ce6469421893a31f.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added assets/animals/animals3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/animals/animals3.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cuts2whx8udow"
path="res://.godot/imported/animals3.png-8460b18897b00ce3cac3ebb77bea37cc.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/animals/animals3.png"
dest_files=["res://.godot/imported/animals3.png-8460b18897b00ce3cac3ebb77bea37cc.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added assets/animals/birds2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/animals/birds2.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dqfj3ncvy2tsb"
path="res://.godot/imported/birds2.png-847ec399081de5d9eea6e37da19d50cb.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/animals/birds2.png"
dest_files=["res://.godot/imported/birds2.png-847ec399081de5d9eea6e37da19d50cb.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added assets/player/noah/idle/Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/player/noah/idle/Idle.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dc5no7c7cefce"
path="res://.godot/imported/Idle.png-9224dda04ecff8de0bd57e3949ff7e4e.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/player/noah/idle/Idle.png"
dest_files=["res://.godot/imported/Idle.png-9224dda04ecff8de0bd57e3949ff7e4e.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
1 change: 0 additions & 1 deletion main_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ var score
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

5 changes: 2 additions & 3 deletions main_game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5353,8 +5353,7 @@ volume_db = 5.0
[node name="Player" parent="." instance=ExtResource("5_jwt35")]
position = Vector2(-1, 0)

[node name="Player@PlayerCamera" type="Camera2D" parent="Player"]
[node name="PlayerCamera" type="Camera2D" parent="Player"]
position = Vector2(8, -7)
zoom = Vector2(3, 3)
zoom = Vector2(2.75, 2.75)
position_smoothing_enabled = true
position_smoothing_speed = 12.0
5 changes: 3 additions & 2 deletions player/player.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
extends CharacterBody2D

var speed = 100 # speed in pixels/sec
var direction = 0

func _ready():
$AnimatedSprite2D.play("idle")

func get_input():
velocity = Vector2.ZERO
Expand Down Expand Up @@ -39,4 +40,4 @@ func _process(delta):
$AnimatedSprite2D.flip_v = false

else:
$AnimatedSprite2D.stop()
$AnimatedSprite2D.play("idle")
Loading