enemy animations

main
Just Dzhi 2023-10-01 17:24:46 +04:00
parent 6df4533c28
commit 70aa197568
13 changed files with 148 additions and 19 deletions

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/models/enemies/bat/sprite.png" type="Texture" id=1]
[ext_resource path="res://src/models/enemies/bat/sprites/bat_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/bat/bat.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 3 )
extents = Vector2( 3.5, 3 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 6, 4 )
@ -14,17 +14,20 @@ collision_layer = 2
collision_mask = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
[node name="Sprite" type="AnimatedSprite" parent="."]
use_parent_material = true
texture = ExtResource( 1 )
frames = ExtResource( 1 )
animation = "idle"
frame = 3
playing = true
centered = false
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 7, 4 )
position = Vector2( 8.5, 10 )
shape = SubResource( 1 )
[node name="SameSpeciesCollider" type="CollisionShape2D" parent="."]
position = Vector2( 7, 4 )
position = Vector2( 8.5, 10 )
shape = SubResource( 2 )

View File

@ -25,5 +25,7 @@ func _physics_process(_delta):
velocity.x = cos(angle + 180)
velocity.y = sin(angle + 180)
self.global_position.y += sin(Time.get_ticks_msec() * 0.01) / 3
velocity *= speed * speed_multiplier
velocity = move_and_slide(velocity)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

View File

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/sprite.png-742176af9ae55b1874092f535d7f098a.stex"
path="res://.import/bat.png-fb52342f0135bec2219869dda59a68bd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/enemies/bat/sprite.png"
dest_files=[ "res://.import/sprite.png-742176af9ae55b1874092f535d7f098a.stex" ]
source_file="res://src/models/enemies/bat/sprites/bat.png"
dest_files=[ "res://.import/bat.png-fb52342f0135bec2219869dda59a68bd.stex" ]
[params]

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://src/models/enemies/bat/sprites/bat.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 20, 20 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 20, 0, 20, 20 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 40, 0, 20, 20 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 60, 0, 20, 20 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "idle",
"speed": 12.0
} ]

View File

@ -1,22 +1,24 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/models/enemies/ghost/sprites/ghost.png" type="Texture" id=1]
[ext_resource path="res://src/models/enemies/ghost/sprites/ghost_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/ghost/ghost.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 9 )
extents = Vector2( 5.5, 5.5 )
[node name="Ghost" type="KinematicBody2D" groups=["enemy"]]
z_index = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
[node name="Sprite" type="AnimatedSprite" parent="."]
use_parent_material = true
texture = ExtResource( 1 )
frames = ExtResource( 1 )
animation = "idle"
playing = true
centered = false
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 7, 9 )
position = Vector2( 8.5, 13.5 )
shape = SubResource( 1 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 535 B

View File

@ -0,0 +1,31 @@
[gd_resource type="SpriteFrames" load_steps=7 format=2]
[ext_resource path="res://src/models/enemies/ghost/sprites/ghost.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 18, 22 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 18, 0, 18, 22 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 36, 0, 18, 22 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 54, 0, 18, 22 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 1 )
region = Rect2( 72, 0, 18, 22 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "idle",
"speed": 12.0
} ]

View File

@ -1,21 +1,23 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can.png" type="Texture" id=1]
[ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/trash_can/trash_can.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 6, 7 )
extents = Vector2( 5.5, 7 )
[node name="TrashCan" type="KinematicBody2D"]
z_index = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
[node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 3, 0 )
texture = ExtResource( 1 )
frames = ExtResource( 1 )
animation = "rolling"
playing = true
[node name="EnemyCollider" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyCollider"]
position = Vector2( 3, 0 )
position = Vector2( 3.5, 5 )
shape = SubResource( 1 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/rolling.png-40d73114e6eb4a8c6a697e781597c9da.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/enemies/trash_can/sprites/rolling.png"
dest_files=[ "res://.import/rolling.png-40d73114e6eb4a8c6a697e781597c9da.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://src/models/enemies/trash_can/sprites/rolling.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 22, 24 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 22, 0, 22, 24 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 44, 0, 22, 24 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 66, 0, 22, 24 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "rolling",
"speed": 16.0
} ]