Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PICO-8: Top-Down Adventure Game Tutorial

A beginner-level tutorial for making a top-down adventure game in PICO-8. · By MBoffin (Dylan Bennett)

episode 8 runtime error line 10 tab 4, pls help

A topic by Lukasnob created Jun 30, 2022 Views: 192 Replies: 2
Viewing posts 1 to 2

unswap_tile(x,y)

attempt to index local  ´x´  (a number value)

My code:

--animation code

function toggle_tiles()

 for x=mapx,mapx+15 do

  for y=mapy,mapy+15 do

   if (is_tile(anim1,x,y)) then

    swap_tile(x,y)

    sfx(3)

   elseif (is_tile(anim2,x,y)) then

    unswap_tile(x.y)

    sfx(3)

   end

  end

 end

end


Unswap code:

function unswap_tile(x,y)

 tile=mget(x,y)

 mset(x,y,tile-1)

end

Developer (1 edit)

One tiny typo might be the cause! It looks like right under the elseif, you have unswap_tile(x.y) instead of unswap_tile(x,y) (period instead of a comma). See if that helps fix things. If not, let me know.

(+1)

it was the problem thank you very much, would never have noticed it by myself. great tutorial btw