Just Dzhi 2023-10-01 18:47:42 +04:00
parent 4fabc43041
commit b2bed34467
5 changed files with 19 additions and 6 deletions

View File

@ -15,5 +15,5 @@ void fragment(){
[resource] [resource]
shader = SubResource( 3 ) shader = SubResource( 3 )
shader_param/active = false shader_param/active = true
shader_param/color = Color( 1, 1, 1, 1 ) shader_param/color = Color( 1, 1, 1, 0 )

View File

@ -1,2 +1,11 @@
extends KinematicBody2D extends EnemyClass
onready var player = $"../../Player"
var velocity = Vector2.ZERO
var speed = 48
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

@ -6,7 +6,7 @@
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 3 ) extents = Vector2( 8, 3 )
[node name="Rat" type="KinematicBody2D" groups=["enemy"]] [node name="Rat" type="KinematicBody2D" groups=["enemy", "rat"]]
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="Sprite" type="AnimatedSprite" parent="."] [node name="Sprite" type="AnimatedSprite" parent="."]

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