Log In  


I'm making a p8 game where you build things, how do I do that whilst making new variables so they can be used in collisions?



If you want to dynamically add objects to the game I suggest having some sort of table of items{} that you can add() to and del() from.

If I understand your question, I mean.


@borden

I would, but I don't want to take up too many tokens


I think this is actually a pretty token thrifty way to do it. Maybe if you wrote up a little example I'd understand what you're getting at.


Tables are the best inventory and you can always ADD or DEL things from them so they're pretty memory light if used well. I'd suggest a table format like, ITEM#, ITEMNAME, ITEMAMOUNT and use the item# to poke about your inventory.

Like
1,Banana,3
would mean item #1 is "Banana" and there's three of them. A -1 in the amount or a -2 or something could be used to indicate a permanent amount perhaps.


Guys, i figured out something

function room_x()
 rx={}
 for i=2,100 do
 rx[i]=-100
 end
end


[Please log in to post a comment]