Hello all. When the Playdate was announced, the concept and the growing community inspired me to make something, even though I'd never coded before.
After six months of work (you read that right), I had an animated player sprite that could walk back and forth between two rooms, and a dialogue system that barely worked. Exciting! Another year or two, and who knows - maybe I'd have three rooms!
I spent an enormous amount of time and effort producing something that an amateur could have made in a day. In spite of the community's positivity and assistance, I was deeply discouraged. I dropped the project.
Fast forward one year. My physical Playdate arrives. Against my better judgement, I dredge up that old project. It would be cool to see it on the little screen, at least.
But disaster has struck again! When I try to compile and run it now, the Simulator gives me this error message:
CoreLibs/sprites.lua:44 bad argument #1 to 'newfunc' (image or tilemap)
stack traceback:
[C]: in upvalue 'newfunc'
CoreLibs/sprites.lua:44 in field 'new'
player.lua:11: in function 'createPlayer'
player.lua:34: in main chunk
stack traceback:
[C]: in function 'import'
main.lua:9: in main chunk
Here is some of the relevant code from player.lua. The 11th line is "Player = gfx.sprite.new(mp)"
function createPlayer()
local mp = gfx.imagetable.new('images/templatev2')
Player = gfx.sprite.new(mp)
Player:setImage(mp:getImage(DOWN))
Player:setCollideRect(0,20, 21, 36)
Player:moveTo(190, 180)
Player:add()
function Player:collisionResponse(other)
if other:isa(door) or other:isa(door2) then
return "overlap"
else
return "slide"
end
end
end
To troubleshoot, I used a static image for the Player instead. I got rid of the image table and any code that referenced it, and the game compiled and ran correctly.
I'm extremely confused, because last year, I didn't have this problem, and I haven't changed the code at all. Can you no longer use an imagetable in gfx.sprite.new(image)?
It's worth noting that I have since built a new PC. I reinstalled and reconfigured the Playdate SDK and Visual Studio (I write in Lua).