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

2013/9/13

Need help with adding a spawn point to the world

CreepingFuRbalL CreepingFuRbalL

2013/9/13

#
Hi im brand new to the computer coding world and i am very interested to learn ive started making basic games but i enjoy the satisfaction in seeing the end product i was hoping if someone would be able to show me how to add a spawn point into my world?Thank you
Gevater_Tod4711 Gevater_Tod4711

2013/9/13

#
The easyest way to add a spawn point would be to add new objects to the world when a condition is fullfiled:
//in your world class;

public void act() {
    if (getObjects(YourObject.class).size() < minimumNumberOfObjects) {
        addObject(new YourObject(), spawnPointX, spawnPointY);
    }
}
This will make new objects spawn when there are less than it should be.
You need to login to post a reply.