Jacob Mutale
Jacob Mutale

Reputation: 57

pong game godot reset the scene

hello I am currently working on my first game in godot. It is a pong replica with power ups I am currently having difficulty resetting the scene when the score that is specified is reached. This is my code:

if(PlayerSore == 10 || OpponentScore == 10):
    get_tree().paused = true
    if Input.is_action_pressed("ui_reset"):
        get_tree().reload_current_scene() 

this is all happening in the func _process(delta): function.

Upvotes: 0

Views: 283

Answers (1)

Aaron Record
Aaron Record

Reputation: 340

The problem is probably the get_tree().paused = true. If the node that that script is on has its pause_mode set to inherit or stop then _process probably won't be called (see here for more info). I would recommend just deleting that line unless there is a specific reason you need it.

Upvotes: 0

Related Questions