This site requires JavaScript, please enable it in your browser!
Greenfoot back
zhuvell
zhuvell wrote ...

2012/11/1

Having an inventory?

zhuvell zhuvell

2012/11/1

#
I am making an escape-the-room game, in which a person can pick up objects that he/she can use in many worlds. While I can see how this would work in one world, I am not sure how to make an inventory that would "stick" no matter the instance. The objects are dragable actors. Now I'm not asking for a code, just maybe a suggestion of how I would go about making this inventory. Although if someone had a source code of a similar game, I would love to take a look.
Gevater_Tod4711 Gevater_Tod4711

2012/11/1

#
if you want to use different world subclasses you should use a class extending Actor whith some static variables. The static variables will still be the same if the object is removed and they'll have the same values in all objects. If you declare the variables as public static it's also very easy to call them. You just have to call them like this:
Classname.variableName;
erdelf erdelf

2012/11/1

#
I think this scenario could help you: http://www.greenfoot.org/scenarios/6285
Gevater_Tod4711 Gevater_Tod4711

2012/11/1

#
@I<3DragonPr0nZ you should post something helpfull instead of just insulting erdelf
erdelf erdelf

2012/11/1

#
@I<3DragonPr0nZ, you dont know me and I dont know you. Think about this the next time. It is too bad that no one of the admins wants to delete this account.
erdelf erdelf

2012/11/1

#
@I<3DragonPr0nZ, learn to read. I never said you arent a valuable member.
SPower SPower

2012/11/1

#
@I<3DragonPr0nZ Don't do so weird, you haven't posted any scenario's, so forget that dream for now. Erdelf is just a good greenfoot user, so there's no reason to call him a gayboy or something like that!
You need to login to post a reply.