How can I make objects which the player can collect, and how can I make it switch scenes once all the objects are collected? Before to collect objects I just program the objects to “End Object” when hit by player. Is there a better way to do this that can actually make collecting objects meaningful?
Let’s see if I can get you right: You want the player to collect object and change so actions or behaviour - e.g. keys that can open a certain door or something, right? You can add properties to the player object to give collectable objects a meaning and react on that properties. That you can achieve in different ways, depending in what you’re doing - and I don’t know what you have done so far. You could probably send a message to the player object and let it set a certain property. Then you can check this property to change the behaviour. You also could use python to achieve something like that. It depends what you want and what you have already done.
You’re close… I want more of a “change scene when all objecta are collected”. So, say we have three boxes. Once the player has collected (ended, maybe?) all three boxes, the scene changes.
Well, for that purpose you should add a property to the player which has the maximum count of the objects and decrease it every time one object is collected. If the property reaches 0 then you can switch to another scene using the scene actuator.
You don’t need python for this: You can decrease the property value with a property acuator - e.g.: the property is called boxes and is defined as int - so insert into the acuator Type: Assign, Prop: boxes, Value: boxes-1. This should decrease the property. On the sensor side for the decrease it again depends on what you have done so far or better “how you have done it”.
To switch the scene you had a property sensor for that counter (type: equals value: 0) and a scene actuator which sets the other scene.
That should work, I believe.
Add an int property to the player, call it “count”
Set it to the number of items you need to collect
Add a Near->and->property logic set
For the near, make it look for a prop you will put on the objects
A collision could be used instead of a near
For the property actuator, set it to ADD, put in “count”, and make the value “-1”
Add a property->and->scene logic set
Set the property to equals, use “count” as the name, and use “0” as the value
Put the new scene in the scene actuator.