Optimized version
This commit is contained in:
parent
f00413c676
commit
a34c32375f
6 changed files with 32 additions and 18 deletions
|
@ -18,19 +18,14 @@
|
|||
z-index: 0;
|
||||
}
|
||||
|
||||
#ground {
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
#game {
|
||||
z-index: 60;
|
||||
}
|
||||
#ground { z-index: 30; }
|
||||
#game { z-index: 60; }
|
||||
|
||||
|
||||
/* The Ship */
|
||||
#game #ship {
|
||||
position: absolute;
|
||||
display: block;
|
||||
display: none;
|
||||
top:0;
|
||||
left:0;
|
||||
background: transparent;
|
||||
|
@ -67,6 +62,21 @@
|
|||
background: transparent url(/images/sprites/weapon_pilot.png) no-repeat 0 0;
|
||||
}
|
||||
|
||||
#ship .ship-foray {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top:30px;
|
||||
left: 117px;
|
||||
width: 19px;
|
||||
height: 33px;
|
||||
background: transparent url(/images/sprites/weapon_foray.png) no-repeat 0 0;
|
||||
}
|
||||
|
||||
#ship .ship-foray.right {
|
||||
background-position: right 0;
|
||||
left: 24px;
|
||||
}
|
||||
|
||||
#ship .ship-reactor {
|
||||
position: absolute;
|
||||
display: block;
|
||||
|
@ -88,17 +98,15 @@
|
|||
}
|
||||
|
||||
/* Ennemies */
|
||||
#game .ennemy { border: 1px solid blue; }
|
||||
/*#game .ennemy { border: 1px solid blue; } */
|
||||
|
||||
|
||||
/* The HUD */
|
||||
#hud {
|
||||
z-index: 90;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#ship {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
background: white;
|
||||
}
|
||||
|
||||
/* Debug Panel */
|
||||
#debug {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.4 KiB |
|
@ -15,6 +15,8 @@
|
|||
<div class="ship-canon"></div>
|
||||
<div class="ship_reactor_fire" id="ship_reactor"></div>
|
||||
<div class="ship-reactor"></div>
|
||||
<div class="ship-foray left"></div>
|
||||
<div class ="ship-foray right"></div>
|
||||
<div class="ship-body"></div>
|
||||
<div class="wing left"></div>
|
||||
<div class="wing right"></div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Init Global vars
|
||||
var FPS = 30;
|
||||
var FPS = 40;
|
||||
var Stages = {} ;
|
||||
var Level = 1 ;
|
||||
var Layouts = {} ;
|
||||
|
@ -77,6 +77,9 @@ app.prototype.loopAnimation = function() {
|
|||
// -- Build an active elements list
|
||||
this.activeEls = [] ;
|
||||
|
||||
// -- Detect collisions
|
||||
|
||||
|
||||
// -- Search for elements that have to be updated
|
||||
for ( var i in Layouts ) {
|
||||
var _layout = Layouts[i] ;
|
||||
|
@ -91,10 +94,10 @@ app.prototype.loopAnimation = function() {
|
|||
var _el = Layouts.Ennemies.els[i] ;
|
||||
if ( ! _el.deleteAfter ) numEnnemies++ ;
|
||||
}
|
||||
$('#debug').html(numEnnemies) ;
|
||||
for ( var i = numEnnemies-1 ; i < Level + 3 ; i++ ) {
|
||||
Layouts.Ennemies.createRandom() ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -- Bind Inputs
|
||||
|
|
|
@ -132,6 +132,8 @@ Layout.prototype.createObj = function(opts) {
|
|||
backgroundImage: settingsObj.imageSrc ? 'url('+settingsObj.imageSrc+')' : ''
|
||||
}
|
||||
}).appendTo(self.dom) ;
|
||||
} else {
|
||||
this.box.show(0) ;
|
||||
}
|
||||
|
||||
// -- Apply CSS
|
||||
|
|
|
@ -18,7 +18,6 @@ Layouts.Player = new Layout({
|
|||
// -- KEY up /down
|
||||
if ( Wyrian.input.keyboard.up ) {
|
||||
if ( obj.y > 0 ) obj.y -= obj.parent.settings.speed ;
|
||||
|
||||
}
|
||||
if ( Wyrian.input.keyboard.down && (obj.y < (Wyrian.height-obj.height) ) ) {
|
||||
obj.y += obj.parent.settings.speed;
|
||||
|
@ -94,7 +93,7 @@ Layouts.Player.bulletLib = function(obj, bulletType) {
|
|||
bulletConf.height = 60 ;
|
||||
bulletConf.speed = 20 ;
|
||||
bulletConf.name = 'bullet' ;
|
||||
bulletConf.origin.x = obj.x+20+obj.width/2 ;
|
||||
bulletConf.origin.x = obj.x+18+obj.width/2 ;
|
||||
bulletConf.origin.y = obj.y + 50 - bulletConf.height ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue