Hello there!
I have been exploring Pico8 for over 2 years now trying to understand coding with let's say "some" progress.
But I'm stuck with Tables. I mean, I get the concept but there's something I haven't got to fully understand therefore I get mixed results.
So I created actors (player, enemy) as tables but I can't make them spawn several instances on screen. So far I have got to draw 5 enemies on stage (at random position) but they keep appearing all the time (where they should appear once), any light about what I'm doing wrong? here's the code:
--init
function _init()
--globals
wave=5
w=112
h=112
--player
pyr={
spt=1,
x=w/3,
y=h/3,
life=10,
spd=2,
flp=false,
idle=true,
}
enms={} --enemies
enm={ --single enemy
spt=10,
life=5,
spd=1,
flp=false,
idle=true,
draw=function()
spr(enm.spt,flr(rnd(w)),flr(rnd(h)))
end,
}
for a=1,wave do
add(enms,enm)
end
end
--draw
function _draw()
cls()
print(#enms,20,20,7) --checking created instances from enms table
foreach(enm,enm:draw())
end
I have read tutorials, videos and everything available but still I haven't figured it out yet :( Any help is much appreciated.
So I'm just another old school gaming enthusiast who loves to make games for fun. I stumbled upon Pico-8 and I got so amazed by the concept that I decided to learn programming. I have made some mobile games before but I used Construct 2, which provides a set of widgets and tools to create a game with just a little knowledge of coding.
However, after 2-3 weeks with P8 I got into to this situation where I'm wondering myself if I want to learn coding by making a tiny game or just want to have fun while making a tiny game.
I'd love to say both but for me, it depends of how "intuitive" is to communicate with the hardware through a programming language (that's the reason why languages exist) but at this time it is not. There are a few things that should be easy but for some reason I just can't get to understand, like:
- Rotate a sprite by 90 degrees in order to recycle sprites on top view games instead of having 4 different animations for each direction
- Simple stuff like understanding how to handle arguments within functions or tables
[i]It's Worth to recall that I'm an absolute Noob on this matter and sometimes I feel that my brain is just not compatible with programming logic :(