Fixed enemy movement
This commit is contained in:
parent
84d09120b2
commit
e325412c84
BIN
assets/graphics/effects/02.png
Normal file
BIN
assets/graphics/effects/02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
40
assets/graphics/effects/02.png.import
Normal file
40
assets/graphics/effects/02.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bwubigf4fgyo8"
|
||||||
|
path="res://.godot/imported/02.png-89cf67da19c7359965ab5dceddda9fc3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/graphics/effects/02.png"
|
||||||
|
dest_files=["res://.godot/imported/02.png-89cf67da19c7359965ab5dceddda9fc3.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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,10 +1,10 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://cyy6jr7mxu0jl"]
|
[gd_scene load_steps=4 format=3 uid="uid://cyy6jr7mxu0jl"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cb874g2gkrukb" path="res://scripts/bullet.gd" id="1_mkf8s"]
|
[ext_resource type="Script" uid="uid://cb874g2gkrukb" path="res://scripts/bullet.gd" id="1_mkf8s"]
|
||||||
[ext_resource type="Texture2D" uid="uid://rejfd2gqjk7w" path="res://assets/graphics/effects/14.png" id="2_y25gk"]
|
[ext_resource type="Texture2D" uid="uid://bwubigf4fgyo8" path="res://assets/graphics/effects/02.png" id="2_y25gk"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_h1aey"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_h1aey"]
|
||||||
size = Vector2(16, 20)
|
size = Vector2(4, 2)
|
||||||
|
|
||||||
[node name="Bullet" type="Area2D"]
|
[node name="Bullet" type="Area2D"]
|
||||||
z_index = 100
|
z_index = 100
|
||||||
@ -13,9 +13,7 @@ collision_mask = 22
|
|||||||
script = ExtResource("1_mkf8s")
|
script = ExtResource("1_mkf8s")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(-1, 0)
|
|
||||||
shape = SubResource("RectangleShape2D_h1aey")
|
shape = SubResource("RectangleShape2D_h1aey")
|
||||||
debug_color = Color(1, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
scale = Vector2(0.1, 0.1)
|
scale = Vector2(0.1, 0.1)
|
||||||
|
|||||||
@ -46,6 +46,7 @@ size = Vector2(14, 15)
|
|||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 15
|
collision_mask = 15
|
||||||
script = ExtResource("1_4oill")
|
script = ExtResource("1_4oill")
|
||||||
|
speed = 100
|
||||||
|
|
||||||
[node name="SlimeSprite" type="AnimatedSprite2D" parent="."]
|
[node name="SlimeSprite" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_negjt")
|
sprite_frames = SubResource("SpriteFrames_negjt")
|
||||||
@ -58,23 +59,21 @@ position = Vector2(0, 4.5)
|
|||||||
shape = SubResource("RectangleShape2D_02r3y")
|
shape = SubResource("RectangleShape2D_02r3y")
|
||||||
|
|
||||||
[node name="RightCast" type="RayCast2D" parent="."]
|
[node name="RightCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2(1, 0)
|
target_position = Vector2(7, 0)
|
||||||
target_position = Vector2(20, 0)
|
collision_mask = 2
|
||||||
collision_mask = 3
|
|
||||||
|
|
||||||
[node name="LeftCast" type="RayCast2D" parent="."]
|
[node name="LeftCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2(1, 0)
|
target_position = Vector2(-7, 0)
|
||||||
target_position = Vector2(-20, 0)
|
collision_mask = 2
|
||||||
collision_mask = 3
|
|
||||||
|
|
||||||
[node name="RightDownCast" type="RayCast2D" parent="."]
|
[node name="RightDownCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2(8, 0)
|
position = Vector2(7, 0)
|
||||||
target_position = Vector2(0, 20)
|
target_position = Vector2(0, 20)
|
||||||
collision_mask = 3
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="LeftDownCast" type="RayCast2D" parent="."]
|
[node name="LeftDownCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2(-6, 0)
|
position = Vector2(-7, 0)
|
||||||
target_position = Vector2(0, 20)
|
target_position = Vector2(0, 20)
|
||||||
collision_mask = 3
|
collision_mask = 2
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
|||||||
@ -25,7 +25,7 @@ var current_level = 0
|
|||||||
# Save/load
|
# Save/load
|
||||||
var stash_data : Dictionary = {}
|
var stash_data : Dictionary = {}
|
||||||
# Timers
|
# Timers
|
||||||
var timers = [10, 15, 20]
|
var timers = [30, 30, 30]
|
||||||
var time_available : int = 0
|
var time_available : int = 0
|
||||||
var timer = Timer.new()
|
var timer = Timer.new()
|
||||||
# Characters
|
# Characters
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
class_name Slimer
|
class_name Slimer
|
||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
|
signal player_slimed(body, slime)
|
||||||
|
|
||||||
|
@export var speed : int = 50
|
||||||
|
|
||||||
|
var direction : int = 1
|
||||||
|
|
||||||
@onready var right_cast: RayCast2D = $RightCast
|
@onready var right_cast: RayCast2D = $RightCast
|
||||||
@onready var left_cast: RayCast2D = $LeftCast
|
@onready var left_cast: RayCast2D = $LeftCast
|
||||||
@onready var right_down_cast: RayCast2D = $RightDownCast
|
@onready var right_down_cast: RayCast2D = $RightDownCast
|
||||||
@onready var left_down_cast: RayCast2D = $LeftDownCast
|
@onready var left_down_cast: RayCast2D = $LeftDownCast
|
||||||
@onready var slime_sprite: AnimatedSprite2D = $SlimeSprite
|
@onready var slime_sprite: AnimatedSprite2D = $SlimeSprite
|
||||||
|
|
||||||
var speed : int = 25
|
|
||||||
var direction : int = 1
|
|
||||||
|
|
||||||
signal player_slimed(body, slime)
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if not right_down_cast.is_colliding():
|
if not right_down_cast.is_colliding() or right_cast.is_colliding():
|
||||||
direction = -1
|
direction = -1
|
||||||
slime_sprite.flip_h = true
|
slime_sprite.flip_h = true
|
||||||
#if not left_down_cast.is_colliding():
|
elif not left_down_cast.is_colliding() or left_cast.is_colliding():
|
||||||
#direction = 1
|
direction = 1
|
||||||
#slime_sprite.flip_h = false
|
slime_sprite.flip_h = false
|
||||||
#if not right_cast.is_colliding():
|
|
||||||
#direction = -1
|
#direction = -1
|
||||||
#slime_sprite.flip_h = true
|
#slime_sprite.flip_h = true
|
||||||
#if not left_cast.is_colliding():
|
#if not left_cast.is_colliding():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user