Skip to content

Instantly share code, notes, and snippets.

@AlexBezuska
Created December 1, 2016 12:54
Show Gist options
  • Save AlexBezuska/67c96b6b89f64823ab1395c9f8b32777 to your computer and use it in GitHub Desktop.
Save AlexBezuska/67c96b6b89f64823ab1395c9f8b32777 to your computer and use it in GitHub Desktop.
prefab scattering system for SuperPowers-html5
class ScatterStars extends Sup.Behavior {
trees = [];
treeCount = 20;
start() {
for (var i = 0; i < this.treeCount; i++){
Sup.appendScene("Plants")[0]
.arcadeBody2D.warpPosition(Sup.Math.Random.float(-5, 5),Sup.Math.Random.float(-5, 5));
}
}
update() {
}
}
Sup.registerBehavior(ScatterStars);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment