Commit 95e0263b authored by Yannick Armand's avatar Yannick Armand

Ajout de la mitrailette

parent b54c045d
......@@ -13,6 +13,7 @@ import Gun from './weapon/Gun'
import Mine from './weapon/Mine'
import RocketLauncher from './weapon/RocketLauncher'
import SmokeGrenade from './weapon/SmokeGrenade'
import SubmachineGun from './weapon/SubmachineGun';
type Direction = 'front' | 'back' | 'side-right' | 'side-left'
......@@ -85,6 +86,7 @@ export default class Player implements Entity {
new Grenade(game),
new RocketLauncher(game),
new SmokeGrenade(game),
new SubmachineGun(game),
]
this.currentWeaponIndex = 0
......
import Point from '../Point'
import Weapon from './Weapon'
import Game from '../Game'
import Point from '../Point'
import Bullet from './projectile/Bullet'
import Weapon from './Weapon'
import WeaponName from './WeaponName'
export default class Gun extends Weapon {
......
import Game from '../Game'
import Point from '../Point'
import Bullet from './projectile/Bullet'
import Weapon from './Weapon'
import WeaponName from './WeaponName'
......@@ -14,12 +15,22 @@ export default class SubmachineGun extends Weapon {
return 'submachine-gun'
}
// Tir du joueur
public fire(position: Point, angle: number): boolean {
return false
if (!this.canFire())
return false
this.decreaseAmmo()
this.resetLatency()
const bullet = new Bullet(this.getGame())
bullet.fire(position, angle)
return true
}
// Affichage de la miniature
public renderMiniature(ctx: CanvasRenderingContext2D): void {
const img = this.getGame().getImageManager().getImage('weapons-miniatures')
ctx.drawImage(img, 6 * 16, 0, 16, 16, 0, 0, 16, 16)
}
}
......@@ -11,7 +11,7 @@ export default class Bullet extends Projectile {
this.setSize(5, 3)
.setLifetime(3)
.setSpeed(300)
.setSpeed(400)
.setImage(image)
this.damages = 10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment