So it's only been yesterday when I posted my first question, sure hope I won't have to bombard the forum daily. But I've got this very weird problem with absolutely zero clue about what went wrong, since this code worked perfectly yesterday, and I only altered it a bit in absolutely different part!
So here I am setting up the UI icons:
local map local tower1ghost local tower2ghost local tower3ghost function scene:create( event ) local sceneGroup = self.view local mapData = json.decodeFile(system.pathForFile("tiles/map1.json", system.ResourceDirectory)) map = tiled.new(mapData, "tiles") local background = display.newImageRect(sceneGroup, "bg_menu.png", 800, 1400) local tower1icon = display.newImageRect(uiLayer, objectSheet, 1, 40, 40) tower1icon.x = 25 tower1icon.y = 480 tower1ghost = display.newImageRect(uiLayer, objectSheet, 1, 40, 40) tower1ghost.alpha = 0.5 tower1ghost.num = 1 tower1ghost:addEventListener("touch", dragGhost)
And so it goes for every tower icon and 'ghost', nothing too complicated. Again, the code worked perfectly yesterday. But today, as I run it, i get:
game.lua:117: attempt to index upvalue 'tower1icon' (a nil value)
Sooo... It's okay when I slap an image on this object, but I can't set it's coordinates? I have zero clue about what's going on: everything seems to be fine with the scope and the variable has been declared. The only thing I did today is implemented PonyTiled, but even when I comment out it's code, nothing works anyway! Any ideas or at least clues?