-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.jack
46 lines (34 loc) · 1.23 KB
/
Player.jack
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
// Player Class
// An object that describes an actual player of the game.
// Contains things like player stats and score and his
// sprite
class Player {
field Attributes attributes;
field int powerRemaining;
field int bulletsRemaing;
field String name;
constructor Player new(Settings newSettings, String myName, int startX, int startY,
int startRotation, int startRadius, int startMass) {
let attributes = Attributes.new(1, startX, startY,0,0, startRotation, startRadius, startMass);
let powerRemaining = 0;
let bulletsRemaing=0;
let name=myName;
return this;
}
method Attributes getAttributes(){ return attributes; }
method int getPowerRemaining() { return powerRemaining; }
method void setPowerRemaining(int newValue) { let powerRemaining=newValue; return; }
method int getBulletsRemaing() { return bulletsRemaing; }
method void setBulletsRemaing(int newValue) { let bulletsRemaing=newValue; return; }
method String getName() {return name;}
method void kill() {
do attributes.setIsDead(true);
return; }
method bool getIsDead(){
return attributes.getIsDead();}
method void dispose(){
do attributes.dispose();
do Memory.deAlloc(this);
return;
}
}