-
Notifications
You must be signed in to change notification settings - Fork 1
/
pickup.ts
35 lines (31 loc) · 861 Bytes
/
pickup.ts
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
class pickup {
private div: HTMLElement;
private game: Game;
private itemnmb: number = Math.floor(Math.random()*3);
private itemid: string = "itemid" + this.itemnmb;
constructor(g: Game) {
this.game = g;
this.div = document.createElement("div")
this.div.setAttribute("id", this.itemid)
document.body.appendChild(this.div)
}
public getRectangle(){
return this.div.getBoundingClientRect()
}
private buff(nmb: number){
switch(nmb){
case 0:
player.bombrange += 1
break
case 1:
player.bombmax +=1
break;
case 2:
player.speed +=1
break;
}
}
public buffer(){
this.buff(this.itemnmb)
}
}