Skip to content
Snippets Groups Projects
Commit 34726c88 authored by RHECHIM OUALID's avatar RHECHIM OUALID
Browse files

game checks if snake is out of boundaries

parent f17e91f7
Branches
No related merge requests found
......@@ -610,6 +610,12 @@ candyStatus:
sw $v0, candy
sw $v1, candy + 4
updateScore:
lw $a1, scoreJeu
addi $a1, $a1, 1
sw $a1, scoreJeu
j exitU
exitU:
......@@ -631,6 +637,23 @@ conditionFinJeu:
# Aide: Remplacer cette instruction permet d'avancer dans le projet.
li $v0 0
checkOutOfBound:
lw $t1, snakePosX($zero)
lw $t2, snakePosY($zero)
beq $t1, 16, exitFailure
beq $t1, -1, exitFailure
beq $t2, -1, exitFailure
beq $t2, 16, exitFailure
j exitSuccess
exitFailure:
li $v0, 1
j exitFinJeu
exitSuccess:
li $v0, 0
exitFinJeu:
jr $ra
############################### affichageFinJeu ################################
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment