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!

P#34679 2017-01-01 15:14 ( Edited 2017-01-02 10:35)

1

function _update()
function _draw()

notice the spaces^^ :)

P#34683 2017-01-01 15:34 ( Edited 2017-01-01 20:34)

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

P#34685 2017-01-01 16:11 ( Edited 2017-01-01 21:11)

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.

P#34696 2017-01-01 19:47 ( Edited 2017-01-02 00:47)

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

P#34704 2017-01-01 21:51 ( Edited 2017-01-02 02:51)

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

P#34706 2017-01-01 22:30 ( Edited 2017-01-02 03:30)

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?

P#34723 2017-01-02 05:35 ( Edited 2017-01-02 10:35)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 20:32:51 | 0.006s | Q:15