dev-base #36
6 changed files with 77 additions and 8 deletions
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 42 KiB |
BIN
Assets/Textures/basic_enemy.png
Normal file
BIN
Assets/Textures/basic_enemy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
34
Assets/Textures/basic_enemy.png.import
Normal file
34
Assets/Textures/basic_enemy.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dx5k5qa1pwbfl"
|
||||||
|
path="res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Textures/basic_enemy.png"
|
||||||
|
dest_files=["res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
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
|
File diff suppressed because one or more lines are too long
19
Scripts/Enemy/EnemyMovement.gd
Normal file
19
Scripts/Enemy/EnemyMovement.gd
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@export var speed = 25
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _physics_process(delta):
|
||||||
|
var sprite = self.get_child(1)
|
||||||
|
self.velocity = Vector2(cos(sprite.get_rotation() - PI / 2), sin(sprite.get_rotation() - PI / 2)).normalized() * speed
|
||||||
|
|
||||||
|
|
||||||
|
if self.move_and_slide():
|
||||||
|
sprite.rotate(PI)
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
func get_input():
|
func get_input():
|
||||||
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down").normalized()
|
||||||
velocity = input_direction * speed
|
return input_direction
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
get_input()
|
self.velocity = get_input() * speed
|
||||||
move_and_slide()
|
self.move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue