diff --git a/guiltouf/css/style.css b/guiltouf/css/style.css index cff6a7c..9b5fb7c 100644 --- a/guiltouf/css/style.css +++ b/guiltouf/css/style.css @@ -1,3 +1,16 @@ +/* BASICS */ +.orbitron { + font-family: 'Orbitron', serif; + font-style: normal; + font-weight: 400; + text-shadow: none; + text-decoration: none; + text-transform: none; + letter-spacing: 0em; + word-spacing: 0em; + line-height: 1.2; +} + .container { width: 100%; height: 100%; @@ -104,9 +117,19 @@ /* The HUD */ #hud { z-index: 90; - display: none; } +#hud .score { + font-size:36px; + text-transform: uppercase; + color:#fff; + font-weight: bold; + text-shadow: 0 0 5px rgba(115, 171, 255, 0.4) ; + position: absolute; + display: block; + top:20px; + right: 30px; +} /* Debug Panel */ #debug { diff --git a/guiltouf/index.html b/guiltouf/index.html index 07124fb..c550539 100644 --- a/guiltouf/index.html +++ b/guiltouf/index.html @@ -2,10 +2,10 @@ +
- yep
@@ -22,7 +22,9 @@
-
+
+
Score : 0
+
diff --git a/guiltouf/js/GameClass.js b/guiltouf/js/GameClass.js index 7189e58..a576af3 100644 --- a/guiltouf/js/GameClass.js +++ b/guiltouf/js/GameClass.js @@ -1,5 +1,5 @@ // Init Global vars -var FPS = 40; +var FPS = 30; var Stages = {} ; var Level = 1 ; var Layouts = {} ; @@ -78,6 +78,42 @@ app.prototype.loopAnimation = function() { this.activeEls = [] ; // -- Detect collisions + console.log('-------------------' ) ; + for ( var i in Layouts ) { + var _layout = Layouts[i] ; + if ( _layout && _layout.running ) { + for ( var j in _layout.els ) { + var el = _layout.els[j], + type = el.name ; + + // -- Make some clean + if (el.deleteAfter ) { + delete Layouts[i].els[j] ; + } + + // -- Detect only defined types + else { + if ( type == 'ennemy' || type == 'bullet' || type == 'ship' || type == 'ship' ) { + + var pos = { + x: el.x, + y: el.y, + xX: el.x + el.with, + yY: el.x + el.with + } + + // -- Test if in viewport + //if ( pos ) + //console.log(type, coords) ; + + + + + } + } + } + } + } // -- Search for elements that have to be updated diff --git a/guiltouf/js/LayoutClass.js b/guiltouf/js/LayoutClass.js index c94389c..f87beef 100644 --- a/guiltouf/js/LayoutClass.js +++ b/guiltouf/js/LayoutClass.js @@ -162,7 +162,7 @@ Layout.prototype.createObj = function(opts) { // -- Draw object into scene Obj.prototype.draw = function() { - if ( (this.y >= -this.height) && (this.y <= (Wyrian.height+this.height)) && this.x >= -this.width && this.x <= (Wyrian.width+this.width) ) { + if ( (this.y >= -2*this.height) && (this.y <= (Wyrian.height+this.height)) && this.x >= -this.width && this.x <= (Wyrian.width+this.width) ) { // -- Set sprite to display if ( this.settings.sprites ) { diff --git a/guiltouf/js/layouts/PlayerLayer.js b/guiltouf/js/layouts/PlayerLayer.js index 50c3f12..2899257 100644 --- a/guiltouf/js/layouts/PlayerLayer.js +++ b/guiltouf/js/layouts/PlayerLayer.js @@ -5,6 +5,7 @@ Layouts.Player = new Layout({ // -- Define elements to draw with options el: [{ id: 'ship', + name: 'ship', width: 160, height: 160, sprites: [0,1], @@ -73,16 +74,16 @@ Layouts.Player.bulletLib = function(obj, bulletType) { sprites: [0,1,2], speed: 40, direction: -1, + name: 'bullet', origin: {x:0, y:0} } ; // -- Default Left - if ( bulletType == 'default' ) { + if ( bulletType == 'weapon_pilot' ) { bulletConf.width = 16 ; bulletConf.height = 64 ; bulletConf.sprites = false ; bulletConf.imageSrc = '/images/12px-long-blue.png' ; - bulletConf.name = 'bullet' ; bulletConf.origin.x = obj.x-6+obj.width/2 ; bulletConf.origin.y = obj.y - bulletConf.height ; } @@ -92,7 +93,6 @@ Layouts.Player.bulletLib = function(obj, bulletType) { bulletConf.width = 60 ; bulletConf.height = 60 ; bulletConf.speed = 20 ; - bulletConf.name = 'bullet' ; bulletConf.origin.x = obj.x+18+obj.width/2 ; bulletConf.origin.y = obj.y + 50 - bulletConf.height ; } @@ -102,7 +102,6 @@ Layouts.Player.bulletLib = function(obj, bulletType) { bulletConf.width = 60 ; bulletConf.height = 60 ; bulletConf.speed = 20 ; - bulletConf.name = 'bullet' ; bulletConf.origin.x = obj.x-75+obj.width/2 ; bulletConf.origin.y = obj.y + 50 - bulletConf.height ; } @@ -111,7 +110,7 @@ Layouts.Player.bulletLib = function(obj, bulletType) { bulletConf.animate = function(obj) { if ( obj.deleteAfter ) return false; obj.y += obj.settings.speed*obj.settings.direction ; - if ( obj.y < -obj.height ) { + if ( obj.y < -(obj.height+300) ) { obj.deleteObj() ; } } ; @@ -136,7 +135,7 @@ Layouts.Player.fire = function(obj) { // Create new bullets var bullets = [] ; - bullets.push(this.bulletLib(obj, 'default')) ; + bullets.push(this.bulletLib(obj, 'weapon_pilot')) ; bullets.push(this.bulletLib(obj, 'big_left')) ; bullets.push(this.bulletLib(obj, 'big_right')) ; for ( var i in bullets ) {