samedi 5 décembre 2015

Generate random boxes without overlapping. Javascript

i used this random function to generate the top and the left position. how do i generate the numbers such that the boxes dont overlap with each other.

this.posX = Math.floor((Math.random() * 850) + 1);
this.posY = Math.floor((Math.random() * 450) + 1);

Fiddle: http://ift.tt/1NztiuH




Aucun commentaire:

Enregistrer un commentaire