From 4a63bf546778b3513a5c09c6ece16f608699d267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sat, 14 Jan 2023 22:11:39 +0200 Subject: [PATCH] Lengthen the snake when it eats a fruit --- mato8.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mato8.asm b/mato8.asm index 28b5cc7..3587355 100644 --- a/mato8.asm +++ b/mato8.asm @@ -156,7 +156,7 @@ move_snake: ld i, single_pixel drw head_x_reg, head_y_reg, 1 se vf, 0 - call collision + jp collision drw tail_x_reg, tail_y_reg, 1 ; Load the direction the snake was moving at tail's location @@ -257,7 +257,8 @@ collision: jp tail_collision eat_fruit: - ; TODO: Lenghten snake + ; Jumping to collision skips tail moving code, so we get the snake + ; lengthening for free ld v0, 1 ld st, v0