movement
This commit is contained in:
parent
e3fde1b50f
commit
0344b7215c
3 changed files with 36 additions and 1 deletions
14
gmtk_2024/scripts/enemy_movement_mover.gd
Normal file
14
gmtk_2024/scripts/enemy_movement_mover.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 200;
|
||||
@export var gravity = 50;
|
||||
|
||||
var direction = 1;
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_on_wall():
|
||||
direction = direction * -1
|
||||
velocity.x = direction * speed
|
||||
velocity.y += gravity
|
||||
move_and_slide()
|
Loading…
Add table
Add a link
Reference in a new issue