Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make something spawn on a random x axis p5.js

//creates spawn function
function objectSpawn(){
    object.y = 0;
    object.X = random(100, 300);
}

//call this spawn function whenever you want your object to respawn, for example:
if(object.y > 400){
    objectSpawn()
  }
 
PREVIOUS NEXT
Tagged: #spawn #random #axis
ADD COMMENT
Topic
Name
9+2 =