I am new to code and am trying my best but can someone tell me what I might be doing wrong here? I have created a quiz that accumulates points and displays the total in the text field with unique ID “score” on the last scene.
I then want a timeline to play based on what the score value is. Timelines are called:
scoreA, scoreB, scoreC or scoreD
I made a function called playscore but I am still doing something wrong as it is not quite working. Any help would be appreciated. Hype file is also attached.
quizdemo3.hype.zip (71.4 KB)
function playScore(hypeDocument, element, event){
if hypeDocument.getElementById(‘score’) >= 8
hypeDocument.startTimelineNamed(‘scoreA’, hypeDocument.kDirectionForward);
if hypeDocument.getElementById(‘score’) >= 6
hypeDocument.startTimelineNamed(‘scoreB’, hypeDocument.kDirectionForward);
if hypeDocument.getElementById(‘score’) >= 4
hypeDocument.startTimelineNamed(‘scoreC’, hypeDocument.kDirectionForward);
if hypeDocument.getElementById(‘score’) >= 2
hypeDocument.startTimelineNamed(‘scoreD’, hypeDocument.kDirectionForward);
}
I will at some point need to figure out how to reset the timelines as well.