Luna Brovchuk 2023-10-01 17:12:48 +02:00
commit 36dd21975c
7 changed files with 104 additions and 2 deletions

View File

@ -0,0 +1,14 @@
extends EnemyClass
onready var player = $"../../Player"
var velocity = Vector2.ZERO
var speed = 48
func _ready():
hp = 15
func _process(delta):
$Sprite.flip_h = true if player.global_position.x > self.global_position.x else false
func _physics_process(delta):
global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier)

View File

@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/models/enemies/rat/sprites/rat_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/enemies/rat/Rat.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 3 )
[node name="Rat" type="KinematicBody2D" groups=["enemy", "rat"]]
script = ExtResource( 2 )
[node name="Sprite" type="AnimatedSprite" parent="."]
frames = ExtResource( 1 )
animation = "idle"
playing = true
centered = false
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 12, 6 )
shape = SubResource( 1 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/rat.png-e73e7b6a730462f71668a742e225b538.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/enemies/rat/sprites/rat.png"
dest_files=[ "res://.import/rat.png-e73e7b6a730462f71668a742e225b538.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/rat/sprites/rat.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 28, 11 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 28, 0, 28, 11 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 56, 0, 28, 11 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 84, 0, 28, 11 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "idle",
"speed": 12.0
} ]

View File

@ -48,7 +48,7 @@ tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 0.9 ), "times": PoolRealArray( 0, 2 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 1, "update": 1,
"values": [ true, false ] "values": [ true, false ]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=2] [gd_scene load_steps=22 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1] [ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2] [ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -16,6 +16,7 @@
[ext_resource path="res://src/models/enemies/bat/Bat.tscn" type="PackedScene" id=14] [ext_resource path="res://src/models/enemies/bat/Bat.tscn" type="PackedScene" id=14]
[ext_resource path="res://src/models/enemies/ghost/Ghost.tscn" type="PackedScene" id=15] [ext_resource path="res://src/models/enemies/ghost/Ghost.tscn" type="PackedScene" id=15]
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16] [ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
[ext_resource path="res://src/models/enemies/rat/Rat.tscn" type="PackedScene" id=17]
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 60 ) extents = Vector2( 10, 60 )
@ -88,6 +89,9 @@ position = Vector2( 142, 54 )
[node name="Ghost" parent="View/Enemies" instance=ExtResource( 15 )] [node name="Ghost" parent="View/Enemies" instance=ExtResource( 15 )]
position = Vector2( 509, 100 ) position = Vector2( 509, 100 )
[node name="Rat" parent="View/Enemies" instance=ExtResource( 17 )]
position = Vector2( 93, 72 )
[node name="UIWrapper" type="CanvasLayer" parent="."] [node name="UIWrapper" type="CanvasLayer" parent="."]
layer = 3 layer = 3