I'm working on a game which requires some fire. I looked at some examples of doom fire but while it looks really good the technique was often very cpu expensive and didn't really work how i wanted it to. I decided to use the ECS i am using for the rest of the game ( my edited version of Jess Telford's PECS https://github.com/josiebb/pecs) to come up with something close enough but cheaper. This is what i came up with.
Still working on making it resizeable and positionable, bc I want to use it more than just in the menu of my game. Also a lot of general use code in here that is intended to be used with the rest of the project.
Hi! so I am attempting to make a platformer/puzzler game in which you are not supposed to get clears, or at least, not in the way you normally would. The idea as of now is to have clusters of 4-5 alike blocks make a clear which will cost HP/"hearts"/etc., but jumping to a certain height will clear the bottom rows, which will count towards your score.
...But I can't even get to that part of the game yet, because collisions and some other little technical issues. This is what I have so far.
Controls:
Left/Right = move character,
Up = jump,
X = move tetrad left or right,
Down = soft drop,
Z = rotate (not functional yet)
right now, I am using the game object system from bridg's Pico-8 for beginners tutorials. here's the issue - I need the game blocks to fall and leave no gaps, much like in puyo puyo. to do this they need to collide with other blocks that are the same type of game object. when I put it in as normal, the block launches into the air when it's created. I think this is because it is colliding with itself.

I was trying to do a solution using ipairs to compare the index number of the objects, so that I could exclude the current object and have it only collide with the others. the code i came up with doesn't exactly work, because I am unsure how to get the current object's index number. I feel like this is something resembling the solution though? am i going in the right direction here?
for i,b in ipairs(#objects)do if objects[i]!=self and objects[i.name]=="tet" then self:checkcollide(objects[i],0) self:handlecollide(objects[i],colldir) end end |
I'm also having issues where the tetrad, when it respawns, sometimes does not respond to the movement button anymore. it seems kind of random, like it might happen the first time it respawns or the fifth. here's the code for the tetrad-related inputs and the conditions that determine whether it goes left or right, which is all contained within the self.update function of the object.
if(self.x>96) self.dx=-8 if(self.x<16) self.dx=8 if self.islive then -- ❎ left/right if(btnp(5)) self.x+=self.dx -- 🅾️ rotate if(btnp(4)) then -- haven't got there yet! end -- ⬇️ soft drop if(btn(3)) self.y+=2 end |
i think it may be the way i'm calling it within the statement:
if self.islive then |
maybe sometimes it doesn't successfully call true? this is the code which is supposed to determine that.
inittetrad=function(self) if not self.islive then for i,b in ipairs (self.fblocks) do del(self.fblocks,b) end self.x=56 self.y=8 for i=0,3 do local s =flr(rnd(4)+1) if (#self.fblocks)<4 then add(self.fblocks,s) -- end end end self.islive=true end end, |
So, if anyone can see why any of this isn't working please let me know. I've only been working on this for a few weeks so I am very happy with the progress so far, hope that I can build something fun and memorable here. Here's another cart without the ipairs error so you can see the X button error.