Feature: gunshot

This commit is contained in:
Fabrice Ecaille
2013-10-07 18:40:35 +02:00
parent f6ef50f071
commit 4877555342
2 changed files with 23 additions and 11 deletions

View File

@@ -23,6 +23,10 @@
background-color: orange; background-color: orange;
} }
.shipShot.shotgun {
background-color: grey;
}
.shipShot.shotCorn { .shipShot.shotCorn {
background-color: white; background-color: white;
} }

View File

@@ -32,10 +32,10 @@ Weapon.prototype = {
stock: Infinity, stock: Infinity,
rof : 300, rof : 300,
ror : 1500, ror : 1500,
load : 3, load : 1,
max_load : 3, max_load : 1,
width : 5, width : 5,
height : 20, height : 5,
shot_timer : false, shot_timer : false,
reload_timer : false, reload_timer : false,
directionX : 0, directionX : 0,
@@ -72,22 +72,30 @@ Weapon.prototype = {
} }
function HeroWeapon() { function ShotgunWeapon() {
"use strict"; "use strict";
this.directionY = -1; this.directionY = -1;
this.rof = 200;
this.ror = 1500;
this.load = 2;
this.max_load = 2;
this.width = 3;
this.height = 3;
this.clazz = "Shotgun"
} }
HeroWeapon.prototype = { ShotgunWeapon.prototype = {
} }
heriter(HeroWeapon.prototype, Weapon.prototype); heriter(ShotgunWeapon.prototype, Weapon.prototype);
function CarotWeapon() { function CarotWeapon() {
"use strict"; "use strict";
this.directionY = -1; this.directionY = -1;
this.stock = 10; this.stock = 10;
this.clazz = "carot"; this.clazz = "carot";
this.load = 1; this.load = 5;
this.max_load = 1; this.max_load = 5;
this.width = 5;
this.height = 10;
} }
CarotWeapon.prototype = { CarotWeapon.prototype = {
@@ -310,7 +318,7 @@ function Ship(id, start, speed, animation) {
this.x = start.x; this.x = start.x;
this.y = start.y; this.y = start.y;
this.weapon = new HeroWeapon(); this.weapon = new ShotgunWeapon();
this.fireDirectionY = -1; this.fireDirectionY = -1;
this.originX = this.x; this.originX = this.x;
@@ -397,7 +405,7 @@ Ship.prototype = {
if(this._super("fire", arguments)) { if(this._super("fire", arguments)) {
this.weapon.stock--; this.weapon.stock--;
if( this.weapon.stock == 0 ) { if( this.weapon.stock == 0 ) {
this.weapon = new HeroWeapon(); this.weapon = new ShotgunWeapon();
$("#current_weapon").setAnimation(this.weapon.animation); $("#current_weapon").setAnimation(this.weapon.animation);
} }
} }