Game issue

Hello! I want to create a maze where the player can get points by gathering loot or losing points when he/she touches lava. If you see in my code below, you will notice that I have placed invisible sprites over the lava tiles, that have the same image. After that I wanted to spread them across the map, everywhere that there is a lava tile, but I am not sure if I did it correctly. There are 15 Lava1 tiles and 10 Lava2 tiles. Also, you can get maximum 33 points from the loot. So, 33-15-10=8. I want to end the game with losing, if the player touches 8 lava tiles in a row, while his/her score is 0. If you try to do it, it does crashes or ends the game if you touch 2-3 lava tiles.