added a basic ball that properly inverts velocity when colliding with a world boundary. my balls are getting stuck on each other tho

This commit is contained in:
2024-07-23 18:22:05 +02:00
parent 95fe8fbeff
commit 6b0843a725
11 changed files with 255 additions and 10 deletions
+17
View File
@@ -0,0 +1,17 @@
extends CharacterBody2D
@export var speed: float = 5
const _speed_mult: float = 200
var _direction: Vector2 = Vector2(1.0, 0.5)
func _physics_process(delta):
velocity.x = speed * _speed_mult * _direction.x
velocity.y = speed * _speed_mult * _direction.y
move_and_slide()
func invert_x():
_direction.x *= -1
func invert_y():
_direction.y *= -1