Hi there I am very new to SuperPowers, but I love what I have seen so far.
I am doing a sample game project to practice some skills before I use this engine for LD37.
I am trying to randomly place trees around my map inside a square area between x -15 &15 and y -15 & 15
I created a new Scene called `Plants` and added one actor inside which has a body and a sprite.
I created a new script (shown below) but it only spawns one tree (or maybe 50 overlapping trees?)
Any help will be greatly appreciated!
class ScatterTrees extends Sup.Behavior {
trees = [];
treeCount = 50;
awake() {
for ( let i = 0; i < this.treeCount; i++){
let newtree = Sup.appendScene("Plants", this.actor)[0];
newtree.setLocalPosition(Sup.Math.Random.float(-15, 15),Sup.Math.Random.float(-15, 15), 1.1);
this.trees.push(newtree);
}
}
update() {
}
}
Sup.registerBehavior(ScatterTrees);