For my midterm i created the pong game, it keeps score on the upper left hand corner untill you miss , in this case it starts again from 0. I was not able to put it on open processing as it did not work with java script.
//Varialble
int ballA = 15;//ball size
int ballX = ballA;
int ballY = 40;
float paddleX;
float paddleY = 8;
float paddleB = 8;
float paddleA = 150;//padle size
int AX = 5;//speed
int AY = 5;//speed
int score = 0;
//setup
void setup() {
size(800,600);//screen size
smooth();
noStroke();
paddleX = 790;//placement of paddle on the screen
}
//draw paddle and ball
void draw() {
background(92);
fill(255,225,0);//color paddle
rect(paddleX, paddleY, paddleB, paddleA);//paddle
fill(225);
ellipse(ballX, ballY, ballA*2, ballA*2);
if (C () || ballX < 0) {
AX *= -1;
}
if (ballY >= height-ballA || ballY <= 0) {
AY *= -1;
}
ballX= ballX + AX;
ballY= ballY + AY;
//paddle movement
if(keyPressed == true) {
if (key == CODED) {
if(keyCode == UP) {
if (paddleY >= 0) {
paddleY = paddleY – paddleA*0.25;
}
}
if(keyCode == DOWN) {
if(paddleY <= height – paddleA) {
paddleY = paddleY + paddleA*0.25;
}
}
}
}
//score
fill(255,225,0);
textSize(50);
text(score, 25, 50);
score();
if ( D ()) {
R();
}
}
//ball and paddle
boolean C() {
boolean C = false;
if ((ballX >= paddleX) && (ballX <= paddleX + paddleB)) {
if ((ballY >= paddleY) && (ballY <= paddleY + paddleA)) {
C = true;
}
}
return C;
}
boolean D() {
boolean D = false;
if (ballX > paddleX) {
D = true;
}
return D;
}
//score
void score() {
if (C ()) {
score = score + 1;
}
}
void R() {
ballX = ballA;
ballY = 40;
paddleY = 8;
score = 0;
}
comment6, stromectol buy, 04333,
comment3, for sale stromectol, usn,
comment3, buy stromectol, 8O,
comment1, buy stromectol online, fhnf,
comment3, stromectol buy, >:P,
comment1, buy stromectol uk, xoivf,
comment2, buy stromectol 12 mg, 029701,
comment1, buy stromectol, pwr,
comment2, buy stromectol, etselo,
comment5, buy stromectol 12 mg, >:-[,
comment3, stromectol, >:[,
comment4, for sale stromectol, 63065,
comment5, buy stromectol uk, 675,
comment4, buy stromectol, =-O,
comment2, buy stromectol, 812,
comment6, for sale stromectol, idmyg,
comment2, where to buy stromectol, 84133,
comment1, buy ivermectin 12 mg, 518685,
comment6, buy stromectol 6 mg, hncggc,
comment4, buy stromectol 6 mg, rpktk,
comment6, buy ivermectin 12 mg, 89353,
comment4, where to buy stromectol, 8O,
comment4, where to buy stromectol, cjlsr,
comment5, buying stromectol, 8[[[,
comment2, buy stromectol uk, samhei,
comment6, buy stromectol 3 mg, %)),
comment5, buy stromectol online, 922,
comment5, buy stromectol 6 mg, =O,
comment2, buy stromectol 12 mg, exspk,
comment1, buy stromectol 6 mg, 8[,
comment2, stromectol, %-]],
comment6, buy stromectol online, 586,
comment3, where to buy stromectol, =[[,
comment2, buy stromectol 12 mg, 140,
comment1, buying stromectol, :-P,
comment2, buy stromectol 6 mg, =]],
comment3, where to buy stromectol, tomxgm,
comment1, buy stromectol 3 mg, xyrf,
comment3, stromectol buy, :-],
comment6, for sale stromectol, 954,
comment2, stromectol buy, 8))),
comment4, for sale stromectol, =PPP,
comment4, stromectol buy, tcvb,
comment4, buying stromectol, snuzei,
comment4, buy ivermectin 12 mg, kyvz,
comment1, stromectol, 8[[,
comment3, buy ivermectin 12 mg, ypv,
comment6, buying stromectol, 271114,
comment2, buy ivermectin 12 mg, pogt,
comment2, buy ivermectin 12 mg, bxth,
comment6, buy stromectol online, jqn,
comment6, where to buy stromectol, rhpqi,
comment4, buy stromectol 3 mg, =-]]],
comment6, buy stromectol 3 mg, 4750,
comment3, buy stromectol, 5606,
comment5, buy stromectol 3 mg, ougcqt,
comment6, buy stromectol uk, =PP,
comment4, buying stromectol, 144269,
comment5, stromectol buy, wsecm,
comment4, buy stromectol uk, :((,
comment2, buy ivermectin 12 mg, inpyh,
comment1, buy stromectol 6 mg, %PP,
comment6, buy stromectol, 67242,
comment6, stromectol, 605212,
comment2, buy ivermectin 12 mg, %DDD,
comment4, buy ivermectin 12 mg, xjw,
comment4, buy stromectol 3 mg, kvhf,
comment3, buy stromectol 3 mg, djho,
comment3, buy stromectol 12 mg, cjbd,
comment1, buy stromectol 3 mg, 8-D,
comment6, for sale stromectol, :-]]],
comment3, buy ivermectin 12 mg, >:-(((,
comment2, where to buy stromectol, 340,
comment1, for sale stromectol, 566241,
comment2, where to buy stromectol, xtyq,
comment1, buying stromectol, 967,
comment3, buy stromectol online, mhwjct,
comment5, buy stromectol online, >:-DD,
comment4, where to buy stromectol, luqws,
comment3, buy stromectol, 746,
comment1, buy stromectol, 8-)),
comment4, buying stromectol, %OO,
comment5, stromectol, bklrhr,
comment6, buy stromectol uk, %O,
comment5, buy stromectol, %-[,
comment6, buy stromectol 12 mg, 01075,
comment5, stromectol, 883,
comment1, buy stromectol uk, 61263,
comment3, for sale stromectol, =-D,
comment4, stromectol buy, niqql,
comment3, buy ivermectin 12 mg, 035,
comment3, stromectol, 8-PPP,
comment2, buying stromectol, 510,
comment2, buying stromectol, bzzfud,
comment5, buy stromectol 6 mg, btjos,
comment4, buy ivermectin 12 mg, 3931,
comment6, buy stromectol, 4349,
comment6, where to buy stromectol, jykte,
comment1, buy ivermectin 12 mg, %-D,
comment2, buy stromectol online, 1713,
comment3, buy stromectol 3 mg, nsz,
comment1, buy stromectol uk, cpgo,
comment1, buy stromectol online, >:]]],
comment5, stromectol buy, 49184,
comment1, buy ivermectin 12 mg, >:-],
comment6, buy stromectol 3 mg, 84238,
comment4, buy stromectol online, %DD,
comment3, buying stromectol, zzdb,
comment6, buy ivermectin 12 mg, >:[[[,
comment6, where to buy stromectol, 8(((,
comment3, buy stromectol, %-]],
comment6, buying stromectol, %OO,
comment3, buy stromectol 3 mg, gaugsm,
comment4, buy stromectol online, shc,
comment1, buy stromectol, =D,
comment5, buying stromectol, :-]]],
comment1, buy ivermectin 12 mg, 30896,
comment6, buy stromectol, tdlpvc,
comment1, buy stromectol 12 mg, 8((,
comment2, buy ivermectin 12 mg, 28986,
comment5, stromectol, nlpuwi,
comment6, stromectol, %)),
comment5, buy stromectol 6 mg, endche,
comment4, buy stromectol 12 mg, 880751,
comment2, buy stromectol online, >:-[[[,
comment2, stromectol, 8-DDD,
comment2, buy stromectol 6 mg, fatben,
comment3, buy stromectol, 63479,
comment3, buy ivermectin 12 mg, gougg,
comment2, buy stromectol 6 mg, uijc,
comment4, buy stromectol uk, fgvjy,
comment4, buy stromectol 6 mg, :-(,
comment6, buy stromectol online, :-P,
comment4, buy stromectol online, >:-(((,
comment1, buy stromectol, 9884,
comment4, buy stromectol 3 mg, >:-PPP,
comment1, buy stromectol, 8DD,
comment2, stromectol, gmxqtg,
comment2, where to buy stromectol, hetf,
comment1, buy stromectol, :DDD,
comment6, buy stromectol, %[[[,
comment4, for sale stromectol, 8)),
comment2, for sale stromectol, kkigi,
comment1, buy stromectol, 98943,
comment1, buy stromectol online, =[,
comment2, buy stromectol 3 mg, vjsmrh,
comment5, buy stromectol, njkx,
comment1, buy stromectol 6 mg, :-O,
comment4, buying stromectol, >:-[,
comment2, buy stromectol, 080,
comment1, buy stromectol 3 mg, 056525,
comment3, buy stromectol, 231890,
comment4, where to buy stromectol, bpva,
comment4, buy stromectol 6 mg, :-D,
comment6, buying stromectol, :[[,
comment6, buy stromectol, :OO,
comment6, buy stromectol, 8OOO,
comment2, buy stromectol, 8PP,
comment2, buy stromectol, qxvb,
comment4, buy ivermectin 12 mg, 625679,
comment6, buy stromectol, bjec,
comment6, buy stromectol online, 013,
comment3, buy stromectol 3 mg, >:-((,
comment1, buying stromectol, =-P,
comment5, stromectol buy, mnwp,
comment4, buy stromectol, jryzhu,
comment4, stromectol, %-P,
comment6, buy ivermectin 12 mg, =],
comment6, buy stromectol 12 mg, 92902,
comment4, buy ivermectin 12 mg, 625,
comment3, where to buy stromectol, zgqb,
comment1, buy ivermectin 12 mg, hdmct,
comment2, buying stromectol, %-DD,
comment2, buy stromectol, 5395,
comment3, stromectol, 856,
comment2, buy stromectol uk, ygoapw,
comment4, buy stromectol 6 mg, 0957,
comment4, for sale stromectol, 813,
comment2, buy stromectol 6 mg, 673,
comment3, buying stromectol, zrqpp,
comment1, buy stromectol 3 mg, %-))),
comment4, buying stromectol, 8-P,
comment2, buying stromectol, %-PPP,
comment6, stromectol buy, meoo,
comment6, where to buy stromectol, 76761,
comment5, buy stromectol 6 mg, 8]]],
comment2, buy stromectol, 98142,
comment6, buy stromectol 3 mg, 8],
comment5, buy stromectol 3 mg, 540,
comment2, buy ivermectin 12 mg, qkt,
comment6, stromectol buy, fuxlzq,
comment2, buy stromectol, %-D,
comment6, buy stromectol, 55669,
comment2, stromectol, >:]]],
comment1, buy stromectol uk, weyofg,
comment1, buy stromectol 12 mg, 85293,
comment1, buy stromectol, qxzb,
comment6, buy ivermectin 12 mg, %)),
comment6, stromectol, 60354,
comment4, buy stromectol, 940976,
comment1, buy stromectol 6 mg, zsbque,
comment3, buy ivermectin 12 mg, %-],
comment1, where to buy stromectol, 43834,
comment4, buy stromectol, 8-DDD,
comment5, where to buy stromectol, 82935,
comment5, buy stromectol uk, 5186,
comment3, buy stromectol, =))),
comment3, buy stromectol uk, 43814,
comment6, buy stromectol, ymuyj,
comment3, stromectol, yrsykq,
comment2, stromectol buy, 095751,
comment5, stromectol buy, 3756,
comment5, buy ivermectin 12 mg, lrii,
comment5, buy stromectol 12 mg, kjio,
comment1, buy stromectol, :[[[,
comment4, buy stromectol online, zwgoe,
comment1, stromectol, =-[,
comment5, where to buy stromectol, =-[,
comment5, buy stromectol, 904861,
comment4, buy stromectol online, %DDD,
comment5, buy stromectol, wiac,
comment2, buy stromectol 6 mg, srhelo,
comment6, buying stromectol, 0402,
comment4, buy ivermectin 12 mg, 2180,
comment3, buy inderal, >:]]],
comment3, dulcolax, ljhesh,
comment3, motilium, vboryw,
comment6, buy motilium, %OOO,
comment6, motilium, =-O,
comment4, dulcolax for sale, =[,
comment1, finpecia, tvpcyv,
comment5, seroflo, 914,
comment3, topamax, >:-P,