Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setFlag(){
- //Set Flag randomly on the grid
- var rfX = 0;
- var rfY = 0;
- var currData;
- rfX = Math.floor((Math.random() * gridSizeWidth) + 1);
- rfY = Math.floor((Math.random() * gridSizeHeight) + 1);
- currData = PS.data(rfX, rfY);
- while(currData == "building" || currData == "plane"){
- rfX = Math.floor((Math.random() * gridSizeWidth) + 1);
- rfY = Math.floor((Math.random() * gridSizeHeight) + 1);
- currData = PS.data(rfX, rfY);
- }
- PS.glyph(rfX, rfY, "⌲");
- PS.glyphColor(FLAG.x, FLAG.y, PS.COLOR_GREEN);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement