Code viewer for World: Cloned P5 World

// Cloned by test  on 13 Aug 2018 from World "P5 World" by Starter user 
// Please leave this clone trail here.
 


// ==== Starter World ===============================================================================================
// (c) Ancient Brain Ltd. All rights reserved.
// This code is only for use on the Ancient Brain site.
// This code may be freely copied and edited by anyone on the Ancient Brain site.
// This code may not be copied, re-published or used on any other website.
// To include a run of this code on another website, see the "Embed code" links provided on the Ancient Brain site.
// ==================================================================================================================




// Starter World for P5 API  




// ===================================================================================================================
// === Start of tweaker's box ======================================================================================== 
// ===================================================================================================================

// The easiest things to modify are in this box.
// You should be able to change things in this box without being a JavaScript programmer.
// Go ahead and change some of these. What's the worst that could happen?


AB.clockTick       = 20;    

AB.maxSteps        = 1000000;    

AB.screenshotStep  = 200;   
  
AB.drawRunControls = false;
	
const SKYCOLOR = "LightBlue";       // any format color that is accepted by P5 background()
                                    // https://p5js.org/reference/#/p5/background
	
const MUSIC_BACK  = '/uploads/starter/Defense.Line.mp3' ;

  
// ===================================================================================================================
// === End of tweaker's box ==========================================================================================
// ===================================================================================================================


// You will need to be some sort of JavaScript programmer to change things below the tweaker's box.





function World() 
{ 
    this.newRun = function()                 
    {
		ABWorld.init (  SKYCOLOR  ); 
		initMusic();
    };


    this.nextStep = function()                
    {
		// can put P5 instructions to be executed every step here, or in draw()  
 
        // fill color white
		fill(255, 255, 255); 
		
		// draw ellipses on desktop 
		// draw ellipse on mouse hover, wherever the mouse is, each step
		if ( AB.onDesktop() )   ellipse(mouseX, mouseY, 80, 80);         
    };
}


// draw ellipses on mobile   
// on touch there is no hover
// so respond directly to touch events rather than run on its own 
// https://github.com/processing/p5.js/wiki/p5.js-overview#mouse-and-touch-interaction

function touchStarted() 
{
    ellipse(mouseX, mouseY, 80, 80); 
    // prevent default
    return false;
}



//---- setup -------------------------------------------------------
// Do NOT create a setup function 
// But you can create these functions.

function beforesetup()        // Optional
{
    // Anything you want to run at the start BEFORE the canvas is created 
}

function aftersetup()         // Optional
{
    // Anything you want to run at the start AFTER the canvas is created 	
}



//---- draw -------------------------------------------------------
// draw() is not needed. 
// Can use nextStep() or takeAction() instead.

function draw()               // Optional
{
	// can put P5 instructions to be executed every step here, or in nextStep()  
}




// --- music ----------------------------------------

var backmusic = new Audio ( MUSIC_BACK );
 
function initMusic()	
{
	backmusic.loop = true;                 // loop forever 
	backmusic.play();

	AB.standardAudioButtons ( backmusic );		// insert standard play/pause buttons 
}