Log In  
Follow
Seriall
[ :: Read More :: ]

Cart #51146 | 2018-04-01 | Code ▽ | Embed ▽ | No License

My first Pico8 complete game and my first contact with LUA! Thanks to PICO-ZINE and the answers of my post:

Forum link

I'm in love with Pico8 haha
Enjoy!

OBS: Press X to restart the game.

P#51147 2018-04-01 14:39 ( Edited 2018-04-01 18:45)

[ :: Read More :: ]

Hey guys!

I'm having some difficulties to spawn an object where another hit... (get object.x then spawn an object in there)

The problem is... I want to make some fruits fall down the screen...

some parts of my code:

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

--fruit
fspr=1
fx=0
fy=0

--top
if bally<ballsize then
ballydir=-ballydir
fx=0 (RESET FX)
fx=ballx (GET FX)
end

--create fruits
function createfruit()
fruit = spr(fspr,fx,fy)
end

function _draw()
rectfill(0,0,128,128,color2)
--draw the paddle
rectfill(padx,pady,padx+padw,pady+padh,color1)
--draw ball
circfill(ballx,bally,ballsize,color1)

--fruit spawn
if fx>0 or fx==-1 then
createfruit()
end

end

but when I do this just one fruit fell down (fy-=3)

I need do something like foreach or Am I missing something?

Thanks!

P#51061 2018-03-30 13:13 ( Edited 2018-04-01 21:45)