-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.gd
36 lines (30 loc) · 1011 Bytes
/
game.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
extends Node2D
@onready var bc: OptionButton = $BC
@onready var ab: OptionButton = $AB
@onready var sk: OptionButton = $SK
@onready var mb: OptionButton = $MB
@onready var on: OptionButton = $ON
@onready var qc: OptionButton = $QC
@onready var nl: OptionButton = $NL
@onready var nt: OptionButton = $NT
@onready var ns: OptionButton = $NS
@onready var nu: OptionButton = $NU
@onready var pe: OptionButton = $PE
@onready var yt: OptionButton = $YT
@onready var nb: OptionButton = $NB
@onready var questions:Array[OptionButton] = [
bc, ab, sk, mb, on, qc, nl, nt, ns, nu, pe, yt, nb]
@onready var total: Label = $Panel/Total
func check_answers()->void:
var score:int = 0
print(questions)
for p:OptionButton in questions:
if p.selected >= 0:
var item_id:int = p.get_item_id(p.selected)
if item_id == 99:
score += 1
total.text = "You have " + str(score) + " out of 13 correct"
total.visible = true
func _on_check_pressed() -> void:
check_answers()
pass # Replace with function body.