Hello all.
I'm brand new to all things Pico 8, having dabbled with programming since the 80s.
I'm having LOTS of problems though.
I added particles to my platform player.
I saw a tutorial about adding objects and function within them, so I tried to change my particle system.
It broke. The error says: Unclosed { but I can't find where I've gone wrong.
I apologise if this isn't how to post code on this.
Can someone help out, please. (This is trimmed down in the hope I don't over stay my welcome!)
function _init()
....
particle={}
end
function add_new_particle(x,y,die,dx,dy,grav,grow,shrink,r,c_table)
add(particle,{
x=x,
y=y,
t=0,
die=die,
dx=dx,
dy=dy,
grav=grav,
grow=grow,
shrink=shrink,
r=r,
c=0,
c_table=c_table
draw=function(self)
if self.r<=1 then
pset(self.x,self.y,self.c)
else
circfill(self.x,self.y,self.r,self.c)
end
end,
update=function(self)
self.x+=self.dx
self.y+=self.dy
if self.grav then self.dy+=.5 end
if self.grow then self.r+=.1 end
if self.shrink then self.r-=.2 end
self.t+=1
if self.t>self.die then del(particle,self) end
if self.t/self.die < 1/#self.c_table then
self.c=self.c_table[1]
elseif self.t/self.die < 2/#self.c_table then
self.c=self.c_table[2]
elseif self.t/self.die < 3/#self.c_table then
self.c=self.c_table[3]
else
self.c=self.c_table[4]
end
end
})
end
function dust()
add_new_particle(plyr.x,plyr.y,10+rnd(7),rnd(2)-1,rnd(.3)-.4,false,true,true,3,{4,4,5,5})
end
function runs()
add_new_particle(plyr.x,plyr.y,10+rnd(7),rnd(2)-1,rnd(1)-0.5,false,false,true,2,{4,4,5,5})
end
When the player lands on a platform, I have this: But it doesn't get this far.
dust()
sfx(0)
I haven't even figured what to put in the _draw function yet.
I hope this isn't too much to see what I'm trying to do and makes a bit of sense to someone.
Thanks for your time.
Peej
Holy heck...
Don't tell me I just missed the comma at:
c_table=c_table
Heads up: you can insert code blocks by having three backticks ("```") alone on a line, then your code, and then another three alone on a line. It'll format exactly as typed and in monospaced font, rather than the BBS formatting it however it pleases.
like.this |
[Please log in to post a comment]