-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoin.pde
More file actions
34 lines (30 loc) · 674 Bytes
/
Coin.pde
File metadata and controls
34 lines (30 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Class representing the coins the player tries to catch
by Flocksserver http://flocksserver.de
*/
class Coin {
PShape c;
float xPos;
float yPos;
float coinWidth;
float coinHeigth;
float velocity;
public Coin() {
ellipseMode(CENTER);
init();
}
void init( ) {
coinWidth = gameHeight/50;
coinHeigth = gameHeight/50;
xPos = random(coinWidth, (gameWidth-1)-coinWidth);
yPos = -coinHeigth;
c = createShape(ELLIPSE, 0, 0, coinWidth, coinHeigth);
c.setFill(yellow);
}
void display( ) {
//Should start offscreen 1 times height
shape(c, xPos, -coinHeigth);
c.translate(0, velocity);
yPos += velocity;
}
}