#Line of code crashes game

5 messages · Page 1 of 1 (latest)

prime junco
#

var speed = 600

func _ready():
    randomize()
    velocity.x = [-1,1][randi() % 2]
    velocity.y = [-0.8,0.8][randi() % 2]
    
func _physics_process(delta):
    var collision_object = move_and_collide(velocity * speed * delta)
    if collision_object:
        velocity = velocity.bounce(collision_object.get_normal)```
        
Im following a tutorial on how to make a pong game but for some reason whenever the ball bounces it crashes, can someone please help 🥺
#

oh and also i did modify the script a bit from the tutorial since the comments said there were some things that needed to be changed for godot 4

stiff sequoia
#

collision_object.get_normal()

prime junco
#

thanks it worked

#

[Solved] Line of code crashes game