Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Doughnut |
when ever i put anything in the brackets it says “too many arguments for “move_and_slide()” call. expected at most 0 but received 1.”
The code is for a monster that walks left & right until it hits a wall or edge then it turns around. The code i was using is:
extends CharacterBody2D
var speed = 100
var direction = Vector2.LEFT
func _physics_process(float):
var velocity = direction * speed
var collision = move_and_slide(velocity)
if is_on_wall():
direction = -direction
$Sprite.flip_h = not $Sprite.flip_h
if you can’t find a fix, can you give me a work around?
Doughnut | 2023-03-16 14:06