This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.pde
63 lines (56 loc) · 1.92 KB
/
player.pde
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//===============================================
//
// Learning About Blackjack - Baseline Code
// Professor Marty Altman
// SCAD-Atlanta
// ITGM 220
//
// This file contains the definition for the Player class, which represents
// the player. This class is minimal, since the user embodies the "intelligence"
// here. Basically this class contains a hand.
//
//===============================================
class Player {
Hand hand; // this player's hand of cards
float posX,posY; // base position of this player
float rotZ; // base rotation of this player
boolean active; // true iff this player is active, false otherwise
boolean show; // true shows score, false doesn't
int result; // result of this player's hand (who won?)
Player( float x, float y, float r ) {
hand = new Hand(0,0);
posX = x;
posY = y;
rotZ = r;
active = false;
show = true;
result = Result.NONE;
}
void reset() {
hand.reset();
active = false;
show = true;
result = Result.NONE;
}
void takeCard( Card card ) {
hand.takeCard(card);
}
void display() {
pushMatrix();
translate(posX,posY,0); // establish player position
rotateZ(rotZ); // and rotation
game.ui.displayPositionIndicator(); // draw position indicator
if ( active ) { // if active
game.ui.displayActiveIndicator(); // draw active indicator
}
hand.display(show); // now display the hand
popMatrix();
}
void displayResults() {
pushMatrix();
translate(posX,posY,0); // establish player position
rotateZ(rotZ); // and rotation
hand.displayResult(result); // now display the results
popMatrix();
}
}