//Project 1// //In Class// //Kurt Sanimarco 9/12/2014// int score; float horizon=height/4; float herox, heroy; float monsterx, monstery; float sunx=200, suny=100; float scorex=800, scorey=120; float goldx, goldy; void setup(){ //setup// size(900,900); } void draw(){ //next frame// scene(); hero(); monster(); dead(); gold(); } void scene(){ background(12,174,49); fill(4,45,250); rect(horizon,0,width,height*1/4); fill(255,245,9); ellipseMode(CENTER); ellipse(sunx,suny,120,120); sunx= sunx +5; if (sunx>width) { score= score +=50; sunx=0; suny=random(10, horizon); } fill(0); text("Score: "+ score ,scorex,scorey); } void hero(){ herox= herox+ (goldx- herox)/100; heroy= heroy+ (goldy- heroy)/100; //draw hero// fill(18,240,229); rect(herox,heroy,100,150); fill(240,177,18); ellipse(herox+50,heroy,80,80); if ( dist(herox,heroy,goldx, goldy) <10){ } } void monster(){ //monster follows hero// monsterx= monsterx+ (herox-monsterx)/150; monstery= monstery+ (heroy-monstery)/150; //draw monster// fill(240,48,18); rect(monsterx,monstery,100,150); fill(0); ellipse(monsterx+50,monstery,80,80); if ( dist(herox, heroy, monsterx, monstery) <10) { dead(); } } void mousePressed(){ goldx= mouseX; goldy= mouseY; } void gold(){ fill (255,255,90); ellipseMode(CENTER); ellipse( goldx, goldy, 15, 15); } void dead(){ }