Limiting the amount of objects into a scene

I want to add objects to my scene but limit the objects to say 7, so by pressing a key I add a certain number . How can I do that with Logic Bricks?

Thanks
digiman

You could probably do it with states, but that would be a pain. Have each time it spawns an object it changes to the next state and so forth.

Idk if this is what you are wanting, and right now I can’t think of any other ways to do it with logic bricks.


It is very simple to do.

Thank you for that, I woke up this morning and realized I was making a mistake :). I need to stop trying to help people when I’m really tired.

That works but the problem now is this. Once I add the objects to scene I can then right click on object to delete the object from scene, then while the game is still playing. If my max is 4 and I add 4 then I delete those 4 I want to be able to add those objects again without having to restart game if possible.

digiman

You just need to send a message (When you right click it deletes the object and sends a message to the original spawner) to the property shown above that subtracts 1 off of the property. If this doesn’t make sense I can make a .blend to show you.

Yes that might be a good idea. I need to see the hookup.

digiman

Here is the hook up :slight_smile: . Press LeftMouse to add cubes, then mouse over the added objects and click the RightMouse to delete them. This set-up should only allow up to 7 objects on the scene.

https://drive.google.com/open?id=0B7YN1w1IyXTMSVZWbGMxX3V4NzQ

Thanks, works great!

digiman