Finallized scoring logic and adjusted ball speed.
This commit is contained in:
parent
4eba01e61b
commit
e5dc6dd42a
3 changed files with 48 additions and 4 deletions
|
|
@ -3,6 +3,8 @@ extends CharacterBody2D
|
|||
const SPEED: float = 350.0
|
||||
|
||||
@export var player_id: int
|
||||
@export var score_label: Label
|
||||
var score: int = 0
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('up-%d' % player_id):
|
||||
|
|
@ -15,3 +17,9 @@ func _input(event: InputEvent) -> void:
|
|||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
||||
func increment_score():
|
||||
# score one point
|
||||
score += 1
|
||||
# update the UI label
|
||||
score_label.text = '%02d' % score
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue