mirror of
https://github.com/Febbweiss/sis.git
synced 2026-03-05 06:35:37 +00:00
Feature: adding bonus \nRefactoring: isolation of animations
This commit is contained in:
@@ -30,121 +30,7 @@ var SHIPS = {
|
||||
cruser: {width: 30, height: 25}
|
||||
};
|
||||
|
||||
var animations = {
|
||||
hero : {
|
||||
ship : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png"
|
||||
}),
|
||||
width : 48,
|
||||
height : 24,
|
||||
posx : 0,
|
||||
posy : 17
|
||||
},
|
||||
/*cockpit : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsety : 24,
|
||||
offsetx : 20
|
||||
}),
|
||||
width : 20,
|
||||
height : 33,
|
||||
posx : 28,
|
||||
posy : 3
|
||||
},*/
|
||||
smallWheel : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 0,
|
||||
offsety : 24
|
||||
}),
|
||||
posx : 4,
|
||||
posy : 30,
|
||||
width: 14,
|
||||
height: 14
|
||||
},
|
||||
bigWheel : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 0,
|
||||
offsety : 38
|
||||
}),
|
||||
width : 19,
|
||||
height : 19,
|
||||
posx : 25,
|
||||
posy : 27
|
||||
}
|
||||
},
|
||||
alien : {
|
||||
animation : new $.gQ.Animation({
|
||||
imageURL : IMAGES_PREFIX + "invader.png",
|
||||
numberOfFrame : 2,
|
||||
delta : ALIENS_WIDTH,
|
||||
rate : 400,
|
||||
type : $.gQ.ANIMATION_HORIZONTAL
|
||||
}),
|
||||
width : ALIENS_WIDTH,
|
||||
height : ALIENS_HEIGHT
|
||||
},
|
||||
ufo : {
|
||||
animation: new $.gQ.Animation({imageURL: IMAGES_PREFIX + "ufo.png"}),
|
||||
width: 48,
|
||||
height: 32,
|
||||
posy: 10
|
||||
},
|
||||
life : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 14,
|
||||
offsety : 24
|
||||
}),
|
||||
width: 32,
|
||||
height: 16
|
||||
},
|
||||
weapons : {
|
||||
carot : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 19,
|
||||
offsety : 37
|
||||
}),
|
||||
width: 19,
|
||||
height: 19
|
||||
},
|
||||
corn : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 38,
|
||||
offsety : 37
|
||||
}),
|
||||
width: 19,
|
||||
height: 19
|
||||
},
|
||||
gun : {
|
||||
animation : new $.gameQuery.Animation({
|
||||
imageURL : IMAGES_PREFIX + "farm.png",
|
||||
offsetx : 57,
|
||||
offsety : 37
|
||||
}),
|
||||
width: 19,
|
||||
height: 19
|
||||
}
|
||||
},
|
||||
backgrounds : {
|
||||
farm: {
|
||||
background1 : {
|
||||
animation : new $.gQ.Animation({
|
||||
imageURL : IMAGES_PREFIX + "background.png"
|
||||
})
|
||||
},
|
||||
background2 : {
|
||||
animation : new $.gQ.Animation({
|
||||
imageURL : IMAGES_PREFIX + "background2.png"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var animations = WORLD.farm;
|
||||
|
||||
function updateWeaponLoad( load ) {
|
||||
"use strict";
|
||||
@@ -259,6 +145,7 @@ $(function(){
|
||||
|
||||
// Collisions management
|
||||
$.playground().registerCallback(Game.heroShotCollision, REFRESH_RATE);
|
||||
$.playground().registerCallback(Game.bonusCollision, REFRESH_RATE);
|
||||
$.playground().registerCallback(Game.alienShotCollision, REFRESH_RATE);
|
||||
|
||||
// Refresh playground
|
||||
@@ -266,6 +153,13 @@ $(function(){
|
||||
updateWeaponLoad(Game.ship.weapon.load / Game.ship.weapon.max_load);
|
||||
if( Game.running ) {
|
||||
Game.ship.move();
|
||||
$(".bonus").each( function(index, bonus) {
|
||||
var posy = $(this).y();
|
||||
if( posy < Game.ship.y + 10 ) {
|
||||
$(this).y(3, true);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, REFRESH_RATE);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user