-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshot.js
More file actions
30 lines (24 loc) · 728 Bytes
/
shot.js
File metadata and controls
30 lines (24 loc) · 728 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
import { canvas, c } from "./canvas.js"
import { projectils, shotAudios } from "./canvas.js"
const shot = new Image()
shot.src = './folder/images/shot01.png'
export class Projectile {
constructor(endPoint, multiplyer){
this.x = canvas.width/2
this.y = canvas.height-30
this.endPoint = endPoint+110
this.endPointChange = 1 * 1
this.drawProjectil = () => {
c.drawImage(shot, canvas.width/2, this.y-60, 4, 12)
this.update()
}
this.update = () => {
if(this.y > this.endPoint){
this.y -= 20
} else {
projectils.shift()
shotAudios.shift()
}
}
}
}