Log In  


Hi i downloaded all the Pico-8 Zines to follow but the first code i gotta type is giving me an error at line 16.
I typed it exactly as it is written in the Zine i believe but i get this:
SYNTAX ERROR LINE 16
MOVEPADDLE()
<EOF> EXPECTED NEAR 'END'

What does that mean?

Here is my code:
--paddle
padx=52
pady=122
padw=24
padh=4

function movepaddle()
if btn (0) then
padx-=3
elseif btn(1) then
padx+=3
end
end

function_update()
movepaddle()
end

function_draw()
--clear the screen
rectfill (0,0,128,128,3)

--draw the paddle
rectfill (padx,pady,padx+padw,pady+padh,15)
end

Thanks!



1

function _update()
function _draw()

notice the spaces^^ :)


Oh! Wow, you are a genius! Thanks. :)


Hmm, got further but this is tough to do.. Never fiddled with Lua.

I'm at the SCORE part, error at line 28, trying to call nill value..

--ball
ballx=64
bally=64
ballsize=3
ballxdir=5
ballydir=-3

--paddle
padx=52
pady=122
padw=24
padh=4

score=0

function movepaddle()
if btn (0) then
padx-=3
elseif btn(1) then
padx+=3
end
end

function _update()
movepaddle()
bounceball()
bouncepaddle()
moveball()
losedeadball()
end

function _moveball()
ballx+=ballxdir
bally+=ballydir
end

function losedeadball()
if bally>128 then
sfx(3)
bally=24
end
end

function bounceball()
--left
if ballx<ballsize then
ballxdir=-ballxdir
sfx(0)
end

--right
if ballx>128-ballsize then
ballxdir=-ballxdir
sfx(0)
end

--top
if bally<ballsize then
ballydir=-ballydir
sfx(0)
end

--bounce the ball off the paddle
function bouncepaddle()
if ballx>padx and
ballx<=padx+padw and
bally>pady then
sfx(0)
score+=10 --increase he score on hit!
balldir=-ballydir
end
end

function _draw()
--clear the screen
rectfill (0,0,128,128,3)

--draw the score
print (score,12,6,15)

--draw the paddle
rectfill (padx,pady,padx+padw,pady+padh,15)

--draw the ball
circfill (ballx,bally,ballsize,15)
end
end

Sorry i tried google but seems to just be me typing wrong.. So i think once i learn to use Pico-8 better it will help.

Also is the Pocketchip worth it for this? It looks awesome but I'm not use to new tech, kinda have stuck with computers and not really ventured into specialized gadgets.


It's because you're calling "moveball()" on line 28, but your function is named "_moveball()".


Thanks.. Sorry it's hard to read the Zine on my phone, gonna download on PC. :)


Okay, all done, but how do i display a 'Game Over' Sprite i created when the lives run out? Instead of just an abrupt end and having to restart?



[Please log in to post a comment]