This commit is contained in:
Booklordofthedings 2024-08-17 12:55:16 +02:00
parent e3fde1b50f
commit 0344b7215c
3 changed files with 36 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://vtwswrkfkgas"]
[ext_resource type="Script" path="res://scripts/enemy_movement_mover.gd" id="1_7kapi"]
[ext_resource type="Texture2D" uid="uid://buqgl7x10et1f" path="res://temp_assets/img.png" id="1_ci3x0"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_duogd"]
radius = 16.0
height = 32.0
[node name="EnemyMover" type="CharacterBody2D"]
script = ExtResource("1_7kapi")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_ci3x0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CapsuleShape2D_duogd")

View 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()