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?

P#45337 2017-10-19 16:28 ( Edited 2017-10-23 20:40)

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.

P#45338 2017-10-19 16:45 ( Edited 2017-10-19 20:45)

@borden

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

P#45339 2017-10-19 16:49 ( Edited 2017-10-19 20:49)

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.

P#45340 2017-10-19 17:23 ( Edited 2017-10-19 21:23)

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.

P#45360 2017-10-20 11:48 ( Edited 2017-10-20 15:50)

Guys, i figured out something

function room_x()
 rx={}
 for i=2,100 do
 rx[i]=-100
 end
end
P#45428 2017-10-23 16:40 ( Edited 2017-10-23 20:40)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 19:08:37 | 0.016s | Q:18