Feature: add 2 kinds of aliens

Refactoring: better way to manage aliens
Refatcoring: creating models and animations folders to manage independent files
This commit is contained in:
Fabrice Ecaille
2013-11-28 17:52:19 +01:00
parent cc470ba791
commit dbef43e61b
14 changed files with 765 additions and 266 deletions

45
js/animations/aliens.js Normal file
View File

@@ -0,0 +1,45 @@
var ALIENS_WIDTH = 25,
ALIENS_WIDTH_2 = 18,
ALIENS_HEIGHT = 17,
ALIENS_SPRITE = IMAGES_PREFIX + "invader.png",
ALIENS_RATE = 400;
var ALIENS_TYPE = [
{
animation : new $.gQ.Animation({
imageURL : ALIENS_SPRITE,
numberOfFrame : 2,
delta : 24,
rate : ALIENS_RATE,
type : $.gQ.ANIMATION_HORIZONTAL
}),
width : 24,
height: 18
},
{
animation : new $.gQ.Animation({
imageURL : ALIENS_SPRITE,
numberOfFrame : 2,
delta : ALIENS_WIDTH_2,
offsety : 20,
rate : ALIENS_RATE,
type : $.gQ.ANIMATION_HORIZONTAL
}),
width : ALIENS_WIDTH_2,
height: 17
},
{
animation : new $.gQ.Animation({
imageURL : ALIENS_SPRITE,
numberOfFrame : 2,
delta : ALIENS_WIDTH,
offsety : 40,
rate : ALIENS_RATE,
type : $.gQ.ANIMATION_HORIZONTAL
}),
width : ALIENS_WIDTH,
height: 18
}
]