Answers for "how to create a random spawn in p5.js"

1

how to make something spawn randomly 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()
}
Posted by: Guest on February-28-2021

Browse Popular Code Answers by Language