non-respawning pickups? [solved]

mahamajama

  • Posts: 2
Does anyone know of a good way to make a pickup which doesn't respawn when you reload the scene?  There are going to be too many of these lying around to just make a global boolean for each one, and my lackluster knowledge of programming doesn't permit me to figure out another way. 

« Last Edit: March 25, 2011, 05:05:57 pm by mahamajama »

Epic428

  • Posts: 1118
The way I do things like this is to create a Game attribute that is a List. Then each item is given an ID which correlates to the Index in the specific list.

Then you basically put in each index a value that represents the item not being picked up, and one representing the item having been picked up. For example your game attribute could be labeled: "Item Collected?" with FALSE meaning the item has not been obtained, and TRUE meaning that it has.

I realize you said you didn't want to use a boolean. The difference between using a separate attribute for each item and a master attribute such as a list is you are given more control and it is less tedious. The reason this is the case, is that when the game starts, if it is the first time it is played, you can use a loop to set each index in the list to FALSE. Then as the items get picked up, their behavior could set the index, equal to their ID, of the list to TRUE. Thus, when the game is saved so is your master list.

This style really only becomes tedious if the game is already made. If you are beginning to construct the stages, then it is less tedious because its really only one extra step during the construction phase.

Unfortunately, I am unaware of any other method to solve this issue. Personally, never underestimate the power of booleans.

« Last Edit: March 25, 2011, 06:04:12 pm by Epic428 »
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

mahamajama

  • Posts: 2
Works great.  Thanks for that.

Epic428

  • Posts: 1118
No problem, let us know if you have any other questions.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs