-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweapon.js
More file actions
executable file
·42 lines (40 loc) · 949 Bytes
/
Copy pathweapon.js
File metadata and controls
executable file
·42 lines (40 loc) · 949 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
35
36
37
38
39
40
41
42
Weapon = {
fire: function() {
C.player.weapon.last_fire_frame = C.frame;
C.total_fired++;
C.player.bullets--;
var x = C.player.x;
var y = C.player.y;
C.projectiles.push(new C.player.weapon.projectile(x,y));
},
fire_sharpnel: function() {
for(var i=0;i<7;i++) Weapon.fire();
}
}
Pistol = {
fire_interval: C.fps, //frames between two shots
last_fire_frame: 0,
name: "pistol",
mag_size: 10,
projectile: Bullet,
image_file: 'img/pistol.png',
fire: Weapon.fire
}
Submachinegun = {
fire_interval: ~~(C.fps/3), //frames between two shots
last_fire_frame: 0,
name: "submachine gun",
mag_size: 30,
projectile: Bullet,
image_file: 'img/submachinegun2.png',
fire: Weapon.fire
}
Shotgun = {
fire_interval: C.fps, //frames between two shots
last_fire_frame: 0,
name: "shotgun",
mag_size: 35,
projectile: Bullet,
image_file: 'img/shotgun.png',
fire: Weapon.fire_sharpnel
}