xxxxxxxxxx
//For more info on simple feedback, check out Aaron Reuland's guide: https://openprocessing.org/sketch/2239520
//song created by me, using Suno.com!
//forestSounds (non-vocal background music) by <a href="https://pixabay.com/users/the_mountain-3616498/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=162223">Dmitrii Kolesnikov</a> from <a href="https://pixabay.com//?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=162223">Pixabay</a>
//Store Link: https://joescodeart.etsy.com
/*
Hey Sableraph and Friends!
Hope you all enjoy this feedback sketch!
Music is copyright free and AI generated! If you have not tried making music with AI, I highly reccomend you try it out - I use suno.com!
*/
let land=75
let frameRateSpeed=55
let deployHouse=false
let pathStart=false
function preload()
{
soundFormats('mp3', "wav");
song = loadSound('Joe-MouseTrails.mp3');//load song
forestSounds = loadSound('forest-sounds2.mp3');//load background music
}
function setup()
{
createCanvas(1700, 960);
background(0);
song.loop() //automatically plays and loops songs
forestSounds.loop()
fill("skyblue") //sky background
rect(0,0,width,height)
}
function draw()
{
frameRateSpeed = constrain(frameRateSpeed, 40, 55); //changes frame rate to give hilly look/feel
frameRateSpeed=frameRateSpeed+random(-.5,.5)
frameRate(frameRateSpeed)
let g=get()
push()
image(g, 0, 0, width, height*0.99) //creates feedback loop
if(deployHouse==true && pathStart==false) //creates house after the mouse has been pressed
{
fill("brown")
rect(mouseX-20,height-30,100,-70)
fill(0)
rect(mouseX+10,height-30,20,-40)
pathStart=true //starts building the path
}
for(i=0;i<10;i++)
{
//creates trees
if(pathStart==true)
{
if(i<=5) x=random(mouseX-60) //makes tress created, a distance away from the mouse
else x=random(mouseX+60, width)
}
else x=random(width)
y=900
xinc=random(50)
yinc=random(50)
trunkWidth=random(5,20)
stroke(0) //trunk
fill(random(50,150),0,0)
beginShape()
vertex(x,y)
vertex(x,y-trunkWidth)
vertex(x+10,y-trunkWidth)
vertex(x+10,y)
vertex(x,y)
endShape()
fill(0,random(50,150),0) //tree top
beginShape()
stroke(0)
vertex(x-5,y-20)
vertex(5+x+10,y-20)
vertex( (x-5) + (((5+x+10)-(x-5))/2) ,y-random(80,100))
vertex(x-5,y-20)
endShape()
}
for(i=0;i<200;i++) //create flowers
{
if(pathStart==true) //makes flowers created, a distance away from the mouse
{
if(i<=100) grassXpos=random(mouseX-65)
else grassXpos=random(mouseX+65, width)
}
else grassXpos=random(width)
stroke(0, random(50),0)
line(grassXpos, 900, flowerCenterX=grassXpos-random(-10,10), 900-15)
let choice = round(random(5))
if(choice==0)
fill(random(255),random(255), random(255))
circle(flowerCenterX,900-15,3)
}
pop()
//makes the green land/grass
land = constrain(land, 50, 80);
land=land+random(-5,5)
fill(0,land,0)
strokeWeight(random(1))
rect(0,height-30,width,height)
//makes the brown path
if(pathStart==true)
{
fill("brown")
strokeWeight(random(1))
rect(mouseX,height-30,20,height)
}
fill(0) //rectangle at top of screen to cut off "fuzz" left over by feedback loop
rect(0,0,width,30)
}
function mousePressed()
{
deployHouse=true
}