NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

float xRan; //random x of food
float yRan; //random y of food
float xPois; //random x of poison
float yPois; // random y of poison
float xPois2; //random x of 2nd poison
float yPois2; //random y of 2nd poison
float xPois3; //random x of 3rd pois
float yPois3; //random y of 3rd pois
PVector position; // Position of the ball
PVector position2; //position of poison
PVector pois2nd; //2nd position of poison
PVector pois3rd; //3rd pos of pois
PVector velocity; // starting velocity of the ball
PVector velocity2; //poison velocity
PVector velocity3; //2nd poison velocity
PVector velocity4; //3rd pois veloc
boolean upperBound;//upper bound boolean expression
boolean lowerBound; //lowerbound boolean expression
float targetSize=10; //diameter of ellipse
boolean poisonCollision1; //upper bound poison
boolean poisonCollision2; //lower bound poison
boolean poison2Collision1; //upper bound poison 2
boolean poison2Collision2; //lower bound poison 2
boolean poison3Collision1; //upper bound pois 3
boolean poison3Collision2; //lowe bound pois 3
void setup() {
size(1080, 720);
frameRate(60);
xRan=(int)random(10, width-10);
yRan= (int)random(10, height-10);
position = new PVector(width-60, height/2);
position2=new PVector(random(40,width),random(10,height));
pois2nd=new PVector(random(40,width),random(10,height));
pois3rd=new PVector(random(40,width),random(10,height));
velocity = new PVector(0, 0); //starting velocity of the snake going from left to right of the screen

}

void draw() {
color cool;
float R = random(255.0);
float G = random (255.0);
float B = random (255.0);
velocity2=new PVector(random(-10,10),random(-10,10)); //starting velocity of the poison
velocity3=new PVector(random(-10,10),random(-10,10));//starting velocity of the poison
velocity4=new PVector(random(-10,10),random(-10,10));
cool=color(R, G, B); //randomly generated colour for additional snake piece upon consuming ball
background(50, 200, 100);
fill(cool);
ellipse(position.x, position.y, targetSize, targetSize);
fill(207,255,4);
triangle(position2.x-50,position2.y,position2.x-30,position2.y,position2.x-40,position2.y-10); //poison piece #1
triangle(pois2nd.x-50,pois2nd.y,pois2nd.x-30,pois2nd.y,pois2nd.x-40,pois2nd.y-10); //poison piece #2
triangle(pois3rd.x-50,pois3rd.y,pois3rd.x-30,pois3rd.y,pois3rd.x-40,pois3rd.y-10); //poison piece #3
upperBound=(position.x-.5*targetSize<=xRan && position.x+.5*targetSize>=xRan);
lowerBound=(position.y-.5*targetSize<=yRan && position.y+.5*targetSize>=yRan);
poisonCollision1=(position.x-.5*targetSize<=position2.x-50 && position.x+.5*targetSize>=position2.x-50);
poisonCollision2=(position.y-.5*targetSize<=position2.y && position.y+.5*targetSize>=position2.y);
poison2Collision1=(position.x-.5*targetSize<=pois2nd.x-50 && position.x+.5*targetSize>=pois2nd.x-50);
poison2Collision2=(position.y-.5*targetSize<=pois2nd.y && position.y+.5*targetSize>=pois2nd.y);
poison3Collision1=(position.x-.5*targetSize<=pois3rd.x-50 && position.x+.5*targetSize>=pois3rd.x-50);
poison3Collision2=(position.y-.5*targetSize<=pois3rd.y && position.y+.5*targetSize>=pois3rd.y);

println(poisonCollision1,poisonCollision2);
println(targetSize);
if (upperBound==true && lowerBound==true) {
targetSize=targetSize+10;
xRan=random(0, width);
yRan=random(0, height);

}
if (poisonCollision1==true && poisonCollision2==true) {
targetSize=targetSize-10;
}
if (poison2Collision1==true && poison2Collision2==true) {
targetSize=targetSize-10;
}




position.x = position.x + velocity.x;
position.y = position.y + velocity.y;
position2.x = position2.x + velocity2.x;
position2.y = position2.y + velocity2.y;
pois2nd.x =pois2nd.x + velocity3.x;
pois2nd.y =pois2nd.y + velocity3.y;
pois3rd.x =pois3rd.x + velocity4.x;
pois3rd.y =pois3rd.y + velocity4.y;
fill(255, 0, 0);
ellipse(xRan, yRan, 10, 10);
if (position2.x<40){
position2.x=position2.x+10;}
if (position2.x>width-40){
position2.x=position2.x-10;}
if (position2.y<10){
position2.y=position2.y+10;}
if (position2.y>710){
position2.y=position2.y-10;}
if (pois2nd.x<40){
pois2nd.x=pois2nd.x+10;}
if (pois2nd.x>width-40){
pois2nd.x=pois2nd.x-10;}
if (pois2nd.y<10){
pois2nd.y=pois2nd.y+10;}
if (pois2nd.y>710){
pois2nd.y=pois2nd.y-10;}
if (pois2nd.x<40){
pois2nd.x=pois2nd.x+10;}
if (pois3rd.x>width-40){
pois3rd.x=pois3rd.x-10;}
if (pois3rd.y<10){
pois3rd.y=pois3rd.y+10;}
if (pois3rd.y>710){
pois3rd.y=pois3rd.y-10;}

if (position.x<0.5*targetSize ) {
fill(0);
textAlign(CENTER, CENTER);
textSize(100);
text("GAME OVER!", width/2, height/2);
frameRate(0);
}
if (position.y<0.5*targetSize ) {
fill(0);
textAlign(CENTER, CENTER);
textSize(100);
text("GAME OVER!", width/2, height/2);
frameRate(0);
}
if (position.x>1080-0.5*targetSize ) {
fill(0);
textAlign(CENTER, CENTER);
textSize(100);
text("GAME OVER!", width/2, height/2);
frameRate(0);
}
if (position.y>720-0.5*targetSize ) {
fill(0);
textAlign(CENTER, CENTER);
textSize(100);
text("GAME OVER!", width/2, height/2);
frameRate(0);
}
if (targetSize<5){
fill(0);
textAlign(CENTER, CENTER);
textSize(100);
text("GAME OVER!", width/2, height/2);
frameRate(0);}
}
void keyPressed() {
if (key=='d' && position.x<1080) {
position.x=position.x+10;
}

if (key=='a' && position.x>0) {
position.x=position.x-10;
}
if (key=='w' && position.y>0) {
position.y=position.y-10;
}
if (key=='s' && position.y<720) {
position.y=position.y+10;
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.