Lode Runner v1.00c.2

(1) AI version 2
(2) Add God-Mode Hot-key
Cette révision appartient à :
simon_hung committed 2014-12-26 15:29:43 +08:00
1 Parent 39be5a45cf
révision e6ea80cb0a
31 files changed
+1356 -918

No files matched your search

+4 -4
Voir le fichier
@@ -1,9 +1,9 @@
<a target="_blank" href="http://goo.gl/0DrRSO">Lode Runner (超級運動員)</a> <a target="_blank" href="http://loderunnerwebgame.com/LodeRunner/">Lode Runner (超級運動員)</a>
======================================= =======================================
This program build with Javascript + [CreateJS](http://www.createjs.com). This program build with Javascript + [CreateJS](http://www.createjs.com).
This game include <b>Lode Runner</b> (150 Levels) & <b>Championship Lode Runner</b> (50 Levels). Game levels include <b>[Lode Runner (150 levels) & Championship Lode Runner (50 levels)](http://strategywiki.org/wiki/Lode_Runner/Walkthrough)</b>
### GAME Mode ### GAME Mode
<table> <table>
@@ -13,7 +13,7 @@ This game include <b>Lode Runner</b> (150 Levels) & <b>Championship Lode Runner
</tr> </tr>
<tr> <tr>
<td><b>TIME MODE</b></td> <td><b>TRAINING MODE</b></td>
<td>Player can select levels</td> <td>Player can select levels</td>
</tr> </tr>
@@ -30,6 +30,6 @@ This game include <b>Lode Runner</b> (150 Levels) & <b>Championship Lode Runner
</table> </table>
### PLAY ### PLAY
<a target="_blank" href="http://goo.gl/KgmXhh">http://loderunnerwebgame.com/game/</a> <a target="_blank" href="http://loderunnerwebgame.com/game/">http://loderunnerwebgame.com/game/</a>
------------------------------------ ------------------------------------
BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 5.7 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 2.9 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 51 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 19 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 6.3 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 4.8 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 19 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 3.7 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 2.8 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 1.7 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 32 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 11 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 5.2 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 4.4 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 16 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 5.9 KiB

BIN
Voir le fichier
Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 3.8 KiB

Après

Largeur:  |  Hauteur:  |  Taille: 739 B

+14
Voir le fichier
@@ -0,0 +1,14 @@
/*!
* @license EaselJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011-2013 gskinner.com, inc.
*
* Distributed under the terms of the MIT license.
* http://www.opensource.org/licenses/mit-license.html
*
* This notice shall be included in all copies or substantial portions of the Software.
*/
this.createjs=this.createjs||{},createjs.extend=function(a,b){"use strict";function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&&Object.getPrototypeOf(c)||c.__proto__;if(d){c[(b+="_")+"constructor"]=d.constructor;for(var e in d)c.hasOwnProperty(e)&&"function"==typeof d[e]&&(c[b+e]=d[e])}return a},this.createjs=this.createjs||{},createjs.indexOf=function(a,b){"use strict";for(var c=0,d=a.length;d>c;c++)if(b===a[c])return c;return-1},this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var b=a.prototype;b.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this._listeners=null,this._captureListeners=null}var b=a.prototype;a.initialize=function(a){a.addEventListener=b.addEventListener,a.on=b.on,a.removeEventListener=a.off=b.removeEventListener,a.removeAllEventListeners=b.removeAllEventListeners,a.hasEventListener=b.hasEventListener,a.dispatchEvent=b.dispatchEvent,a._dispatchEvent=b._dispatchEvent,a.willTrigger=b.willTrigger},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a){if("string"==typeof a){var b=this._listeners;if(!b||!b[a])return!1;a=new createjs.Event(a)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(c){}if(a.bubbles&&this.parent){for(var d=this,e=[d];d.parent;)e.push(d=d.parent);var f,g=e.length;for(f=g-1;f>=0&&!a.propagationStopped;f--)e[f]._dispatchEvent(a,1+(0==f));for(f=1;g>f&&!a.propagationStopped;f++)e[f]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;try{a.currentTarget=this}catch(f){}try{a.eventPhase=b}catch(f){}a.removed=!1,e=e.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=e[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}},createjs.EventDispatcher=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"Ticker cannot be instantiated."}a.RAF_SYNCHED="synched",a.RAF="raf",a.TIMEOUT="timeout",a.useRAF=!1,a.timingMode=null,a.maxDelta=0,a.paused=!1,a.removeEventListener=null,a.removeAllEventListeners=null,a.dispatchEvent=null,a.hasEventListener=null,a._listeners=null,createjs.EventDispatcher.initialize(a),a._addEventListener=a.addEventListener,a.addEventListener=function(){return!a._inited&&a.init(),a._addEventListener.apply(a,arguments)},a._inited=!1,a._startTime=0,a._pausedTime=0,a._ticks=0,a._pausedTicks=0,a._interval=50,a._lastTime=0,a._times=null,a._tickTimes=null,a._timerId=null,a._raf=!0,a.setInterval=function(b){a._interval=b,a._inited&&a._setupTick()},a.getInterval=function(){return a._interval},a.setFPS=function(b){a.setInterval(1e3/b)},a.getFPS=function(){return 1e3/a._interval};try{Object.defineProperties(a,{interval:{get:a.getInterval,set:a.setInterval},framerate:{get:a.getFPS,set:a.setFPS}})}catch(b){console.log(b)}a.init=function(){a._inited||(a._inited=!0,a._times=[],a._tickTimes=[],a._startTime=a._getTime(),a._times.push(a._lastTime=0),a.interval=a._interval)},a.reset=function(){if(a._raf){var b=window.cancelAnimationFrame||window.webkitCanLine truncated
d&&d.graphics&&!d.graphics.isEmpty()&&(d.getMatrix(e),b.transform(e.a,e.b,e.c,e.d,e.tx,e.ty),d.graphics.drawAsPath(b),b.clip(),e.invert(),b.transform(e.a,e.b,e.c,e.d,e.tx,e.ty)),this.getMatrix(e);var f=e.tx,g=e.ty;a._snapToPixelEnabled&&c.snapToPixel&&(f=f+(0>f?-.5:.5)|0,g=g+(0>g?-.5:.5)|0),b.transform(e.a,e.b,e.c,e.d,f,g),b.globalAlpha*=c.alpha,c.compositeOperation&&(b.globalCompositeOperation=c.compositeOperation),c.shadow&&this._applyShadow(b,c.shadow)},b.cache=function(a,b,c,d,e){e=e||1,this.cacheCanvas||(this.cacheCanvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")),this._cacheWidth=c,this._cacheHeight=d,this._cacheOffsetX=a,this._cacheOffsetY=b,this._cacheScale=e,this.updateCache()},b.updateCache=function(b){var c=this.cacheCanvas;if(!c)throw"cache() must be called before updateCache()";var d=this._cacheScale,e=this._cacheOffsetX*d,f=this._cacheOffsetY*d,g=this._cacheWidth,h=this._cacheHeight,i=c.getContext("2d"),j=this._getFilterBounds();e+=this._filterOffsetX=j.x,f+=this._filterOffsetY=j.y,g=Math.ceil(g*d)+j.width,h=Math.ceil(h*d)+j.height,g!=c.width||h!=c.height?(c.width=g,c.height=h):b||i.clearRect(0,0,g+1,h+1),i.save(),i.globalCompositeOperation=b,i.setTransform(d,0,0,d,-e,-f),this.draw(i,!0),this._applyFilters(),i.restore(),this.cacheID=a._nextCacheID++},b.uncache=function(){this._cacheDataURL=this.cacheCanvas=null,this.cacheID=this._cacheOffsetX=this._cacheOffsetY=this._filterOffsetX=this._filterOffsetY=0,this._cacheScale=1},b.getCacheDataURL=function(){return this.cacheCanvas?(this.cacheID!=this._cacheDataURLID&&(this._cacheDataURL=this.cacheCanvas.toDataURL()),this._cacheDataURL):null},b.localToGlobal=function(a,b,c){return this.getConcatenatedMatrix(this._props.matrix).transformPoint(a,b,c||new createjs.Point)},b.globalToLocal=function(a,b,c){return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(a,b,c||new createjs.Point)},b.localToLocal=function(a,b,c,d){return d=this.localToGlobal(a,b,d),c.globalToLocal(d.x,d.y,d)},b.setTransform=function(a,b,c,d,e,f,g,h,i){return this.x=a||0,this.y=b||0,this.scaleX=null==c?1:c,this.scaleY=null==d?1:d,this.rotation=e||0,this.skewX=f||0,this.skewY=g||0,this.regX=h||0,this.regY=i||0,this},b.getMatrix=function(a){var b=this,c=a&&a.identity()||new createjs.Matrix2D;return b.transformMatrix?c.copy(b.transformMatrix):c.appendTransform(b.x,b.y,b.scaleX,b.scaleY,b.rotation,b.skewX,b.skewY,b.regX,b.regY)},b.getConcatenatedMatrix=function(a){for(var b=this,c=this.getMatrix(a);b=b.parent;)c.prependMatrix(b.getMatrix(b._props.matrix));return c},b.getConcatenatedDisplayProps=function(a){a=a?a.identity():new createjs.DisplayProps;var b=this,c=b.getMatrix(a.matrix);do a.prepend(b.visible,b.alpha,b.shadow,b.compositeOperation),b!=this&&c.prependMatrix(b.getMatrix(b._props.matrix));while(b=b.parent);return a},b.hitTest=function(b,c){var d=a._hitTestContext;d.setTransform(1,0,0,1,-b,-c),this.draw(d);var e=this._testHit(d);return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,2,2),e},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.getBounds=function(){if(this._bounds)return this._rectangle.copy(this._bounds);var a=this.cacheCanvas;if(a){var b=this._cacheScale;return this._rectangle.setValues(this._cacheOffsetX,this._cacheOffsetY,a.width/b,a.height/b)}return null},b.getTransformedBounds=function(){return this._getBounds()},b.setBounds=function(a,b,c,d){null==a&&(this._bounds=a),this._bounds=(this._bounds||new createjs.Rectangle).setValues(a,b,c,d)},b.clone=function(){return this._cloneProps(new a)},b.toString=function(){return"[DisplayObject (name="+this.name+")]"},b._cloneProps=function(a){return a.alpha=this.alpha,a.mouseEnabled=this.mouseEnabled,a.tickEnabled=this.tickEnabled,a.name=this.name,a.regX=this.regX,a.regY=this.regY,a.rotation=this.rotation,a.scaleX=this.scaleX,a.scaleY=this.scaleY,a.shadow=this.shadow,a.skewX=this.skewX,a.skewY=this.skewY,a.visible=this.visible,a.x=this.x,a.y=this.y,a.compositeOperation=this.compositeOperation,a.snapToPixel=this.snapToPixel,a.filters=null==this.filters?null:this.filters.slice(0),a.mask=this.mask,a.hitArea=this.hitArea,a.cursor=this.cursor,a._bounds=this._bounds,a},b._applyShadow=function(a,b){b=b||Shadow.identity,a.shadowColor=b.color,a.shadowOffsetX=b.offsetX,a.shadowOffsetY=b.offsetY,a.shadowBlur=b.blur},b._tick=function(a){var b=this._listeners;b&&b.tick&&(a.target=null,a.propagationStopped=a.immediatePropagationStopped=!1,this.dispatchEvent(a))},b._testHit=function(b){try{var c=b.getImageData(0,0,1,1).data[3]>1}catch(d){if(!a.suppressCrossDomainErrors)throw"An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."}return c},b._applyFilters=function(){if(this.filters&&0!=this.filters.length&&this.cacheCanvas)for(var a=this.filters.length,b=this.cacheCanvas.getContext("2d"),c=this.cacheCanvas.width,d=this.cacheCanvas.height,e=0;a>e;e++)this.filters[e].applyFilter(b,0,0,c,d)},b._getLine truncated
}var b=createjs.extend(a,createjs.EventDispatcher);a.ERR_DIMENSIONS="frame dimensions exceed max spritesheet dimensions",a.ERR_RUNNING="a build is already running",b.addFrame=function(b,c,d,e,f){if(this._data)throw a.ERR_RUNNING;var g=c||b.bounds||b.nominalBounds;return!g&&b.getBounds&&(g=b.getBounds()),g?(d=d||1,this._frames.push({source:b,sourceRect:g,scale:d,funct:e,data:f,index:this._frames.length,height:g.height*d})-1):null},b.addAnimation=function(b,c,d,e){if(this._data)throw a.ERR_RUNNING;this._animations[b]={frames:c,next:d,frequency:e}},b.addMovieClip=function(b,c,d,e,f,g){if(this._data)throw a.ERR_RUNNING;var h=b.frameBounds,i=c||b.bounds||b.nominalBounds;if(!i&&b.getBounds&&(i=b.getBounds()),i||h){var j,k,l=this._frames.length,m=b.timeline.duration;for(j=0;m>j;j++){var n=h&&h[j]?h[j]:i;this.addFrame(b,n,d,this._setupMovieClipFrame,{i:j,f:e,d:f})}var o=b.timeline._labels,p=[];for(var q in o)p.push({index:o[q],label:q});if(p.length)for(p.sort(function(a,b){return a.index-b.index}),j=0,k=p.length;k>j;j++){for(var r=p[j].label,s=l+p[j].index,t=l+(j==k-1?m:p[j+1].index),u=[],v=s;t>v;v++)u.push(v);(!g||(r=g(r,b,s,t)))&&this.addAnimation(r,u,!0)}}},b.build=function(){if(this._data)throw a.ERR_RUNNING;for(this._startBuild();this._drawNext(););return this._endBuild(),this.spriteSheet},b.buildAsync=function(b){if(this._data)throw a.ERR_RUNNING;this.timeSlice=b,this._startBuild();var c=this;this._timerID=setTimeout(function(){c._run()},50-50*Math.max(.01,Math.min(.99,this.timeSlice||.3)))},b.stopAsync=function(){clearTimeout(this._timerID),this._data=null},b.clone=function(){throw"SpriteSheetBuilder cannot be cloned."},b.toString=function(){return"[SpriteSheetBuilder]"},b._startBuild=function(){var b=this.padding||0;this.progress=0,this.spriteSheet=null,this._index=0,this._scale=this.scale;var c=[];this._data={images:[],frames:c,animations:this._animations};var d=this._frames.slice();if(d.sort(function(a,b){return a.height<=b.height?-1:1}),d[d.length-1].height+2*b>this.maxHeight)throw a.ERR_DIMENSIONS;for(var e=0,f=0,g=0;d.length;){var h=this._fillRow(d,e,g,c,b);if(h.w>f&&(f=h.w),e+=h.h,!h.h||!d.length){var i=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");i.width=this._getSize(f,this.maxWidth),i.height=this._getSize(e,this.maxHeight),this._data.images[g]=i,h.h||(f=e=0,g++)}}},b._setupMovieClipFrame=function(a,b){var c=a.actionsEnabled;a.actionsEnabled=!1,a.gotoAndStop(b.i),a.actionsEnabled=c,b.f&&b.f(a,b.d,b.i)},b._getSize=function(a,b){for(var c=4;Math.pow(2,++c)<a;);return Math.min(b,Math.pow(2,c))},b._fillRow=function(b,c,d,e,f){var g=this.maxWidth,h=this.maxHeight;c+=f;for(var i=h-c,j=f,k=0,l=b.length-1;l>=0;l--){var m=b[l],n=this._scale*m.scale,o=m.sourceRect,p=m.source,q=Math.floor(n*o.x-f),r=Math.floor(n*o.y-f),s=Math.ceil(n*o.height+2*f),t=Math.ceil(n*o.width+2*f);if(t>g)throw a.ERR_DIMENSIONS;s>i||j+t>g||(m.img=d,m.rect=new createjs.Rectangle(j,c,t,s),k=k||s,b.splice(l,1),e[m.index]=[j,c,t,s,d,Math.round(-q+n*p.regX-f),Math.round(-r+n*p.regY-f)],j+=t)}return{w:j,h:k}},b._endBuild=function(){this.spriteSheet=new createjs.SpriteSheet(this._data),this._data=null,this.progress=1,this.dispatchEvent("complete")},b._run=function(){for(var a=50*Math.max(.01,Math.min(.99,this.timeSlice||.3)),b=(new Date).getTime()+a,c=!1;b>(new Date).getTime();)if(!this._drawNext()){c=!0;break}if(c)this._endBuild();else{var d=this;this._timerID=setTimeout(function(){d._run()},50-a)}var e=this.progress=this._index/this._frames.length;if(this.hasEventListener("progress")){var f=new createjs.Event("progress");f.progress=e,this.dispatchEvent(f)}},b._drawNext=function(){var a=this._frames[this._index],b=a.scale*this._scale,c=a.rect,d=a.sourceRect,e=this._data.images[a.img],f=e.getContext("2d");return a.funct&&a.funct(a.source,a.data),f.save(),f.beginPath(),f.rect(c.x,c.y,c.width,c.height),f.clip(),f.translate(Math.ceil(c.x-d.x*b),Math.ceil(c.y-d.y*b)),f.scale(b,b),a.source.draw(f),f.restore(),++this._index<this._frames.length},createjs.SpriteSheetBuilder=createjs.promote(a,"EventDispatcher")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.DisplayObject_constructor(),"string"==typeof a&&(a=document.getElementById(a)),this.mouseEnabled=!1;var b=a.style;b.position="absolute",b.transformOrigin=b.WebkitTransformOrigin=b.msTransformOrigin=b.MozTransformOrigin=b.OTransformOrigin="0% 0%",this.htmlElement=a,this._oldProps=null}var b=createjs.extend(a,createjs.DisplayObject);b.isVisible=function(){return null!=this.htmlElement},b.draw=function(){return!0},b.cache=function(){},b.uncache=function(){},b.updateCache=function(){},b.hitTest=function(){},b.localToGlobal=function(){},b.globalToLocal=function(){},b.localToLocal=function(){},b.clone=function(){throw"DOMElement cannot be cloned."},b.toString=function(){return"[DOMElement (name="+this.name+")]"},b._tick=function(a){var b=this.getStage();b&&b.on("drawend",this._handleDrawEnd,this,!0),this.DisplayObject__tick(a)},b._handleDLine truncated
+13
Voir le fichier
@@ -0,0 +1,13 @@
/*!
* @license PreloadJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011-2013 gskinner.com, inc.
*
* Distributed under the terms of the MIT license.
* http://www.opensource.org/licenses/mit-license.html
*
* This notice shall be included in all copies or substantial portions of the Software.
*/
this.createjs=this.createjs||{},function(){"use strict";var a=createjs.PreloadJS=createjs.PreloadJS||{};a.version="0.6.0",a.buildDate="Thu, 11 Dec 2014 23:32:09 GMT"}(),this.createjs=this.createjs||{},createjs.extend=function(a,b){"use strict";function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&&Object.getPrototypeOf(c)||c.__proto__;if(d){c[(b+="_")+"constructor"]=d.constructor;for(var e in d)c.hasOwnProperty(e)&&"function"==typeof d[e]&&(c[b+e]=d[e])}return a},this.createjs=this.createjs||{},createjs.indexOf=function(a,b){"use strict";for(var c=0,d=a.length;d>c;c++)if(b===a[c])return c;return-1},this.createjs=this.createjs||{},function(){"use strict";createjs.proxy=function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,Array.prototype.slice.call(arguments,0).concat(c))}}}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"BrowserDetect cannot be instantiated"}var b=a.agent=window.navigator.userAgent;a.isWindowPhone=b.indexOf("IEMobile")>-1||b.indexOf("Windows Phone")>-1,a.isFirefox=b.indexOf("Firefox")>-1,a.isOpera=null!=window.opera,a.isChrome=b.indexOf("Chrome")>-1,a.isIOS=(b.indexOf("iPod")>-1||b.indexOf("iPhone")>-1||b.indexOf("iPad")>-1)&&!a.isWindowPhone,a.isAndroid=b.indexOf("Android")>-1&&!a.isWindowPhone,a.isBlackberry=b.indexOf("Blackberry")>-1,createjs.BrowserDetect=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var b=a.prototype;b.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.Event_constructor("error"),this.title=a,this.message=b,this.data=c}var b=createjs.extend(a,createjs.Event);b.clone=function(){return new createjs.ErrorEvent(this.title,this.message,this.data)},createjs.ErrorEvent=createjs.promote(a,"Event")}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this._listeners=null,this._captureListeners=null}var b=a.prototype;a.initialize=function(a){a.addEventListener=b.addEventListener,a.on=b.on,a.removeEventListener=a.off=b.removeEventListener,a.removeAllEventListeners=b.removeAllEventListeners,a.hasEventListener=b.hasEventListener,a.dispatchEvent=b.dispatchEvent,a._dispatchEvent=b._dispatchEvent,a.willTrigger=b.willTrigger},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a){if("string"==typeof a){var b=this._listeners;if(!b||!b[a])return!1;a=new createjs.Event(a)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(c){}if(a.bubbles&&this.parent){for(var d=this,e=[d];d.parent;)e.push(d=d.parent);var f,g=e.length;for(f=g-1;f>=0&&!a.propagationStopped;f--)e[f]._dispatchEvent(a,1+(0==f));for(f=1;g>f&&!a.propagationStopped;f++)e[f]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;try{a.currentTarget=this}catch(f){}try{a.eventPhase=b}catch(f){}a.removed=!1,e=e.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=e[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}},createjs.EventDispLine truncated
else for(var f=this._currentLoads.length-1;f>=0;f--){var g=this._currentLoads[f].getItem();if(g.id==d||g.src==d){this._currentLoads.splice(f,1)[0].cancel(),c=!0;break}}}c&&this._loadNext()}else{this.close();for(var h in this._loadItemsById)this._disposeItem(this._loadItemsById[h]);this.init(this.preferXHR,this._basePath)}},b.reset=function(){this.close();for(var a in this._loadItemsById)this._disposeItem(this._loadItemsById[a]);for(var b=[],c=0,d=this._loadQueueBackup.length;d>c;c++)b.push(this._loadQueueBackup[c].getItem());this.loadManifest(b,!1)},b.installPlugin=function(a){if(null!=a&&null!=a.getPreloadHandlers){var b=a.getPreloadHandlers();if(b.scope=a,null!=b.types)for(var c=0,d=b.types.length;d>c;c++)this._typeCallbacks[b.types[c]]=b;if(null!=b.extensions)for(c=0,d=b.extensions.length;d>c;c++)this._extensionCallbacks[b.extensions[c]]=b}},b.setMaxConnections=function(a){this._maxConnections=a,!this._paused&&this._loadQueue.length>0&&this._loadNext()},b.loadFile=function(a,b,c){if(null==a){var d=new createjs.ErrorEvent("PRELOAD_NO_FILE");return void this._sendError(d)}this._addItem(a,null,c),this.setPaused(b!==!1?!1:!0)},b.loadManifest=function(a,b,d){var e=null,f=null;if(a instanceof Array){if(0==a.length){var g=new createjs.ErrorEvent("PRELOAD_MANIFEST_EMPTY");return void this._sendError(g)}e=a}else if("string"==typeof a)e=[{src:a,type:c.MANIFEST}];else{if("object"!=typeof a){var g=new createjs.ErrorEvent("PRELOAD_MANIFEST_NULL");return void this._sendError(g)}if(void 0!==a.src){if(null==a.type)a.type=c.MANIFEST;else if(a.type!=c.MANIFEST){var g=new createjs.ErrorEvent("PRELOAD_MANIFEST_TYPE");this._sendError(g)}e=[a]}else void 0!==a.manifest&&(e=a.manifest,f=a.path)}for(var h=0,i=e.length;i>h;h++)this._addItem(e[h],f,d);this.setPaused(b!==!1?!1:!0)},b.load=function(){this.setPaused(!1)},b.getItem=function(a){return this._loadItemsById[a]||this._loadItemsBySrc[a]},b.getResult=function(a,b){var c=this._loadItemsById[a]||this._loadItemsBySrc[a];if(null==c)return null;var d=c.id;return b&&this._loadedRawResults[d]?this._loadedRawResults[d]:this._loadedResults[d]},b.getItems=function(a){for(var b=[],c=0,d=this._loadQueueBackup.length;d>c;c++){var e=this._loadQueueBackup[c],f=e.getItem();(a!==!0||e.loaded)&&b.push({item:f,result:this.getResult(f.id),rawResult:this.getResult(f.id,!0)})}return b},b.setPaused=function(a){this._paused=a,this._paused||this._loadNext()},b.close=function(){for(;this._currentLoads.length;)this._currentLoads.pop().cancel();this._scriptOrder.length=0,this._loadedScripts.length=0,this.loadStartWasDispatched=!1,this._itemCount=0,this._lastProgress=0/0},b._addItem=function(a,b,c){var d=this._createLoadItem(a,b,c);if(null!=d){var e=this._createLoader(d);null!=e&&(d._loader=e,this._loadQueue.push(e),this._loadQueueBackup.push(e),this._numItems++,this._updateProgress(),(this.maintainScriptOrder&&d.type==createjs.LoadQueue.JAVASCRIPT||d.maintainOrder===!0)&&(this._scriptOrder.push(d),this._loadedScripts.push(null)))}},b._createLoadItem=function(a,b,d){var e=createjs.LoadItem.create(a);if(null==e)return null;var f=createjs.RequestUtils.parseURI(e.src);f.extension&&(e.ext=f.extension),null==e.type&&(e.type=createjs.RequestUtils.getTypeByExtension(e.ext));var g="",h=d||this._basePath,i=e.src;if(!f.absolute&&!f.relative)if(b){g=b;var j=createjs.RequestUtils.parseURI(b);i=b+i,null==h||j.absolute||j.relative||(g=h+g)}else null!=h&&(g=h);e.src=g+e.src,e.path=g,(void 0===e.id||null===e.id||""===e.id)&&(e.id=i);var k=this._typeCallbacks[e.type]||this._extensionCallbacks[e.ext];if(k){var l=k.callback.call(k.scope,e,this);if(l===!1)return null;l===!0||null!=l&&(e._loader=l),f=createjs.RequestUtils.parseURI(e.src),null!=f.extension&&(e.ext=f.extension)}return this._loadItemsById[e.id]=e,this._loadItemsBySrc[e.src]=e,null==e.loadTimeout&&(e.loadTimeout=c.loadTimeout),null==e.crossOrigin&&(e.crossOrigin=this._crossOrigin),e},b._createLoader=function(a){if(null!=a._loader)return a._loader;for(var b=this.preferXHR,c=0;c<this._availableLoaders.length;c++){var d=this._availableLoaders[c];if(d&&d.canLoadItem(a))return new d(a,b)}return null},b._loadNext=function(){if(!this._paused){this._loadStartWasDispatched||(this._sendLoadStart(),this._loadStartWasDispatched=!0),this._numItems==this._numItemsLoaded?(this.loaded=!0,this._sendComplete(),this.next&&this.next.load&&this.next.load()):this.loaded=!1;for(var a=0;a<this._loadQueue.length&&!(this._currentLoads.length>=this._maxConnections);a++){var b=this._loadQueue[a];this._canStartLoad(b)&&(this._loadQueue.splice(a,1),a--,this._loadItem(b))}}},b._loadItem=function(a){a.on("fileload",this._handleFileLoad,this),a.on("progress",this._handleProgress,this),a.on("complete",this._handleFileComplete,this),a.on("error",this._handleError,this),a.on("fileerror",this._handleFileError,this),this._currentLoads.push(a),this._sendFileStart(a.getItem()),a.load()},b._handleFileLoad=function(a){a.target=null,this.dispatchEvent(a)},b._handleFileError=function(a){var b=new createLine truncated
+18
Voir le fichier
@@ -0,0 +1,18 @@
/*!
* @license SoundJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011-2013 gskinner.com, inc.
*
* Distributed under the terms of the MIT license.
* http://www.opensource.org/licenses/mit-license.html
*
* This notice shall be included in all copies or substantial portions of the Software.
*/
/**!
* SoundJS FlashAudioPlugin also includes swfobject (http://code.google.com/p/swfobject/)
*/
this.createjs=this.createjs||{},function(){var a=createjs.SoundJS=createjs.SoundJS||{};a.version="0.6.0",a.buildDate="Thu, 11 Dec 2014 23:32:09 GMT"}(),this.createjs=this.createjs||{},createjs.extend=function(a,b){"use strict";function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&&Object.getPrototypeOf(c)||c.__proto__;if(d){c[(b+="_")+"constructor"]=d.constructor;for(var e in d)c.hasOwnProperty(e)&&"function"==typeof d[e]&&(c[b+e]=d[e])}return a},this.createjs=this.createjs||{},createjs.indexOf=function(a,b){"use strict";for(var c=0,d=a.length;d>c;c++)if(b===a[c])return c;return-1},this.createjs=this.createjs||{},function(){"use strict";createjs.proxy=function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,Array.prototype.slice.call(arguments,0).concat(c))}}}(),this.createjs=this.createjs||{},function(){"use strict";var a=Object.defineProperty?!0:!1,b={};try{Object.defineProperty(b,"bar",{get:function(){return this._bar},set:function(a){this._bar=a}})}catch(c){a=!1}createjs.definePropertySupported=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"BrowserDetect cannot be instantiated"}var b=a.agent=window.navigator.userAgent;a.isWindowPhone=b.indexOf("IEMobile")>-1||b.indexOf("Windows Phone")>-1,a.isFirefox=b.indexOf("Firefox")>-1,a.isOpera=null!=window.opera,a.isChrome=b.indexOf("Chrome")>-1,a.isIOS=(b.indexOf("iPod")>-1||b.indexOf("iPhone")>-1||b.indexOf("iPad")>-1)&&!a.isWindowPhone,a.isAndroid=b.indexOf("Android")>-1&&!a.isWindowPhone,a.isBlackberry=b.indexOf("Blackberry")>-1,createjs.BrowserDetect=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this._listeners=null,this._captureListeners=null}var b=a.prototype;a.initialize=function(a){a.addEventListener=b.addEventListener,a.on=b.on,a.removeEventListener=a.off=b.removeEventListener,a.removeAllEventListeners=b.removeAllEventListeners,a.hasEventListener=b.hasEventListener,a.dispatchEvent=b.dispatchEvent,a._dispatchEvent=b._dispatchEvent,a.willTrigger=b.willTrigger},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a){if("string"==typeof a){var b=this._listeners;if(!b||!b[a])return!1;a=new createjs.Event(a)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(c){}if(a.bubbles&&this.parent){for(var d=this,e=[d];d.parent;)e.push(d=d.parent);var f,g=e.length;for(f=g-1;f>=0&&!a.propagationStopped;f--)e[f]._dispatchEvent(a,1+(0==f));for(f=1;g>f&&!a.propagationStopped;f++)e[f]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;try{a.currentTarget=this}catch(f){}try{a.eventPhase=b}catch(f){}a.removed=!1,e=e.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=e[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}},createjs.EventDispatcher=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var b=a.prototype;b.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.EveLine truncated
},b=createjs.extend(a,createjs.EventDispatcher);b.play=function(a,b,c,d,e,f){return this.playState==createjs.Sound.PLAY_SUCCEEDED?(a instanceof Object&&(c=a.offset,d=a.loop,e=a.volume,f=a.pan),null!=c&&this.setPosition(c),null!=d&&this.setLoop(d),null!=e&&this.setVolume(e),null!=f&&this.setPan(f),void(this._paused&&this.setPaused(!1))):(this._cleanUp(),createjs.Sound._playInstance(this,a,b,c,d,e,f),this)},b.pause=function(){return this._paused||this.playState!=createjs.Sound.PLAY_SUCCEEDED?!1:(this.setPaused(!0),!0)},b.resume=function(){return this._paused?(this.setPaused(!1),!0):!1},b.stop=function(){return this._position=0,this._paused=!1,this._handleStop(),this._cleanUp(),this.playState=createjs.Sound.PLAY_FINISHED,this},b.destroy=function(){this._cleanUp(),this.src=null,this.playbackResource=null,this.removeAllEventListeners()},b.toString=function(){return"[AbstractSoundInstance]"},b.getPaused=function(){return this._paused},b.setPaused=function(a){return a!==!0&&a!==!1||this._paused==a||1==a&&this.playState!=createjs.Sound.PLAY_SUCCEEDED?void 0:(this._paused=a,a?this._pause():this._resume(),clearTimeout(this.delayTimeoutId),this)},b.setVolume=function(a){return a==this._volume?this:(this._volume=Math.max(0,Math.min(1,a)),this._muted||this._updateVolume(),this)},b.getVolume=function(){return this._volume},b.setMute=function(a){this.setMuted(a)},b.getMute=function(){return this._muted},b.setMuted=function(a){return a===!0||a===!1?(this._muted=a,this._updateVolume(),this):void 0},b.getMuted=function(){return this._muted},b.setPan=function(a){return a==this._pan?this:(this._pan=Math.max(-1,Math.min(1,a)),this._updatePan(),this)},b.getPan=function(){return this._pan},b.getPosition=function(){return this._paused||this.playState!=createjs.Sound.PLAY_SUCCEEDED?this._position:this._calculateCurrentPosition()},b.setPosition=function(a){return this._position=Math.max(0,a),this.playState==createjs.Sound.PLAY_SUCCEEDED&&this._updatePosition(),this},b.getDuration=function(){return this._duration},b.setDuration=function(a){return a==this._duration?this:(this._duration=Math.max(0,a||0),this._updateDuration(),this)},b.setPlaybackResource=function(a){return this._playbackResource=a,0==this._duration&&this._setDurationFromSource(),this},b.getPlaybackResource=function(){return this._playbackResource},b.getLoop=function(){return this._loop},b.setLoop=function(a){null!=this._playbackResource&&(0!=this._loop&&0==a&&this._removeLooping(a),0==this._loop&&0!=a&&this._addLooping(a)),this._loop=a},b._sendEvent=function(a){var b=new createjs.Event(a);this.dispatchEvent(b)},b._cleanUp=function(){clearTimeout(this.delayTimeoutId),this._handleCleanUp(),this._paused=!1,createjs.Sound._playFinished(this)},b._interrupt=function(){this._cleanUp(),this.playState=createjs.Sound.PLAY_INTERRUPTED,this._sendEvent("interrupted")},b._beginPlaying=function(a,b,c,d){return this.setPosition(a),this.setLoop(b),this.setVolume(c),this.setPan(d),null!=this._playbackResource&&this._position<this._duration?(this._paused=!1,this._handleSoundReady(),this.playState=createjs.Sound.PLAY_SUCCEEDED,this._sendEvent("succeeded"),!0):(this._playFailed(),!1)},b._playFailed=function(){this._cleanUp(),this.playState=createjs.Sound.PLAY_FAILED,this._sendEvent("failed")},b._handleSoundComplete=function(){return this._position=0,0!=this._loop?(this._loop--,this._handleLoop(),void this._sendEvent("loop")):(this._cleanUp(),this.playState=createjs.Sound.PLAY_FINISHED,void this._sendEvent("complete"))},b._handleSoundReady=function(){},b._updateVolume=function(){},b._updatePan=function(){},b._updateDuration=function(){},b._setDurationFromSource=function(){},b._calculateCurrentPosition=function(){},b._updatePosition=function(){},b._removeLooping=function(){},b._addLooping=function(){},b._pause=function(){},b._resume=function(){},b._handleStop=function(){},b._handleCleanUp=function(){},b._handleLoop=function(){},createjs.AbstractSoundInstance=createjs.promote(a,"EventDispatcher"),createjs.DefaultSoundInstance=createjs.AbstractSoundInstance}(),this.createjs=this.createjs||{},function(){"use strict";var a=function(){this._capabilities=null,this._loaders={},this._audioSources={},this._soundInstances={},this._loaderClass,this._soundInstanceClass},b=a.prototype;a._capabilities=null,a.isSupported=function(){return!0},b.register=function(a){if(this._audioSources[a.src]=!0,this._soundInstances[a.src]=[],this._loaders[a.src])return this._loaders[a.src];var b=new this._loaderClass(a);return b.on("complete",createjs.proxy(this._handlePreloadComplete,this)),this._loaders[a.src]=b,b},b.preload=function(a){a.on("error",createjs.proxy(this._handlePreloadError,this)),a.load()},b.isPreloadStarted=function(a){return null!=this._audioSources[a]},b.isPreloadComplete=function(a){return!(null==this._audioSources[a]||1==this._audioSources[a])},b.removeSound=function(a){if(this._soundInstances[a]){for(var b=this._soundInstances[a].length;b--;){var c=this._soundInstances[a][b];c.destroy()}delete thiLine truncated
+12
Voir le fichier
@@ -0,0 +1,12 @@
/*!
* @license TweenJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011-2013 gskinner.com, inc.
*
* Distributed under the terms of the MIT license.
* http://www.opensource.org/licenses/mit-license.html
*
* This notice shall be included in all copies or substantial portions of the Software.
*/
this.createjs=this.createjs||{},createjs.extend=function(a,b){"use strict";function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&&Object.getPrototypeOf(c)||c.__proto__;if(d){c[(b+="_")+"constructor"]=d.constructor;for(var e in d)c.hasOwnProperty(e)&&"function"==typeof d[e]&&(c[b+e]=d[e])}return a},this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var b=a.prototype;b.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this._listeners=null,this._captureListeners=null}var b=a.prototype;a.initialize=function(a){a.addEventListener=b.addEventListener,a.on=b.on,a.removeEventListener=a.off=b.removeEventListener,a.removeAllEventListeners=b.removeAllEventListeners,a.hasEventListener=b.hasEventListener,a.dispatchEvent=b.dispatchEvent,a._dispatchEvent=b._dispatchEvent,a.willTrigger=b.willTrigger},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a){if("string"==typeof a){var b=this._listeners;if(!b||!b[a])return!1;a=new createjs.Event(a)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(c){}if(a.bubbles&&this.parent){for(var d=this,e=[d];d.parent;)e.push(d=d.parent);var f,g=e.length;for(f=g-1;f>=0&&!a.propagationStopped;f--)e[f]._dispatchEvent(a,1+(0==f));for(f=1;g>f&&!a.propagationStopped;f++)e[f]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;try{a.currentTarget=this}catch(f){}try{a.eventPhase=b}catch(f){}a.removed=!1,e=e.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=e[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}},createjs.EventDispatcher=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"Ticker cannot be instantiated."}a.RAF_SYNCHED="synched",a.RAF="raf",a.TIMEOUT="timeout",a.useRAF=!1,a.timingMode=null,a.maxDelta=0,a.paused=!1,a.removeEventListener=null,a.removeAllEventListeners=null,a.dispatchEvent=null,a.hasEventListener=null,a._listeners=null,createjs.EventDispatcher.initialize(a),a._addEventListener=a.addEventListener,a.addEventListener=function(){return!a._inited&&a.init(),a._addEventListener.apply(a,arguments)},a._inited=!1,a._startTime=0,a._pausedTime=0,a._ticks=0,a._pausedTicks=0,a._interval=50,a._lastTime=0,a._times=null,a._tickTimes=null,a._timerId=null,a._raf=!0,a.setInterval=function(b){a._interval=b,a._inited&&a._setupTick()},a.getInterval=function(){return a._interval},a.setFPS=function(b){a.setInterval(1e3/b)},a.getFPS=function(){return 1e3/a._interval};try{Object.defineProperties(a,{interval:{get:a.getInterval,set:a.setInterval},framerate:{get:a.getFPS,set:a.setFPS}})}catch(b){console.log(b)}a.init=function(){a._inited||(a._inited=!0,a._times=[],a._tickTimes=[],a._startTime=a._getTime(),a._times.push(a._lastTime=0),a.interval=a._interval)},a.reset=function(){if(a._raf){var b=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame;b&&b(a._timerId)}else clearLine truncated
+5 -2
Voir le fichier
@@ -1,5 +1,5 @@
var VERSION = "0.99n"; var VERSION = "1.00c";
var AI_VERSION = 1; var AI_VERSION = 2;
var NO_OF_TILES_X = 28, var NO_OF_TILES_X = 28,
NO_OF_TILES_Y = 16; NO_OF_TILES_Y = 16;
@@ -31,6 +31,8 @@ var KEYCODE_BKSPACE = 8, //backspace
KEYCODE_UP = 38, //move up KEYCODE_UP = 38, //move up
KEYCODE_DOWN = 40, //move down KEYCODE_DOWN = 40, //move down
KEYCODE_SUBTRACT = 109, //Add KEYCODE_SUBTRACT & KEYCODE_HYPHEN for support fireFox 'dash' keycode
KEYCODE_HYPHEN = 173, //
KEYCODE_DASH = 189, //'-' KEYCODE_DASH = 189, //'-'
KEYCODE_DOT = 190, //'.' KEYCODE_DOT = 190, //'.'
@@ -47,6 +49,7 @@ var KEYCODE_BKSPACE = 8, //backspace
KEYCODE_A = 65, //'A' KEYCODE_A = 65, //'A'
KEYCODE_C = 67, //'C' KEYCODE_C = 67, //'C'
KEYCODE_G = 71, //'G'
KEYCODE_R = 82, //'R' KEYCODE_R = 82, //'R'
KEYCODE_S = 83, //'S' KEYCODE_S = 83, //'S'
KEYCODE_T = 84, //'T' KEYCODE_T = 84, //'T'
+28 -4
Voir le fichier
@@ -49,6 +49,10 @@ function getAutoDemoLevel(initValue)
demoGoldDrop = demoData[idx].goldDrop; demoGoldDrop = demoData[idx].goldDrop;
demoBornPos = demoData[idx].bornPos; demoBornPos = demoData[idx].bornPos;
curLevel = demoData[idx].level; curLevel = demoData[idx].level;
curAiVersion = demoData[idx].ai; //07/04/2014
if("godMode" in demoData[idx])
godMode = demoData[idx].godMode; //07/09/2014
} }
var demoCountTime = 0, demoCountEnable = 0; var demoCountTime = 0, demoCountEnable = 0;
@@ -149,6 +153,10 @@ function initDemoInfo()
demoGoldDrop = demoData[idx].goldDrop; demoGoldDrop = demoData[idx].goldDrop;
demoBornPos = demoData[idx].bornPos; demoBornPos = demoData[idx].bornPos;
assert(curLevel == demoData[idx].level, "curLevel != level of demoData"); assert(curLevel == demoData[idx].level, "curLevel != level of demoData");
curAiVersion = demoData[idx].ai; //07/04/2014
if("godMode" in demoData[idx])
godMode = demoData[idx].godMode; //07/09/2014
} }
function getDemoInfo() function getDemoInfo()
@@ -229,7 +237,8 @@ function updatePlayerDemoData(playData, demoDataInfo)
state: demoDataInfo.state, state: demoDataInfo.state,
action: demoDataInfo.action, action: demoDataInfo.action,
goldDrop: demoDataInfo.goldDrop, goldDrop: demoDataInfo.goldDrop,
bornPos: demoDataInfo.bornPos bornPos: demoDataInfo.bornPos,
godMode: demoDataInfo.godMode //07/09/2014
}; };
} else { // always update local data } else { // always update local data
//if( playerDemoData[level-1].time >= demoDataInfo.time) { //only udate best time //if( playerDemoData[level-1].time >= demoDataInfo.time) { //only udate best time
@@ -242,6 +251,8 @@ function updatePlayerDemoData(playData, demoDataInfo)
playerDemoData[level-1].action = demoDataInfo.action; playerDemoData[level-1].action = demoDataInfo.action;
playerDemoData[level-1].goldDrop = demoDataInfo.goldDrop; playerDemoData[level-1].goldDrop = demoDataInfo.goldDrop;
playerDemoData[level-1].bornPos = demoDataInfo.bornPos; playerDemoData[level-1].bornPos = demoDataInfo.bornPos;
playerDemoData[level-1].godMode = demoDataInfo.godMode; //07/09/2014
} }
} }
} }
@@ -281,9 +292,18 @@ function initRecordVariable()
} }
} }
function saveKeyCode(code) var alwaysRecord = 0, keyPressed = 0;
function saveKeyCode(code, keyAction)
{ {
recordKeyCode = code //-----------------------------------------------------------------------------
// Don't care repeat times, always record key when press dig-left or dig-right
// fixed by Simon 12/12/2014
//-----------------------------------------------------------------------------
alwaysRecord = 0;
if(keyAction == ACT_DIG_LEFT || keyAction == ACT_DIG_RIGHT) alwaysRecord = 1;
recordKeyCode = code;
keyPressed = 1;
} }
function recordModeDump(state) function recordModeDump(state)
@@ -316,11 +336,13 @@ function processRecordKey()
function recordKeyAction() function recordKeyAction()
{ {
if(recordKeyCode != lastKeyCode) { if(!keyPressed) return;
if(recordKeyCode != lastKeyCode || alwaysRecord) {
playRecord.push(recordCount); playRecord.push(recordCount);
playRecord.push(recordKeyCode); playRecord.push(recordKeyCode);
lastKeyCode = recordKeyCode; lastKeyCode = recordKeyCode;
} }
keyPressed = 0;
} }
var recordIdx; var recordIdx;
@@ -405,6 +427,7 @@ function dumpRecord()
curDemoData.action = []; curDemoData.action = [];
curDemoData.goldDrop = []; curDemoData.goldDrop = [];
curDemoData.bornPos = []; curDemoData.bornPos = [];
curDemoData.godMode = godModeKeyPressed; //07/09/2014
for(var i = 0; i < playRecord.length; i++) { for(var i = 0; i < playRecord.length; i++) {
curDemoData.action[i] = playRecord[i]; curDemoData.action[i] = playRecord[i];
@@ -424,6 +447,7 @@ function dumpRecord()
debug(" ai: " + AI_VERSION + ","); debug(" ai: " + AI_VERSION + ",");
debug(" time: " + playRecordTime + ","); debug(" time: " + playRecordTime + ",");
debug(" state: " + recordState + ","); debug(" state: " + recordState + ",");
debug(" godMode: " + godModeKeyPressed + ","); //07/09/2014
if(playRecord.length > 0) { if(playRecord.length > 0) {
txtStr = " action: [ " + playRecord[0]; txtStr = " action: [ " + playRecord[0];
+4 -4
Voir le fichier
@@ -106,9 +106,9 @@ function canvasEditReSize()
for (var scale = MAX_SCALE; scale >= MIN_SCALE; scale -= 0.25) { for (var scale = MAX_SCALE; scale >= MIN_SCALE; scale -= 0.25) {
canvasX = (BASE_SCREEN_X+BASE_TILE_X*2) * scale+ EDIT_PADDING * (NO_OF_TILES_X+1); canvasX = (BASE_SCREEN_X+BASE_TILE_X*2) * scale+ EDIT_PADDING * (NO_OF_TILES_X+1);
canvasY = BASE_SCREEN_Y * scale + EDIT_PADDING * (NO_OF_TILES_Y+1); canvasY = BASE_SCREEN_Y * scale + EDIT_PADDING * (NO_OF_TILES_Y+1);
if (canvasX <= screenX && canvasY <= screenY || scale <= MIN_SCALE) break; if (canvasX <= screenX1 && canvasY <= screenY1 || scale <= MIN_SCALE) break;
} }
//debug("screenX = " + screenX + " screenY = " + screenY + "scale = " + scale); //debug("screenX1 = " + screenX1 + " screenY1 = " + screenY1 + "scale = " + scale);
canvas = document.getElementById('canvas'); canvas = document.getElementById('canvas');
@@ -116,8 +116,8 @@ function canvasEditReSize()
canvas.height = canvasY; canvas.height = canvasY;
//Set canvas top left position //Set canvas top left position
var left = ((screenX - canvasX)/2|0), var left = ((screenX1 - canvasX)/2|0),
top = ((screenY - canvasY)/2|0); top = ((screenY1 - canvasY)/2|0);
canvas.style.left = (left>0?left:0) + "px"; canvas.style.left = (left>0?left:0) + "px";
canvas.style.top = (top>0?top:0) + "px"; canvas.style.top = (top>0?top:0) + "px";
canvas.style.position = "absolute"; canvas.style.position = "absolute";
+14 -9
Voir le fichier
@@ -159,7 +159,7 @@ function guardMoveStep( id, action)
map[x][y].act = curToken; //runner move to [x][y-1], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x][y-1], so set [x][y].act to previous state
y--; y--;
yOffset = tileH + yOffset; yOffset = tileH + yOffset;
if(map[x][y].act == RUNNER_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == RUNNER_T) setRunnerDead(); //collision
//map[x][y].act = GUARD_T; //map[x][y].act = GUARD_T;
} }
@@ -195,7 +195,7 @@ function guardMoveStep( id, action)
map[x][y].act = curToken; //runner move to [x][y+1], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x][y+1], so set [x][y].act to previous state
y++; y++;
yOffset = yOffset - tileH; yOffset = yOffset - tileH;
if(map[x][y].act == RUNNER_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == RUNNER_T) setRunnerDead(); //collision
//map[x][y].act = GUARD_T; //map[x][y].act = GUARD_T;
} }
if(action == ACT_DOWN && yOffset >= 0 && yOffset < yMove) { //try drop gold if(action == ACT_DOWN && yOffset >= 0 && yOffset < yMove) { //try drop gold
@@ -255,7 +255,7 @@ function guardMoveStep( id, action)
map[x][y].act = curToken; //runner move to [x-1][y], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x-1][y], so set [x][y].act to previous state
x--; x--;
xOffset = tileW + xOffset; xOffset = tileW + xOffset;
if(map[x][y].act == RUNNER_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == RUNNER_T) setRunnerDead(); //collision
//map[x][y].act = GUARD_T; //map[x][y].act = GUARD_T;
} }
if( xOffset <= 0 && xOffset > -xMove) { if( xOffset <= 0 && xOffset > -xMove) {
@@ -279,7 +279,7 @@ function guardMoveStep( id, action)
map[x][y].act = curToken; //runner move to [x+1][y], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x+1][y], so set [x][y].act to previous state
x++; x++;
xOffset = xOffset - tileW; xOffset = xOffset - tileW;
if(map[x][y].act == RUNNER_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == RUNNER_T) setRunnerDead(); //collision
//map[x][y].act = GUARD_T; //map[x][y].act = GUARD_T;
} }
if( xOffset >= 0 && xOffset < xMove) { if( xOffset >= 0 && xOffset < xMove) {
@@ -303,8 +303,8 @@ function guardMoveStep( id, action)
} }
} else { } else {
if(curGuard.action == ACT_CLIMB_OUT) action = ACT_CLIMB_OUT; if(curGuard.action == ACT_CLIMB_OUT) action = ACT_CLIMB_OUT;
curGuard.sprite.x = x * tileW + xOffset; curGuard.sprite.x = (x * tileW + xOffset) * tileScale | 0;
curGuard.sprite.y = y * tileH + yOffset; curGuard.sprite.y = (y * tileH + yOffset) * tileScale | 0;
curGuard.pos = { x:x, y:y, xOffset:xOffset, yOffset:yOffset}; curGuard.pos = { x:x, y:y, xOffset:xOffset, yOffset:yOffset};
if(curShape != newShape) { if(curShape != newShape) {
curGuard.sprite.gotoAndPlay(newShape); curGuard.sprite.gotoAndPlay(newShape);
@@ -730,8 +730,8 @@ function guardReborn(x, y)
var curGuard = guard[id]; var curGuard = guard[id];
curGuard.pos = { x:bornX, y:bornY, xOffset:0, yOffset: 0 }; curGuard.pos = { x:bornX, y:bornY, xOffset:0, yOffset: 0 };
curGuard.sprite.x = bornX * tileW; curGuard.sprite.x = bornX * tileWScale | 0;
curGuard.sprite.y = bornY * tileH; curGuard.sprite.y = bornY * tileHScale | 0;
curGuard.sprite.on("animationend", function() { rebornComplete(id); }); curGuard.sprite.on("animationend", function() { rebornComplete(id); });
curGuard.sprite.gotoAndPlay("reborn"); curGuard.sprite.gotoAndPlay("reborn");
@@ -745,7 +745,7 @@ function rebornComplete(id)
var x = guard[id].pos.x; var x = guard[id].pos.x;
var y = guard[id].pos.y; var y = guard[id].pos.y;
if( map[x][y].act == RUNNER_T) gameState = GAME_RUNNER_DEAD; //collision if( map[x][y].act == RUNNER_T) setRunnerDead(); //collision
map[x][y].act = GUARD_T; map[x][y].act = GUARD_T;
guard[id].sprite.removeAllEventListeners ("animationend"); guard[id].sprite.removeAllEventListeners ("animationend");
guard[id].action = ACT_FALL; guard[id].action = ACT_FALL;
@@ -754,3 +754,8 @@ function rebornComplete(id)
guard[id].sprite.gotoAndPlay("fallRight"); guard[id].sprite.gotoAndPlay("fallRight");
soundPlay("reborn"); soundPlay("reborn");
} }
function setRunnerDead()
{
if(!godMode) gameState = GAME_RUNNER_DEAD;
}
+73 -78
Voir le fichier
@@ -16,11 +16,11 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
if(_curScoreInfo) { if(_curScoreInfo) {
recordId = updateScoreInfo(); recordId = updateScoreInfo();
if(recordId < 0) { if(recordId < 0) {
if(_callbackFun) _callbackFun(); if(_callbackFun) _callbackFun();
return; //don't need update score return; //don't need update score
} }
} }
createCanvas2(); createCanvas2();
createScoreStage(); createScoreStage();
@@ -123,8 +123,8 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
canvas2.height = canvasY; canvas2.height = canvasY;
//Set canvas top left position //Set canvas top left position
var left = ((screenX - canvasX)/2|0), var left = ((screenX1 - canvasX)/2|0),
top = ((screenY - canvasY)/2|0); top = ((screenY1 - canvasY)/2|0);
canvas2.style.left = (left>0?left:0) + "px"; canvas2.style.left = (left>0?left:0) + "px";
canvas2.style.top = (top>0?top:0) + "px"; canvas2.style.top = (top>0?top:0) + "px";
canvas2.style.position = "absolute"; canvas2.style.position = "absolute";
@@ -153,8 +153,8 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
function getNameStartPos(nameLength, itemId) function getNameStartPos(nameLength, itemId)
{ {
var x = (4+(MAX_HISCORE_NAME_LENGTH-nameLength)/2)*tileW; var x = (4+(MAX_HISCORE_NAME_LENGTH-nameLength)/2)*tileWScale;
var y = (itemId * 1.2 + 5) * tileH; var y = (itemId * 1.2 + 5) * tileHScale;
return { x: x, y: y }; return { x: x, y: y };
} }
@@ -164,28 +164,28 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
var title = "LODE RUNNER " + ((_dataId == 1)?"2":"1") + " HIGH SCORES"; var title = "LODE RUNNER " + ((_dataId == 1)?"2":"1") + " HIGH SCORES";
var barTile; var barTile;
drawText((NO_OF_TILES_X-title.length)/2*tileW, 0.5*tileH, title, scoreStage); drawText((NO_OF_TILES_X-title.length)/2*tileWScale, 0.5*tileHScale, title, scoreStage);
drawText(0.5*tileW, 3*tileH, "NO", scoreStage); drawText(0.5*tileWScale, 3*tileHScale, "NO", scoreStage);
drawText(7*tileW, 3*tileH, "NAME", scoreStage); drawText(7*tileWScale, 3*tileHScale, "NAME", scoreStage);
drawText(14.5*tileW, 3*tileH, "LEVEL SCORE", scoreStage); drawText(14.5*tileWScale, 3*tileHScale, "LEVEL SCORE", scoreStage);
for(var x = 0; x < NO_OF_TILES_X; x++) { for(var x = 0; x < NO_OF_TILES_X; x++) {
barTile = new createjs.Bitmap(preload.getResult("ground")); barTile = new createjs.Bitmap(preload.getResult("ground"));
barTile.setTransform(x * tileW, 4.5*tileH , tileScale, tileScale); barTile.setTransform(x * tileWScale, 4.5*tileHScale , tileScale, tileScale);
scoreStage.addChild(barTile); scoreStage.addChild(barTile);
} }
for(var i = 0; i < MAX_HISCORE_RECORD; i++) { for(var i = 0; i < MAX_HISCORE_RECORD; i++) {
var pos = getNameStartPos(hiScoreInfo[i].n.length, i); var pos = getNameStartPos(hiScoreInfo[i].n.length, i);
drawText(0.5*tileW, pos.y, ("0"+(i+1)).slice(-2) + ".", scoreStage); drawText(0.5*tileWScale, pos.y, ("0"+(i+1)).slice(-2) + ".", scoreStage); //no
if(hiScoreInfo[i].s > 0) { if(hiScoreInfo[i].s > 0) {
if(hiScoreInfo[i].n.length > 0) { if(hiScoreInfo[i].n.length > 0) {
drawText(pos.x, pos.y, hiScoreInfo[i].n, scoreStage); drawText(pos.x, pos.y, hiScoreInfo[i].n, scoreStage, "D"); //name
} }
drawText(15.5*tileW, pos.y, ("00"+hiScoreInfo[i].l).slice(-3), scoreStage); drawText(15.5*tileWScale, pos.y, ("00"+hiScoreInfo[i].l).slice(-3), scoreStage); //level
drawText(20.5*tileW, pos.y, ("000000"+hiScoreInfo[i].s).slice(-7), scoreStage); drawText(20.5*tileWScale, pos.y, ("000000"+hiScoreInfo[i].s).slice(-7), scoreStage); //score
} }
} }
} }
@@ -200,7 +200,7 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
clearTimeout(timeOutHandler); clearTimeout(timeOutHandler);
closeScoreTable(); closeScoreTable();
//} //}
} };
} }
function restoreKeyDownHandler() function restoreKeyDownHandler()
@@ -215,19 +215,19 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
var savedKeyDownHander, hiScoreTicker; var savedKeyDownHander, hiScoreTicker;
var cursor; var cursor;
init(); initInput();
function init() function initInput()
{ {
name = []; //string name = []; //array of char
nameText = []; //text object nameText = []; //text object
changeKeyDownHandler();
var pos = getNameStartPos(0, recordId); var pos = getNameStartPos(0, recordId);
cursor = new createjs.Sprite(textData, "FLASH"); cursor = new createjs.Sprite(textData, "FLASH");
cursor.setTransform(pos.x-tileW/2, pos.y , tileScale, tileScale); cursor.setTransform(pos.x-tileWScale/2, pos.y , tileScale, tileScale);
scoreStage.addChild(cursor); scoreStage.addChild(cursor);
changeKeyDownHandler();
hiScoreTicker = createjs.Ticker.on("tick", scoreStage); hiScoreTicker = createjs.Ticker.on("tick", scoreStage);
} }
@@ -250,7 +250,7 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
cutTailSpace(); cutTailSpace();
redrawName(); redrawName();
//uodate name for score info //update name for score info
hiScoreInfo[recordId].n = array2String(name); hiScoreInfo[recordId].n = array2String(name);
setHiScoreInfo(); setHiScoreInfo();
@@ -281,77 +281,72 @@ function showScoreTable(_dataId, _curScoreInfo, _callbackFun, _waitTime)
{ {
var pos = getNameStartPos(name.length, recordId); var pos = getNameStartPos(name.length, recordId);
removeNameText(); removeNameText();
nameText = drawText(pos.x, pos.y, array2String(name), scoreStage); nameText = drawText(pos.x, pos.y, array2String(name), scoreStage, "D");
//change cursor position //change cursor position
if(name.length > 0) cursor.x = pos.x + curPos * tileW; if(name.length > 0) cursor.x = pos.x + curPos * tileWScale;
else cursor.x = pos.x - tileW/2; else cursor.x = pos.x - tileWScale/2;
//move cursor to top //move cursor to top
moveChild2Top(scoreStage, cursor); moveChild2Top(scoreStage, cursor);
} }
function handleHiScoreName(event) function handleHiScoreName(event)
{ {
if(!event){ event = window.event; } //cross browser issues exist if(!event){ event = window.event; } //cross browser issues exist
var code = event.keyCode;
//if(event.shiftKey) { if(curPos >= MAX_HISCORE_NAME_LENGTH &&
//} else if (event.ctrlKey) { code != KEYCODE_BKSPACE && code != KEYCODE_LEFT && code != KEYCODE_ENTER)
//} else
{ {
var code = event.keyCode; soundPlay("beep"); //wrong key code
if(curPos >= MAX_HISCORE_NAME_LENGTH &&
code != KEYCODE_BKSPACE && code != KEYCODE_LEFT && code != KEYCODE_ENTER)
{
soundPlay("beep"); //wrong key code
return false;
}
switch(true) {
case (code >=65 && code <= 90): // A ~ Z
case (code >= 97 && code <= 122): //a ~ z
if( code > 90) code -= 32;
name[curPos++] = String.fromCharCode(code);
break;
case (code == KEYCODE_DOT): //'.'
name[curPos++] = ".";
break;
case (code == KEYCODE_DASH): //'-'
name[curPos++] = "-";
break;
case (code == KEYCODE_SPACE): //space
if(curPos == 0) {
soundPlay("beep"); //wrong key code
break;
}
name[curPos++] = " ";
break;
case (code == KEYCODE_BKSPACE): //backspace
if(curPos == 0) break;
name.splice(--curPos, 1);
break;
case (code == KEYCODE_LEFT): //LEFT
if(curPos > 0) curPos--;
break;
case (code == KEYCODE_RIGHT): //RIGHT
if(curPos < name.length) curPos++;
break;
case (code == KEYCODE_ENTER): //ENTER
if(name.length > 0) inputFinish();
else soundPlay("beep");
default:
//debug(code);
if(code > 32) soundPlay("beep"); //wrong key code
break;
}
redrawName();
return false; return false;
} }
switch(true) {
case (code >= 48 && code <= 57): // 0 ~ 9
if(curPos == 0) { soundPlay("beep"); break; } //first char except numbers
name[curPos++] = String.fromCharCode(code);
break;
case (code >=65 && code <= 90): // A ~ Z
case (code >= 97 && code <= 122): //a ~ z
if( code > 90) code -= 32;
name[curPos++] = String.fromCharCode(code);
break;
case (code == KEYCODE_DOT): //'.'
if(curPos == 0) { soundPlay("beep"); break; } //first char except '.'
name[curPos++] = ".";
break;
case (code == KEYCODE_DASH || code == KEYCODE_HYPHEN || code == KEYCODE_SUBTRACT): //'-'
if(curPos == 0) { soundPlay("beep"); break; } //first char except '-'
name[curPos++] = "-";
break;
case (code == KEYCODE_SPACE): //space
if(curPos == 0) { soundPlay("beep"); break; } //first char except space
name[curPos++] = " ";
break;
case (code == KEYCODE_BKSPACE): //backspace
if(curPos == 0) break;
name.splice(--curPos, 1);
break;
case (code == KEYCODE_LEFT): //LEFT
if(curPos > 0) curPos--;
break;
case (code == KEYCODE_RIGHT): //RIGHT
if(curPos < name.length) curPos++;
break;
case (code == KEYCODE_ENTER): //ENTER
if(name.length > 0) inputFinish(true); //async
else soundPlay("beep");
default:
//debug(code);
if(code > 32) soundPlay("beep"); //wrong key code
break;
}
redrawName();
return false;
} }
} }
} }
+6 -6
Voir le fichier
@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Lode Runner</title> <title>Lode Runner Web Game</title>
<!-- DON'T FORGET TO MODIFY *.web.html <!-- DON'T FORGET TO MODIFY *.web.html
* ============================================================================= * =============================================================================
* Lode Runner (超級運動員) - APPLE-II version * Lode Runner (超級運動員) - APPLE-II version
@@ -16,18 +16,18 @@
* *
* Source Code: https://github.com/SimonHung/LodeRunner * Source Code: https://github.com/SimonHung/LodeRunner
* *
* by Simon Hung 2014/06/20 (http://simonsays-tw.com) * by Simon Hung 06/20/2014, 11/23/2014 (http://simonsays-tw.com)
* ============================================================================= * =============================================================================
--> -->
<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge"> <meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
<meta name="description" content="GAME HTML5 JavaScript CreateJS Championship Lode Runner"> <meta name="description" content="An HTML5 remake game, include Lode Runner & Championship Lode Runner">
<link href="lodeRunner.ico" rel="shortcut icon" > <link href="lodeRunner.ico" rel="shortcut icon" >
<style>#canvas { position:absolute; left:0; top:0; }</style> <style>#canvas { position:absolute; left:0; top:0; }</style>
<script type="text/javascript" src="./lib/preloadjs-0.4.1.min.js"></script> <script type="text/javascript" src="./lib/preloadjs-0.6.0.min.js"></script>
<script type="text/javascript" src="./lib/soundjs-0.5.2.min.js"></script> <script type="text/javascript" src="./lib/soundjs-0.6.0.min.js"></script>
<script type="text/javascript" src="./lib/tweenjs-0.5.1.min.js"></script> <script type="text/javascript" src="./lib/tweenjs-0.6.0.min.js"></script>
<script type="text/javascript" src="./lib/easeljs-0.7.1.min.js"></script> <script type="text/javascript" src="./lib/easeljs-0.7.1.min.js"></script>
<script type="text/javascript" src="lodeRunner.baseLevel.js"></script> <script type="text/javascript" src="lodeRunner.baseLevel.js"></script>
+28 -5
Voir le fichier
@@ -14,11 +14,17 @@ function pressShiftKey(code)
gameState = GAME_PREV_LEVEL; gameState = GAME_PREV_LEVEL;
break; break;
case KEYCODE_UP: //SHIFT-UP, inc runner case KEYCODE_UP: //SHIFT-UP, inc runner
if(runnerLife < 10) { if(playMode == PLAY_CLASSIC && runnerLife < 10) { //bug fixed: add check playMode, 12/15/2014
runnerLife++; runnerLife++;
drawLife(); drawLife();
} }
break; break;
case KEYCODE_X: //SHIFT-X
toggleTrapTile();
break;
case KEYCODE_G: //SHIFT-G, toggle god mode
toggleGodMode();
break;
default: default:
if(runnerDebug) debugKeyPress(code); if(runnerDebug) debugKeyPress(code);
break; break;
@@ -39,9 +45,6 @@ function pressCtrlKey(code)
runnerLife = 1; runnerLife = 1;
gameState = GAME_RUNNER_DEAD; gameState = GAME_RUNNER_DEAD;
break; break;
case KEYCODE_X: //CTRL-X
toggleTrapTile();
break;
case KEYCODE_S: //CTRL-S, toggle sound case KEYCODE_S: //CTRL-S, toggle sound
if( (soundOff ^= 1) == 1) { if( (soundOff ^= 1) == 1) {
soundDig.stop(); soundDig.stop();
@@ -98,6 +101,26 @@ function debugKeyPress(code)
} }
} }
var godMode = 0, godModeKeyPressed = 0;
function initHotKeyVariable()
{
godMode = 0;
godModeKeyPressed = 0;
}
function toggleGodMode()
{
godModeKeyPressed = 1; //means player press the god-mod hot-key
godMode ^= 1;
if(godMode) {
showTipsText("GOD MODE ON", 0);
} else {
showTipsText("GOD MODE OFF", 0);
}
}
function setSpeed(v) function setSpeed(v)
{ {
speed += v; speed += v;
@@ -163,7 +186,7 @@ function pressKey(code)
//debug("keycode = " + code); //debug("keycode = " + code);
break; break;
} }
if(recordMode && code != KEYCODE_ESC) saveKeyCode(code); if(recordMode && code != KEYCODE_ESC) saveKeyCode(code, keyAction);
} }
function gameResume() function gameResume()
+70 -40
Voir le fichier
@@ -16,10 +16,11 @@
* ============================================================================= * =============================================================================
*/ */
var screenX, screenY; var screenX1, screenY1;
var canvasX, canvasY; var canvasX, canvasY;
var tileW, tileH; //tile width & tile height var tileW, tileH; //tile width & tile height
var tileWScale, tileHScale; //tile width/height with scale
var W2, W4; //W2: 1/2 tile-width, W4: 1/4 tile width var W2, W4; //W2: 1/2 tile-width, W4: 1/4 tile width
var H2, H4; //H2: 1/2 tile-height, H4: 1/4 tile height var H2, H4; //H2: 1/2 tile-height, H4: 1/4 tile height
@@ -33,7 +34,7 @@ var loadingTxt;
var gameState, lastGameState ; var gameState, lastGameState ;
var tileScale, xMove, yMove; var tileScale, xMove, yMove;
var speedMode = [18, 22, 26, 30, 34]; //slow normal fast var speedMode = [16, 20, 25, 30, 35]; //slow normal fast
var speedText = ["VERY SLOW", "SLOW", "NORMAL", "FAST", "VERY FAST"]; var speedText = ["VERY SLOW", "SLOW", "NORMAL", "FAST", "VERY FAST"];
var speed = 2; //normal var speed = 2; //normal
var demoSpeed = 40; var demoSpeed = 40;
@@ -49,8 +50,8 @@ var curTime = MAX_TIME_COUNT;
function init() function init()
{ {
var screenSize = getScreenSize(); var screenSize = getScreenSize();
screenX = screenSize.x; screenX1 = screenSize.x;
screenY = screenSize.y; screenY1 = screenSize.y;
loadDataJS(); //load demo data file loadDataJS(); //load demo data file
canvasReSize(); canvasReSize();
@@ -83,9 +84,9 @@ function canvasReSize()
for (var scale = MAX_SCALE; scale >= MIN_SCALE; scale -= 0.25) { for (var scale = MAX_SCALE; scale >= MIN_SCALE; scale -= 0.25) {
canvasX = BASE_SCREEN_X * scale; canvasX = BASE_SCREEN_X * scale;
canvasY = BASE_SCREEN_Y * scale; canvasY = BASE_SCREEN_Y * scale;
if (canvasX <= screenX && canvasY <= screenY || scale <= MIN_SCALE) break; if (canvasX <= screenX1 && canvasY <= screenY1 || scale <= MIN_SCALE) break;
} }
//debug("screenX = " + screenX + " screenY = " + screenY + "scale = " + scale); //debug("screenX1 = " + screenX1 + " screenY1 = " + screenY1 + "scale = " + scale);
canvas = document.getElementById('canvas'); canvas = document.getElementById('canvas');
@@ -93,16 +94,21 @@ function canvasReSize()
canvas.height = canvasY; canvas.height = canvasY;
//Set canvas top left position //Set canvas top left position
var left = ((screenX - canvasX)/2|0), var left = ((screenX1 - canvasX)/2|0),
top = ((screenY - canvasY)/2|0); top = ((screenY1 - canvasY)/2|0);
canvas.style.left = (left>0?left:0) + "px"; canvas.style.left = (left>0?left:0) + "px";
canvas.style.top = (top>0?top:0) + "px"; canvas.style.top = (top>0?top:0) + "px";
canvas.style.position = "absolute"; canvas.style.position = "absolute";
//initial constant value //initial constant value
tileScale = scale; tileScale = scale;
tileW = BASE_TILE_X * scale;
tileH = BASE_TILE_Y * scale; //tileW = BASE_TILE_X * scale;
//tileH = BASE_TILE_Y * scale;
tileW = BASE_TILE_X; //tileW and tileH for detection so don't change scale
tileH = BASE_TILE_Y;
tileWScale = BASE_TILE_X * scale;
tileHScale = BASE_TILE_Y * scale;
W2 = (tileW/2|0); //20, 15, 10, W2 = (tileW/2|0); //20, 15, 10,
H2 = (tileH/2|0); //22, 16, 11 H2 = (tileH/2|0); //22, 16, 11
@@ -110,8 +116,9 @@ function canvasReSize()
W4 = (tileW/4|0); //10, 7, 5, W4 = (tileW/4|0); //10, 7, 5,
H4 = (tileH/4|0); //11, 8, 5, H4 = (tileH/4|0); //11, 8, 5,
xMove = 4 * tileScale * 2; //xMove and yMove initial by setSpeedByAiVersion()
yMove = 4 * tileScale * 2; //xMove = 4 * tileScale * 2;
//yMove = 4 * tileScale * 2;
} }
function createStage() function createStage()
@@ -280,6 +287,9 @@ function startGame()
startPlayTicker(); startPlayTicker();
changingLevel = 1; changingLevel = 1;
curAiVersion = AI_VERSION; //07/04/2014
initHotKeyVariable(); //07/09/2014
switch(playMode) { switch(playMode) {
case PLAY_CLASSIC: case PLAY_CLASSIC:
getClassicInfo(); getClassicInfo();
@@ -325,6 +335,8 @@ function initVariable()
initGuardVariable(); initGuardVariable();
initInfoVariable(); initInfoVariable();
initCycVariable(); initCycVariable();
setSpeedByAiVersion(); //07/04/2014
} }
function buildLevelMap(levelMap) function buildLevelMap(levelMap)
@@ -422,7 +434,7 @@ function buildLevelMap(levelMap)
runner = {}; runner = {};
curTile = runner.sprite = new createjs.Sprite(runnerData, "runRight"); curTile = runner.sprite = new createjs.Sprite(runnerData, "runRight");
runner.pos = { x:x, y:y, xOffset:0, yOffset:0}; runner.pos = { x:x, y:y, xOffset:0, yOffset:0};
runner.action = ACT_STOP; runner.action = ACT_UNKNOWN;
runner.shape = "runRight"; runner.shape = "runRight";
runner.lastLeftRight = "ACT_RIGHT"; runner.lastLeftRight = "ACT_RIGHT";
//curTile.gotoAndPlay(); //curTile.gotoAndPlay();
@@ -430,7 +442,7 @@ function buildLevelMap(levelMap)
//curTile.framerate = 60; //curTile.framerate = 60;
break; break;
} }
curTile.setTransform(x * tileW, y * tileH,tileScale, tileScale); //x,y, scaleX, scaleY curTile.setTransform(x * tileWScale, y * tileHScale, tileScale, tileScale); //x,y, scaleX, scaleY
mainStage.addChild(curTile); mainStage.addChild(curTile);
} }
} }
@@ -470,7 +482,7 @@ function drawGround()
groundTile = []; groundTile = [];
for(var x = 0; x < NO_OF_TILES_X; x++) { for(var x = 0; x < NO_OF_TILES_X; x++) {
groundTile[x] = new createjs.Bitmap(preload.getResult("ground")); groundTile[x] = new createjs.Bitmap(preload.getResult("ground"));
groundTile[x].setTransform(x * tileW, NO_OF_TILES_Y*tileH , tileScale, tileScale); groundTile[x].setTransform(x * tileWScale, NO_OF_TILES_Y * tileHScale, tileScale, tileScale);
mainStage.addChild(groundTile[x]); mainStage.addChild(groundTile[x]);
} }
} }
@@ -565,7 +577,7 @@ function drawScoreTxt()
function drawLifeTxt() function drawLifeTxt()
{ {
lifeTxt = drawText(13*tileW, infoY, "MEN", mainStage); lifeTxt = drawText(13*tileWScale, infoY, "MEN", mainStage);
} }
function drawLevelTxt() function drawLevelTxt()
@@ -575,29 +587,29 @@ function drawLevelTxt()
//if(playMode == PLAY_CLASSIC || playMode == PLAY_AUTO) xOffset = 20; //if(playMode == PLAY_CLASSIC || playMode == PLAY_AUTO) xOffset = 20;
//else xOffset = 19; //else xOffset = 19;
levelTxt = drawText(xOffset*tileW, infoY, "LEVEL", mainStage); levelTxt = drawText(xOffset*tileWScale, infoY, "LEVEL", mainStage);
} }
//for demo mode //for demo mode
function drawDemoTxt() function drawDemoTxt()
{ {
demoTxt = drawText(14*tileW, infoY, "DEMO", mainStage); demoTxt = drawText(14*tileWScale, infoY, "DEMO", mainStage);
} }
//for time & edit mode //for time & edit mode
function drawGoldTxt() function drawGoldTxt()
{ {
goldTxt = drawText(0*tileW, infoY, "@", mainStage); goldTxt = drawText(0*tileWScale, infoY, "@", mainStage);
} }
function drawGuardTxt() function drawGuardTxt()
{ {
guardTxt = drawText((5+2/3)*tileW, infoY, "#", mainStage); guardTxt = drawText((5+2/3)*tileWScale, infoY, "#", mainStage);
} }
function drawTimeTxt() function drawTimeTxt()
{ {
timeTxt = drawText((11+1/3)*tileW, infoY, "TIME", mainStage); timeTxt = drawText((11+1/3)*tileWScale, infoY, "TIME", mainStage);
} }
// draw score number // draw score number
@@ -612,7 +624,7 @@ function drawScore(addScore)
//if(playMode == PLAY_CLASSIC || playMode == PLAY_AUTO) digitNo = 7; //if(playMode == PLAY_CLASSIC || playMode == PLAY_AUTO) digitNo = 7;
//else digitNo = 6 //else digitNo = 6
scoreTile = drawText(5*tileW, infoY, ("000000"+curScore).slice(-7), mainStage); scoreTile = drawText(5*tileWScale, infoY, ("000000"+curScore).slice(-7), mainStage);
} }
function drawLife() function drawLife()
@@ -620,7 +632,7 @@ function drawLife()
for(var i = 0; i < lifeTile.length; i++) for(var i = 0; i < lifeTile.length; i++)
mainStage.removeChild(lifeTile[i]); mainStage.removeChild(lifeTile[i]);
lifeTile = drawText(16*tileW, infoY, ("00"+runnerLife).slice(-3), mainStage); lifeTile = drawText(16*tileWScale, infoY, ("00"+runnerLife).slice(-3), mainStage);
} }
function drawLevel() function drawLevel()
@@ -630,11 +642,11 @@ function drawLevel()
switch(playMode) { switch(playMode) {
case PLAY_AUTO: case PLAY_AUTO:
levelTile = drawText(25*tileW, infoY, ("00"+demoLevel).slice(-3), mainStage); levelTile = drawText(25*tileWScale, infoY, ("00"+demoLevel).slice(-3), mainStage);
break; break;
case PLAY_CLASSIC: case PLAY_CLASSIC:
default: default:
levelTile = drawText(25*tileW, infoY, ("00"+curLevel).slice(-3), mainStage); levelTile = drawText(25*tileWScale, infoY, ("00"+curLevel).slice(-3), mainStage);
break; break;
} }
} }
@@ -645,7 +657,7 @@ function drawGold(addGold)
for(var i = 0; i < goldTile.length; i++) for(var i = 0; i < goldTile.length; i++)
mainStage.removeChild(goldTile[i]); mainStage.removeChild(goldTile[i]);
goldTile = drawText(1*tileW, infoY, ("00"+curGetGold).slice(-3), mainStage); goldTile = drawText(1*tileWScale, infoY, ("00"+curGetGold).slice(-3), mainStage);
} }
function drawGuard(addGuard) function drawGuard(addGuard)
@@ -655,7 +667,7 @@ function drawGuard(addGuard)
for(var i = 0; i < guardTile.length; i++) for(var i = 0; i < guardTile.length; i++)
mainStage.removeChild(guardTile[i]); mainStage.removeChild(guardTile[i]);
guardTile = drawText((6+2/3)*tileW, infoY, ("00"+curGuardDeadNo).slice(-3), mainStage); guardTile = drawText((6+2/3)*tileWScale, infoY, ("00"+curGuardDeadNo).slice(-3), mainStage);
} }
@@ -668,7 +680,7 @@ function drawTime(decTime)
for(var i = 0; i < timeTile.length; i++) for(var i = 0; i < timeTile.length; i++)
mainStage.removeChild(timeTile[i]); mainStage.removeChild(timeTile[i]);
timeTile = drawText((15+1/3)*tileW, infoY, ("00"+curTime).slice(-3), mainStage); timeTile = drawText((15+1/3)*tileWScale, infoY, ("00"+curTime).slice(-3), mainStage);
} }
function setGroundInfoOrder() function setGroundInfoOrder()
@@ -702,17 +714,19 @@ function setGroundInfoOrder()
for(i = 0; i < levelTile.length; i++) moveChild2Top(mainStage, levelTile[i]); for(i = 0; i < levelTile.length; i++) moveChild2Top(mainStage, levelTile[i]);
} }
function drawText(x, y, str, parentObj) function drawText(x, y, str, parentObj, numberType)
{ {
var text = str.toUpperCase(); var text = str.toUpperCase();
var textTile = []; var textTile = [];
if(typeof numberType == "undefined") numberType = "N";
for(var i = 0; i < text.length; i++) { for(var i = 0; i < text.length; i++) {
var code = text.charCodeAt(i); var code = text.charCodeAt(i);
switch(true) { switch(true) {
case (code >=48 && code <=57): case (code >=48 && code <=57): //N0 ~ N9 or D0 ~ D9
textTile[i] = new createjs.Sprite(textData,"N"+String.fromCharCode(code)); textTile[i] = new createjs.Sprite(textData, numberType+String.fromCharCode(code));
break; break;
case (code >=65 && code <= 90): case (code >=65 && code <= 90):
textTile[i] = new createjs.Sprite(textData, String.fromCharCode(code)); textTile[i] = new createjs.Sprite(textData, String.fromCharCode(code));
@@ -739,7 +753,7 @@ function drawText(x, y, str, parentObj)
textTile[i] = new createjs.Sprite(textData, "SPACE"); textTile[i] = new createjs.Sprite(textData, "SPACE");
break; break;
} }
textTile[i].setTransform(x + i*tileW, y, tileScale, tileScale).stop(); textTile[i].setTransform(x + i*tileWScale, y, tileScale, tileScale).stop();
parentObj.addChild(textTile[i]); parentObj.addChild(textTile[i]);
} }
return textTile; return textTile;
@@ -773,7 +787,8 @@ function showLevel(levelMap)
{ {
mainStage.removeAllChildren(); mainStage.removeAllChildren();
loadingTxt.text = "" loadingTxt.text = "";
//loadingTxt.text = tileScale; //for debug
mainStage.addChild(loadingTxt); //for debug mainStage.addChild(loadingTxt); //for debug
initVariable(); initVariable();
@@ -807,7 +822,7 @@ function showTipsText(text, always)
width = height = 0; width = height = 0;
} }
x = tipsText.x = (canvas.width - width) / 2 | 0; x = tipsText.x = (canvas.width - width) / 2 | 0;
y = tipsText.y = (NO_OF_TILES_Y*tileH - height) / 2 | 0; y = tipsText.y = (NO_OF_TILES_Y*tileHScale - height) / 2 | 0;
tipsText.shadow = new createjs.Shadow("white", 2, 2, 1); tipsText.shadow = new createjs.Shadow("white", 2, 2, 1);
tipsRect = new createjs.Shape(); tipsRect = new createjs.Shape();
@@ -841,6 +856,13 @@ function toggleTrapTile()
} }
} }
} }
if(dspTrapTile) {
showTipsText("SHOW TRAP TILE", 0);
} else {
showTipsText("HIDE TRAP TILE", 0);
}
} }
function startAllSpriteObj() function startAllSpriteObj()
@@ -888,8 +910,8 @@ function gameOverAnimation()
{ {
var gameOverImage = new createjs.Bitmap(preload.getResult("over")); var gameOverImage = new createjs.Bitmap(preload.getResult("over"));
var bound = gameOverImage.getBounds(); var bound = gameOverImage.getBounds();
var x = (NO_OF_TILES_X*tileW)/2|0; var x = (NO_OF_TILES_X*tileWScale)/2|0;
var y = (NO_OF_TILES_Y*tileH)/2|0; var y = (NO_OF_TILES_Y*tileHScale)/2|0;
var regX = (bound.width)/2|0; var regX = (bound.width)/2|0;
var regY = (bound.height)/2|0; var regY = (bound.height)/2|0;
@@ -926,8 +948,8 @@ var cycScreen, cycMaxRadius, cycDiff, cycX, cycY
function initCycVariable() function initCycVariable()
{ {
cycX = NO_OF_TILES_X * tileW/2; cycX = NO_OF_TILES_X * tileWScale/2;
cycY = NO_OF_TILES_Y * tileH/2; cycY = NO_OF_TILES_Y * tileHScale/2;
cycMaxRadius = Math.sqrt(cycX*cycX+cycY*cycY)|0+1; cycMaxRadius = Math.sqrt(cycX*cycX+cycY*cycY)|0+1;
cycDiff = (cycMaxRadius/CLOSE_SCREEN_SPEED)|0; cycDiff = (cycMaxRadius/CLOSE_SCREEN_SPEED)|0;
} }
@@ -968,6 +990,10 @@ function closingScreen(r)
setTimeout(function() { closingScreen(r);}, 5); setTimeout(function() { closingScreen(r);}, 5);
} else { } else {
var levelMap; var levelMap;
curAiVersion = AI_VERSION; //07/04/2014
initHotKeyVariable(); //07/09/2014
if(playMode == PLAY_AUTO) getAutoDemoLevel(0); if(playMode == PLAY_AUTO) getAutoDemoLevel(0);
if(playMode == PLAY_DEMO) getNextDemoLevel(); if(playMode == PLAY_DEMO) getNextDemoLevel();
/* /*
@@ -980,7 +1006,6 @@ function closingScreen(r)
} else { } else {
levelMap = levelData[curLevel-1]; levelMap = levelData[curLevel-1];
} }
showLevel(levelMap); showLevel(levelMap);
addCycScreen(); addCycScreen();
setTimeout(function() { openingScreen(cycDiff*2);}, 5); setTimeout(function() { openingScreen(cycDiff*2);}, 5);
@@ -1174,8 +1199,10 @@ function mainTick(event)
break; break;
case GAME_RUNNER_DEAD: case GAME_RUNNER_DEAD:
//mainStage.update(); //mainStage.update();
//if(recordMode) recordModeToggle(GAME_RUNNER_DEAD);
//if(recordMode) recordModeToggle(GAME_RUNNER_DEAD); //for debug only (if enable it must disable below statement)
if(recordMode == RECORD_KEY) recordModeDump(GAME_RUNNER_DEAD); if(recordMode == RECORD_KEY) recordModeDump(GAME_RUNNER_DEAD);
soundStop(soundFall); soundStop(soundFall);
stopAllSpriteObj(); stopAllSpriteObj();
soundPlay("dead"); soundPlay("dead");
@@ -1266,8 +1293,11 @@ function mainTick(event)
debug("design error!"); debug("design error!");
break; break;
} }
//if(recordMode) recordModeToggle(GAME_FINISH); //for debug only (if enable it must comment below if statement)
if(recordMode == RECORD_KEY) { if(recordMode == RECORD_KEY) {
recordModeDump(GAME_FINISH); recordModeDump(GAME_FINISH);
if((playMode == PLAY_CLASSIC || playMode == PLAY_MODERN) && playData <= 2) { if((playMode == PLAY_CLASSIC || playMode == PLAY_MODERN) && playData <= 2) {
updatePlayerDemoData(playData, curDemoData); //update current player demo data updatePlayerDemoData(playData, curDemoData); //update current player demo data
} }
+28 -29
Voir le fichier
@@ -338,7 +338,7 @@ function closeIconClass(_width, _height, _stage, _scale, _activeColor, _callBack
// < 4 > : SLIDE_GAP_X // < 4 > : SLIDE_GAP_X
function selectDialog(_titleName, _checkBitmap, _levelData, _activeLevel, _screenX, _screenY, function selectDialog(_titleName, _checkBitmap, _levelData, _activeLevel, _screenX1, _screenY1,
_parentStage, _scale, _activeFun, _closeFun, _postFun) _parentStage, _scale, _activeFun, _closeFun, _postFun)
{ {
var TITLE_TEXT_SIZE = 36 * _scale; var TITLE_TEXT_SIZE = 36 * _scale;
@@ -462,8 +462,8 @@ function selectDialog(_titleName, _checkBitmap, _levelData, _activeLevel, _scree
canvas1.width = CANVAS_SIZE_X; canvas1.width = CANVAS_SIZE_X;
canvas1.height = CANVAS_SIZE_Y; canvas1.height = CANVAS_SIZE_Y;
var left = ((_screenX - canvas1.width)/2|0), var left = ((_screenX1 - canvas1.width)/2|0),
top = ((_screenY - canvas1.height)/2|0); top = ((_screenY1 - canvas1.height)/2|0);
canvas1.style.left = (left>0?left:0) + "px"; canvas1.style.left = (left>0?left:0) + "px";
canvas1.style.top = (top>0?top:0) + "px"; canvas1.style.top = (top>0?top:0) + "px";
canvas1.style.position = "absolute"; canvas1.style.position = "absolute";
@@ -1265,7 +1265,6 @@ function selectDialog(_titleName, _checkBitmap, _levelData, _activeLevel, _scree
////debug("delete level = " + level); ////debug("delete level = " + level);
} }
////////////////////////////////////////////
} }
function createTitle() function createTitle()
@@ -1316,8 +1315,8 @@ function menuDialog(_titleName, _itemList, _stage, _scale, _closeCallBack, _args
var CLOSE_ICON_ACTIVE_COLOR = "#ff5050"; var CLOSE_ICON_ACTIVE_COLOR = "#ff5050";
var screenX = _stage.canvas.width; var screenX1 = _stage.canvas.width;
var screenY = _stage.canvas.height; var screenY1 = _stage.canvas.height;
var titleTextObj, titleWidth, titleHeight; var titleTextObj, titleWidth, titleHeight;
var itemText = [], maxItemTextWidth, itemTextHeight; var itemText = [], maxItemTextWidth, itemTextHeight;
@@ -1348,7 +1347,7 @@ function menuDialog(_titleName, _itemList, _stage, _scale, _closeCallBack, _args
function coverParentStage() function coverParentStage()
{ {
coverBackgroundObj = new createjs.Shape(); coverBackgroundObj = new createjs.Shape();
coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX, screenY).endFill(); coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX1, screenY1).endFill();
coverBackgroundObj.alpha = 0.6; coverBackgroundObj.alpha = 0.6;
_stage.addChild(coverBackgroundObj); _stage.addChild(coverBackgroundObj);
} }
@@ -1373,8 +1372,8 @@ function menuDialog(_titleName, _itemList, _stage, _scale, _closeCallBack, _args
menuX = (maxItemTextWidth > titleWidth? maxItemTextWidth: titleWidth) + TITLE_TEXT_SIZE * 2; menuX = (maxItemTextWidth > titleWidth? maxItemTextWidth: titleWidth) + TITLE_TEXT_SIZE * 2;
menuY = TITLE_AREA_Y + BOTTOM_AREA_Y + (ITEM_AREA_Y+ITEM_GAP_Y)*_itemList.length; menuY = TITLE_AREA_Y + BOTTOM_AREA_Y + (ITEM_AREA_Y+ITEM_GAP_Y)*_itemList.length;
startX = (screenX-menuX)/2|0; startX = (screenX1-menuX)/2|0;
startY = (screenY-menuY)/2|0; startY = (screenY1-menuY)/2|0;
} }
function creatBackground() function creatBackground()
@@ -1501,7 +1500,7 @@ function mainMenu(callbackFun)
{ {
var mainMenuList = [ var mainMenuList = [
{ name: "CLASSIC MODE", activeFun: classicMenu }, { name: "CLASSIC MODE", activeFun: classicMenu },
{ name: "TIME MODE", activeFun: modernMenu }, { name: "TRAINING MODE", activeFun: modernMenu },
{ name: "EDIT MODE", activeFun: editMenu }, { name: "EDIT MODE", activeFun: editMenu },
{ name: "HELP", activeFun: helpMenu } { name: "HELP", activeFun: helpMenu }
]; ];
@@ -1539,7 +1538,7 @@ function modernMenu(id, callbackFun)
modernMenuList.push({ name: USER_CREATED_NAME, activeFun: modernPlay}); modernMenuList.push({ name: USER_CREATED_NAME, activeFun: modernPlay});
} }
menuDialog(" TIME MODE ", modernMenuList, mainStage, tileScale, mainMenu, callbackFun); menuDialog(" TRAINING MODE ", modernMenuList, mainStage, tileScale, mainMenu, callbackFun);
} }
function demoMenu(id, callbackFun) function demoMenu(id, callbackFun)
@@ -1640,7 +1639,7 @@ function helpMenuClose(callbackFun)
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
function mainMenuIconClass( _screenX, _screenY, _scale, _mainMenuBitmap) function mainMenuIconClass( _screenX1, _screenY1, _scale, _mainMenuBitmap)
{ {
//_scale = _scale*2/3; //_scale = _scale*2/3;
var border = 4 * _scale + 2; var border = 4 * _scale + 2;
@@ -1709,8 +1708,8 @@ function mainMenuIconClass( _screenX, _screenY, _scale, _mainMenuBitmap)
mainMainCanvas.width = bitmapX+border*2; mainMainCanvas.width = bitmapX+border*2;
mainMainCanvas.height = bitmapY+border*2; mainMainCanvas.height = bitmapY+border*2;
var left = (_screenX - mainMainCanvas.width - bitmapX/3), var left = (_screenX1 - mainMainCanvas.width - bitmapX/3),
top = (_screenY - mainMainCanvas.height - bitmapY/4); top = (_screenY1 - mainMainCanvas.height - bitmapY/4);
//top = bitmapY/4|0; //top = bitmapY/4|0;
mainMainCanvas.style.left = left + "px"; mainMainCanvas.style.left = left + "px";
mainMainCanvas.style.top = top + "px"; mainMainCanvas.style.top = top + "px";
@@ -1794,7 +1793,7 @@ function activeSelectMenu(activeFun, postFun)
if(playMode == PLAY_EDIT) { if(playMode == PLAY_EDIT) {
var editLevel = testLevelInfo.level> editLevels?0:testLevelInfo.level; var editLevel = testLevelInfo.level> editLevels?0:testLevelInfo.level;
selectDialog(USER_CREATED_NAME, checkBitmap, editLevelData, editLevel, screenX, screenY, selectDialog(USER_CREATED_NAME, checkBitmap, editLevelData, editLevel, screenX1, screenY1,
mainStage, tileScale, activeFun, editSelectMenuClose, postFun) mainStage, tileScale, activeFun, editSelectMenuClose, postFun)
} else { } else {
//var titleName = (playData==1)?LODERUNNER_NAME1:((playData==2)?LODERUNNER_NAME2:USER_CREATED_NAME); //var titleName = (playData==1)?LODERUNNER_NAME1:((playData==2)?LODERUNNER_NAME2:USER_CREATED_NAME);
@@ -1820,12 +1819,12 @@ function activeSelectMenu(activeFun, postFun)
break; break;
} }
selectDialog(titleName, checkBitmap, levelData, curLevel, screenX, screenY, selectDialog(titleName, checkBitmap, levelData, curLevel, screenX1, screenY1,
mainStage, tileScale, activeFun, null, postFun) mainStage, tileScale, activeFun, null, postFun)
} }
} }
function selectIconClass( _screenX, _screenY, _scale, _bitmap) function selectIconClass( _screenX1, _screenY1, _scale, _bitmap)
{ {
//_scale = _scale*2/3; //_scale = _scale*2/3;
var border = 4 * _scale + 2; var border = 4 * _scale + 2;
@@ -1894,9 +1893,9 @@ function selectIconClass( _screenX, _screenY, _scale, _bitmap)
selectCanvas.width = bitmapX+border*2; selectCanvas.width = bitmapX+border*2;
selectCanvas.height = bitmapY+border*2; selectCanvas.height = bitmapY+border*2;
var left = (_screenX - selectCanvas.width - bitmapX/3), var left = (_screenX1 - selectCanvas.width - bitmapX/3),
top = bitmapY/4|0; top = bitmapY/4|0;
//top = (_screenY - selectCanvas.height - bitmapY/4); //top = (_screenY1 - selectCanvas.height - bitmapY/4);
selectCanvas.style.left = left + "px"; selectCanvas.style.left = left + "px";
selectCanvas.style.top = top + "px"; selectCanvas.style.top = top + "px";
selectCanvas.style.position = "absolute"; selectCanvas.style.position = "absolute";
@@ -2053,8 +2052,8 @@ function levelPassDialog(_level, _getGold, _guardDead, _time, _hiScore,
hiScoreNameObj, hiScoreTextObj; hiScoreNameObj, hiScoreTextObj;
var coverBackgroundObj, background1Obj, background2Obj, menuButtonObj; var coverBackgroundObj, background1Obj, background2Obj, menuButtonObj;
var screenX = _stage.canvas.width; var screenX1 = _stage.canvas.width;
var screenY = _stage.canvas.height; var screenY1 = _stage.canvas.height;
var menuX, menuY, startX, startY var menuX, menuY, startX, startY
var timeNameX, maxTextSize; var timeNameX, maxTextSize;
@@ -2105,14 +2104,14 @@ function levelPassDialog(_level, _getGold, _guardDead, _time, _hiScore,
menuX = maxTextSize + TITLE_TEXT_SIZE * 5; menuX = maxTextSize + TITLE_TEXT_SIZE * 5;
menuY = TITLE_TEXT_SIZE * 2 + (ITEM_TEXT_SIZE+TEXT_GAP_Y) * 5 + buttonY*3; menuY = TITLE_TEXT_SIZE * 2 + (ITEM_TEXT_SIZE+TEXT_GAP_Y) * 5 + buttonY*3;
startX = (screenX-menuX)/2|0; startX = (screenX1-menuX)/2|0;
startY = (screenY-menuY)/2|0; startY = (screenY1-menuY)/2|0;
} }
function coverParentStage() function coverParentStage()
{ {
coverBackgroundObj = new createjs.Shape(); coverBackgroundObj = new createjs.Shape();
coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX, screenY).endFill(); coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX1, screenY1).endFill();
coverBackgroundObj.alpha = 0.6; coverBackgroundObj.alpha = 0.6;
_stage.addChild(coverBackgroundObj); _stage.addChild(coverBackgroundObj);
} }
@@ -2423,8 +2422,8 @@ function yesNoDialog(_txtMsg, _yesBitmap, _noBitmap, _stage, _scale, _callBack)
var textObj; var textObj;
var coverBackgroundObj, background1Obj, background2Obj; var coverBackgroundObj, background1Obj, background2Obj;
var screenX = _stage.canvas.width; var screenX1 = _stage.canvas.width;
var screenY = _stage.canvas.height; var screenY1 = _stage.canvas.height;
var buttonX = _yesBitmap.getBounds().width * _scale, var buttonX = _yesBitmap.getBounds().width * _scale,
buttonY = _yesBitmap.getBounds().height * _scale; buttonY = _yesBitmap.getBounds().height * _scale;
@@ -2474,14 +2473,14 @@ function yesNoDialog(_txtMsg, _yesBitmap, _noBitmap, _stage, _scale, _callBack)
menuY = (TEXT_GAP_Y + TEXT_MSG_SIZE) * _txtMsg.length + TEXT_MSG_SIZE * 2 + buttonY; menuY = (TEXT_GAP_Y + TEXT_MSG_SIZE) * _txtMsg.length + TEXT_MSG_SIZE * 2 + buttonY;
menuX = maxTextSize + TEXT_MSG_SIZE * 2; menuX = maxTextSize + TEXT_MSG_SIZE * 2;
startX = (screenX-menuX)/2|0; startX = (screenX1-menuX)/2|0;
startY = (screenY-menuY)/2|0; startY = (screenY1-menuY)/2|0;
} }
function coverParentStage() function coverParentStage()
{ {
coverBackgroundObj = new createjs.Shape(); coverBackgroundObj = new createjs.Shape();
coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX, screenY).endFill(); coverBackgroundObj.graphics.beginFill(COVER_BACKGROUND_COLOR).drawRect(0, 0, screenX1, screenY1).endFill();
coverBackgroundObj.alpha = 0.6; coverBackgroundObj.alpha = 0.6;
_stage.addChild(coverBackgroundObj); _stage.addChild(coverBackgroundObj);
} }
+5 -4
Voir le fichier
@@ -71,11 +71,11 @@ function showTipsMsg(_tipsTxt, _stage, _scale)
var TEXT_SIZE = 72* _scale; var TEXT_SIZE = 72* _scale;
var TEXT_COLOR = "#ff2020"; var TEXT_COLOR = "#ff2020";
var tipsText = new createjs.Text(_tipsTxt, "bold " + TEXT_SIZE + "px Helvetica", TEXT_COLOR); var tipsText = new createjs.Text(_tipsTxt, "bold " + TEXT_SIZE + "px Helvetica", TEXT_COLOR);
var screenX = _stage.canvas.width; var screenX1 = _stage.canvas.width;
var screenY = _stage.canvas.height; var screenY1 = _stage.canvas.height;
tipsText.x = (screenX) / 2 | 0; tipsText.x = (screenX1) / 2 | 0;
tipsText.y = screenY/2 - tipsText.getBounds().height*5/4 | 0; tipsText.y = screenY1/2 - tipsText.getBounds().height*5/4 | 0;
tipsText.shadow = new createjs.Shadow("white", 3, 3, 2); tipsText.shadow = new createjs.Shadow("white", 3, 3, 2);
tipsText.textAlign = "center"; tipsText.textAlign = "center";
@@ -104,6 +104,7 @@ function soundPlay(name)
if(typeof name == "string") { if(typeof name == "string") {
return createjs.Sound.play(name); return createjs.Sound.play(name);
} else { } else {
name.stop(); //12/21/2014 , for support soundJS 0.6.0
name.play(); name.play();
} }
} }
+188 -148
Voir le fichier
@@ -64,10 +64,11 @@ function showLoadingPage()
mainStage.addChild(coverBitmap); mainStage.addChild(coverBitmap);
mainStage.update(); mainStage.update();
} }
}
function createRunnerSpriteSheet(runnerImage) function createRunnerSpriteSheet(runnerImage)
{ {
runnerData = new createjs.SpriteSheet({ runnerData = new createjs.SpriteSheet({
images: [runnerImage], images: [runnerImage],
frames: { regX:0, height: BASE_TILE_Y, regY:0, width: BASE_TILE_X}, frames: { regX:0, height: BASE_TILE_Y, regY:0, width: BASE_TILE_X},
@@ -95,8 +96,7 @@ function showLoadingPage()
fallRight : 8, fallRight : 8,
fallLeft: 17 fallLeft: 17
} }
}); });
}
} }
//***************************************************************************** //*****************************************************************************
@@ -156,22 +156,22 @@ function preloadResource()
{ src: "image/no.png", id: "no" }, { src: "image/no.png", id: "no" },
{ src: "sound/born.mp3", id:"reborn"}, { src: "sound/born.ogg", id:"reborn"},
{ src: "sound/dead.mp3", id:"dead"}, { src: "sound/dead.ogg", id:"dead"},
{ src: "sound/dig.mp3", id:"dig"}, { src: "sound/dig.ogg", id:"dig"},
{ src: "sound/getGold.mp3", id:"getGold"}, { src: "sound/getGold.ogg", id:"getGold"},
{ src: "sound/fall.mp3", id:"fall"}, { src: "sound/fall.ogg", id:"fall"},
{ src: "sound/down.mp3", id:"down"}, { src: "sound/down.ogg", id:"down"},
{ src: "sound/pass.mp3", id:"pass"}, { src: "sound/pass.ogg", id:"pass"},
{ src: "sound/trap.mp3", id:"trap"}, { src: "sound/trap.ogg", id:"trap"},
{ src: "sound/goldFinish.mp3", id:"goldFinish"}, { src: "sound/goldFinish.ogg", id:"goldFinish"},
{ src: "sound/ending.mp3", id:"ending"}, { src: "sound/ending.ogg", id:"ending"},
{ src: "sound/scoreBell.mp3", id:"scoreBell"}, { src: "sound/scoreBell.ogg", id:"scoreBell"},
{ src: "sound/scoreCount.mp3", id:"scoreCount"}, { src: "sound/scoreCount.ogg", id:"scoreCount"},
{ src: "sound/scoreEnding.mp3", id:"scoreEnding"}, { src: "sound/scoreEnding.ogg", id:"scoreEnding"},
{ src: "sound/beep.mp3", id:"beep"}, { src: "sound/beep.ogg", id:"beep"},
{ src: "cursor/openhand.cur", id:"openHand"}, //preload cursor { src: "cursor/openhand.cur", id:"openHand"}, //preload cursor
{ src: "cursor/closedhand.cur", id:"closeHand"} { src: "cursor/closedhand.cur", id:"closeHand"}
@@ -179,7 +179,7 @@ function preloadResource()
]; ];
preload = new createjs.LoadQueue(true); preload = new createjs.LoadQueue(true);
createjs.Sound.alternateExtensions = ["ogg"]; createjs.Sound.alternateExtensions = ["mp3"];
preload.installPlugin(createjs.Sound); preload.installPlugin(createjs.Sound);
preload.on("error", handleFileError); preload.on("error", handleFileError);
preload.on("progress", handleProgress); preload.on("progress", handleProgress);
@@ -228,136 +228,11 @@ function preloadResource()
{ {
percentTxt.text = "100%"; percentTxt.text = "100%";
mainStage.update(); mainStage.update();
createSpriteSheet(); createPreloadSpriteSheet();
createSoundInstance(); createSoundInstance();
setTimeout(clearLoadingInfo, 500); setTimeout(clearLoadingInfo, 500);
} }
function createSpriteSheet()
{
guardData = new createjs.SpriteSheet({
images: [preload.getResult("guard")],
frames: {regX:0, height: BASE_TILE_Y, regY: 0, width: BASE_TILE_X},
animations: {
runRight: [0,2, "runRight", GUARD_SPEED],
runLeft : [3,5, "runLeft", GUARD_SPEED],
runUpDn : [6,7, "runUpDn", GUARD_SPEED],
barRight: {
frames: [ 11, 12, 12, 13, 13 ],
next: "barRight",
speed: GUARD_SPEED
},
barLeft: {
frames: [ 14, 15, 15, 16, 16 ],
next: "barLeft",
speed: GUARD_SPEED
},
reborn: {
frames: [ 17, 17, 18 ],
speed: GUARD_SPEED
},
fallRight : 8,
fallLeft: 19,
shakeRight: {
frames: [ 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8,
9, 10, 9, 10, 8 ],
next: null,
speed: GUARD_SPEED
},
shakeLeft: {
frames: [ 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,
20, 21, 20, 21, 19],
next: null,
speed: GUARD_SPEED
}
}
});
holeData = new createjs.SpriteSheet( {
images: [preload.getResult("hole")],
frames: [
//dig hole Left
[BASE_TILE_X*0,0,BASE_TILE_X,BASE_TILE_Y*2], //0 [x,y, width, height]
[BASE_TILE_X*1,0,BASE_TILE_X,BASE_TILE_Y*2], //1
[BASE_TILE_X*2,0,BASE_TILE_X,BASE_TILE_Y*2], //2
[BASE_TILE_X*3,0,BASE_TILE_X,BASE_TILE_Y*2], //3
[BASE_TILE_X*4,0,BASE_TILE_X,BASE_TILE_Y*2], //4
[BASE_TILE_X*5,0,BASE_TILE_X,BASE_TILE_Y*2], //5
[BASE_TILE_X*6,0,BASE_TILE_X,BASE_TILE_Y*2], //6
[BASE_TILE_X*7,0,BASE_TILE_X,BASE_TILE_Y*2], //7
//dig hole right
[BASE_TILE_X*0,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //08
[BASE_TILE_X*1,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //09
[BASE_TILE_X*2,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //10
[BASE_TILE_X*3,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //11
[BASE_TILE_X*4,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //12
[BASE_TILE_X*5,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //13
[BASE_TILE_X*6,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //14
[BASE_TILE_X*7,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //15
//fill hole
[BASE_TILE_X*8,0, BASE_TILE_X,BASE_TILE_Y], //16
[BASE_TILE_X*8,BASE_TILE_Y, BASE_TILE_X,BASE_TILE_Y], //17
[BASE_TILE_X*8,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y], //18
[BASE_TILE_X*8,BASE_TILE_Y*3,BASE_TILE_X,BASE_TILE_Y] //19
],
animations: {
digHoleLeft: [0, 7, false, DIG_SPEED],
digHoleRight: [8,15, false, DIG_SPEED],
fillHole: {
frames: [16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 18, 18, 19 ], //delay fill time for champLevel, 2014/04/12
next: false,
speed: FILL_SPEED
}
}
});
holeObj.sprite = new createjs.Sprite(holeData, "digHoleLeft");
holeObj.action = ACT_STOP; //no digging
textData = new createjs.SpriteSheet({
images: [preload.getResult("text")],
frames: {regX:0, height: BASE_TILE_Y, regY: 0, width: BASE_TILE_X},
animations: {
"N0": 0, "N1": 1, "N2": 2, "N3": 3, "N4": 4,
"N5": 5, "N6": 6, "N7": 7, "N8": 8, "N9": 9,
"A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15, "G": 16, "H": 17,
"I": 18, "J": 19, "K": 20, "L": 21, "M": 22, "N": 23, "O": 24, "P": 25,
"Q": 26, "R": 27, "S": 28, "T": 29, "U": 30, "V": 31, "W": 32, "X": 33,
"Y": 34, "Z": 35,
"DOT": 36, "LT": 37, "GT": 38, "DASH": 39,
"@":40, //gold
"#":41, //trap
"SPACE":43,
"FLASH": {
frames: [42, 42, 42, 43, 43, 43],
next: "FLASH",
speed: FLASH_SPEED
}
}
});
}
function createSoundInstance() function createSoundInstance()
{ {
@@ -401,10 +276,11 @@ function preloadResource()
function createMenuBitmapIcon() function createMenuBitmapIcon()
{ {
mainMenuIconBitmap = new createjs.Bitmap(preload.getResult("menu")); mainMenuIconBitmap = new createjs.Bitmap(preload.getResult("menu"));
mainMenuIconObj = new mainMenuIconClass(screenX, screenY, tileScale, mainMenuIconBitmap); mainMenuIconObj = new mainMenuIconClass(screenX1, screenY1, tileScale, mainMenuIconBitmap);
selectIconBitmap = new createjs.Bitmap(preload.getResult("select")); selectIconBitmap = new createjs.Bitmap(preload.getResult("select"));
selectIconObj = new selectIconClass(screenX, screenY, tileScale, selectIconBitmap); selectIconObj = new selectIconClass(screenX1, screenY1, tileScale, selectIconBitmap);
checkBitmap = new createjs.Bitmap(preload.getResult("check")); checkBitmap = new createjs.Bitmap(preload.getResult("check"));
@@ -434,3 +310,167 @@ function preloadResource()
waitIdleDemo(4000); //wait user key or show demo level waitIdleDemo(4000); //wait user key or show demo level
} }
} }
//==============================
// support different AI-version
//==============================
var spriteSpeed = [
{ runnerSpeed: 0.65, guardSpeed: 0.3, digSpeed: 0.68, fillSpeed: 0.24, xMoveBase: 8, yMoveBase: 8 }, //ver 1
{ runnerSpeed: 0.70, guardSpeed: 0.35, digSpeed: 0.68, fillSpeed: 0.27, xMoveBase: 8, yMoveBase: 9 } //ver 2
];
var curAiVersion = AI_VERSION;
function setSpeedByAiVersion()
{
var speedObj = spriteSpeed[curAiVersion-1];
RUNNER_SPEED = speedObj.runnerSpeed;
GUARD_SPEED = speedObj.guardSpeed;
DIG_SPEED = speedObj.digSpeed;
FILL_SPEED = speedObj.fillSpeed;
//xMove = speedObj.xMoveBase * tileScale; //8, 6, 4 (10, 7.5, 5)
//yMove = speedObj.yMoveBase * tileScale; //8, 6, 4 (10, 7.5, 5)
xMove = speedObj.xMoveBase;
yMove = speedObj.yMoveBase;
//W4 = (tileW/4|0)+ speedObj.w4; //no used
//H4 = (tileH/4|0)+ speedObj.h4;
createSpriteSheet();
}
function createSpriteSheet()
{
createRunnerSpriteSheet(coverPageLoad.getResult("runner"));
createPreloadSpriteSheet();
}
function createPreloadSpriteSheet()
{
guardData = new createjs.SpriteSheet({
images: [preload.getResult("guard")],
frames: {regX:0, height: BASE_TILE_Y, regY: 0, width: BASE_TILE_X},
animations: {
runRight: [0,2, "runRight", GUARD_SPEED],
runLeft : [3,5, "runLeft", GUARD_SPEED],
runUpDn : [6,7, "runUpDn", GUARD_SPEED],
barRight: {
frames: [ 11, 12, 12, 13, 13 ],
next: "barRight",
speed: GUARD_SPEED
},
barLeft: {
frames: [ 14, 15, 15, 16, 16 ],
next: "barLeft",
speed: GUARD_SPEED
},
reborn: {
frames: [ 17, 17, 18 ],
speed: GUARD_SPEED
},
fallRight : 8,
fallLeft: 19,
shakeRight: {
frames: [ 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8,
9, 10, 9, 10, 8 ],
next: null,
speed: GUARD_SPEED
},
shakeLeft: {
frames: [ 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,
20, 21, 20, 21, 19],
next: null,
speed: GUARD_SPEED
}
}
});
holeData = new createjs.SpriteSheet( {
images: [preload.getResult("hole")],
frames: [
//dig hole Left
[BASE_TILE_X*0,0,BASE_TILE_X,BASE_TILE_Y*2], //0 [x,y, width, height]
[BASE_TILE_X*1,0,BASE_TILE_X,BASE_TILE_Y*2], //1
[BASE_TILE_X*2,0,BASE_TILE_X,BASE_TILE_Y*2], //2
[BASE_TILE_X*3,0,BASE_TILE_X,BASE_TILE_Y*2], //3
[BASE_TILE_X*4,0,BASE_TILE_X,BASE_TILE_Y*2], //4
[BASE_TILE_X*5,0,BASE_TILE_X,BASE_TILE_Y*2], //5
[BASE_TILE_X*6,0,BASE_TILE_X,BASE_TILE_Y*2], //6
[BASE_TILE_X*7,0,BASE_TILE_X,BASE_TILE_Y*2], //7
//dig hole right
[BASE_TILE_X*0,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //08
[BASE_TILE_X*1,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //09
[BASE_TILE_X*2,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //10
[BASE_TILE_X*3,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //11
[BASE_TILE_X*4,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //12
[BASE_TILE_X*5,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //13
[BASE_TILE_X*6,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //14
[BASE_TILE_X*7,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y*2], //15
//fill hole
[BASE_TILE_X*8,0, BASE_TILE_X,BASE_TILE_Y], //16
[BASE_TILE_X*8,BASE_TILE_Y, BASE_TILE_X,BASE_TILE_Y], //17
[BASE_TILE_X*8,BASE_TILE_Y*2,BASE_TILE_X,BASE_TILE_Y], //18
[BASE_TILE_X*8,BASE_TILE_Y*3,BASE_TILE_X,BASE_TILE_Y] //19
],
animations: {
digHoleLeft: [0, 7, false, DIG_SPEED],
digHoleRight: [8,15, false, DIG_SPEED],
fillHole: {
frames: [16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 18, 18, 19 ], //delay fill time for champLevel, 2014/04/12
next: false,
speed: FILL_SPEED
}
}
});
holeObj.sprite = new createjs.Sprite(holeData, "digHoleLeft");
holeObj.action = ACT_STOP; //no digging
textData = new createjs.SpriteSheet({
images: [preload.getResult("text")],
frames: {regX:0, height: BASE_TILE_Y, regY: 0, width: BASE_TILE_X},
animations: {
"N0": 0, "N1": 1, "N2": 2, "N3": 3, "N4": 4,
"N5": 5, "N6": 6, "N7": 7, "N8": 8, "N9": 9,
"A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15, "G": 16, "H": 17,
"I": 18, "J": 19, "K": 20, "L": 21, "M": 22, "N": 23, "O": 24, "P": 25,
"Q": 26, "R": 27, "S": 28, "T": 29, "U": 30, "V": 31, "W": 32, "X": 33,
"Y": 34, "Z": 35,
"DOT": 36, "LT": 37, "GT": 38, "DASH": 39,
"@":40, //gold
"#":41, //trap
"SPACE":43,
"FLASH": { //42 & 43
frames: [42, 42, 42, 43, 43, 43],
next: "FLASH",
speed: FLASH_SPEED
},
"D0": 50, "D1": 51, "D2": 52, "D3": 53, "D4": 54, //blue digit number for player name, 11/17/2014
"D5": 55, "D6": 56, "D7": 57, "D8": 58, "D9": 59
}
});
}
+46 -35
Voir le fichier
@@ -158,7 +158,7 @@ function runnerMoveStep(action, stayCurrPos )
map[x][y].act = curToken; //runner move to [x][y-1], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x][y-1], so set [x][y].act to previous state
y--; y--;
yOffset = tileH + yOffset; yOffset = tileH + yOffset;
if(map[x][y].act == GUARD_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == GUARD_T && guardAlive(x,y)) setRunnerDead(); //collision
} }
newShape = "runUpDn"; newShape = "runUpDn";
} }
@@ -189,7 +189,7 @@ function runnerMoveStep(action, stayCurrPos )
map[x][y].act = curToken; //runner move to [x][y+1], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x][y+1], so set [x][y].act to previous state
y++; y++;
yOffset = yOffset - tileH; yOffset = yOffset - tileH;
if(map[x][y].act == GUARD_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == GUARD_T && guardAlive(x,y)) setRunnerDead(); //collision
} }
if(action == ACT_DOWN) { if(action == ACT_DOWN) {
@@ -227,7 +227,7 @@ function runnerMoveStep(action, stayCurrPos )
map[x][y].act = curToken; //runner move to [x-1][y], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x-1][y], so set [x][y].act to previous state
x--; x--;
xOffset = tileW + xOffset; xOffset = tileW + xOffset;
if(map[x][y].act == GUARD_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == GUARD_T && guardAlive(x,y)) setRunnerDead(); //collision
} }
if(curToken == BAR_T) newShape = "barLeft"; if(curToken == BAR_T) newShape = "barLeft";
else newShape = "runLeft"; else newShape = "runLeft";
@@ -247,7 +247,7 @@ function runnerMoveStep(action, stayCurrPos )
map[x][y].act = curToken; //runner move to [x+1][y], so set [x][y].act to previous state map[x][y].act = curToken; //runner move to [x+1][y], so set [x][y].act to previous state
x++; x++;
xOffset = xOffset - tileW; xOffset = xOffset - tileW;
if(map[x][y].act == GUARD_T) gameState = GAME_RUNNER_DEAD; //collision if(map[x][y].act == GUARD_T && guardAlive(x,y)) setRunnerDead(); //collision
} }
if(curToken == BAR_T) newShape = "barRight"; if(curToken == BAR_T) newShape = "barRight";
else newShape = "runRight"; else newShape = "runRight";
@@ -268,8 +268,8 @@ function runnerMoveStep(action, stayCurrPos )
runner.action = ACT_STOP; runner.action = ACT_STOP;
} }
} else { } else {
runner.sprite.x = x * tileW + xOffset; runner.sprite.x = (x * tileW + xOffset) * tileScale | 0;
runner.sprite.y = y * tileH + yOffset; runner.sprite.y = (y * tileH + yOffset) * tileScale | 0;
runner.pos = { x:x, y:y, xOffset:xOffset, yOffset:yOffset}; runner.pos = { x:x, y:y, xOffset:xOffset, yOffset:yOffset};
if(curShape != newShape) { if(curShape != newShape) {
runner.sprite.gotoAndPlay(newShape); runner.sprite.gotoAndPlay(newShape);
@@ -339,7 +339,7 @@ function addGold(x, y)
map[x][y].base = GOLD_T; map[x][y].base = GOLD_T;
tile = map[x][y].bitmap = new createjs.Bitmap(preload.getResult("gold")); tile = map[x][y].bitmap = new createjs.Bitmap(preload.getResult("gold"));
tile.setTransform(x * tileW, y * tileH,tileScale, tileScale); //x,y, scaleX, scaleY tile.setTransform(x * tileWScale, y * tileHScale,tileScale, tileScale); //x,y, scaleX, scaleY
mainStage.addChild(tile); mainStage.addChild(tile);
moveSprite2Top(); //reset runner, guard & fill hole object order moveSprite2Top(); //reset runner, guard & fill hole object order
@@ -391,30 +391,21 @@ function checkCollision(runnerX, runnerY)
if( guard[i].pos.x == x && guard[i].pos.y == y) break; if( guard[i].pos.x == x && guard[i].pos.y == y) break;
} }
assert( (i < guardCount), "checkCollision design error !"); assert( (i < guardCount), "checkCollision design error !");
if(guard[i].action != ACT_REBORN) { if(guard[i].action != ACT_REBORN) { //only guard alive need check collection
var dw = Math.abs(runner.sprite.x - guard[i].sprite.x); //var dw = Math.abs(runner.sprite.x - guard[i].sprite.x);
var dh = Math.abs(runner.sprite.y - guard[i].sprite.y); //var dh = Math.abs(runner.sprite.y - guard[i].sprite.y);
//debug (" dw = " + dw +"(" + tileW + ") dh = " + dh + "(" + tileH + ")" );
/*
debug("runner:" + runner.pos.x + ","
+ runner.pos.y + ","
+ "guard:" + guard[i].pos.x + ","
+ guard[i].pos.y + ","
+ "runner:" + runner.pos.xOffset + "," //change detect method ==> don't depend on scale
+ runner.pos.yOffset + "," var runnerPosX = runner.pos.x*tileW+runner.pos.xOffset;
+ "guard:" + guard[i].pos.xOffset + "," var runnerPosY = runner.pos.y*tileH+runner.pos.yOffset;
+ guard[i].pos.yOffset var guardPosX = guard[i].pos.x*tileW+guard[i].pos.xOffset;
); var guardPosY = guard[i].pos.y*tileH+guard[i].pos.yOffset;
*/
/* var dw = Math.abs(runnerPosX - guardPosX);
if( Math.abs(runner.sprite.x - guard[i].sprite.x) < tileW && var dh = Math.abs(runnerPosY - guardPosY);
Math.abs(runner.sprite.y - guard[i].sprite.y) < tileH)
*/ if( dw <= W4*3 && dh <= H4*3 ) {
if( Math.abs(runner.sprite.x - guard[i].sprite.x) <= W4*3 && setRunnerDead(); //07/04/2014
Math.abs(runner.sprite.y - guard[i].sprite.y) <= H4*3 )
{
gameState = GAME_RUNNER_DEAD;
//debug("runner dead!"); //debug("runner dead!");
} }
} }
@@ -477,7 +468,7 @@ function digHole(action)
holeObj.sprite.gotoAndPlay(holeShape); holeObj.sprite.gotoAndPlay(holeShape);
holeObj.action = ACT_DIGGING; holeObj.action = ACT_DIGGING;
holeObj.pos = { x: x, y: y }; holeObj.pos = { x: x, y: y };
holeObj.sprite.setTransform(x * tileW, y * tileH,tileScale, tileScale); holeObj.sprite.setTransform(x * tileWScale, y * tileHScale,tileScale, tileScale);
// the callback is called each time a sequence completes: // the callback is called each time a sequence completes:
holeObj.sprite.on("animationend", digComplete); holeObj.sprite.on("animationend", digComplete);
@@ -567,7 +558,8 @@ function fillHole(x, y)
{ {
var fillSprite = new createjs.Sprite(holeData, "fillHole"); var fillSprite = new createjs.Sprite(holeData, "fillHole");
fillSprite.setTransform(x * tileW, y * tileH,tileScale, tileScale); fillSprite.pos = { x:x, y:y }; //save position 11/18/2014
fillSprite.setTransform(x * tileWScale, y * tileHScale, tileScale, tileScale);
fillSprite.on("animationend", fillComplete); fillSprite.on("animationend", fillComplete);
fillSprite.play(); fillSprite.play();
mainStage.addChild(fillSprite); mainStage.addChild(fillSprite);
@@ -583,8 +575,11 @@ function moveFillHoleObj2Top()
function fillComplete() function fillComplete()
{ {
var x = this.x / tileW | 0; //this : scope default to the dispatcher //don't use "divide command", it will cause loss of accuracy while scale changed (ex: tileScale = 0.6...)
var y = this.y / tileH | 0; //var x = this.x / tileWScale | 0; //this : scope default to the dispatcher
//var y = this.y / tileHScale | 0;
var x = this.pos.x, y = this.pos.y; //get position
map[x][y].bitmap.set({alpha:1}); //display block map[x][y].bitmap.set({alpha:1}); //display block
this.removeAllEventListeners ("animationend"); this.removeAllEventListeners ("animationend");
@@ -597,7 +592,7 @@ function fillComplete()
gameState = GAME_RUNNER_DEAD; gameState = GAME_RUNNER_DEAD;
runner.sprite.set({alpha:0}); //hidden runner --> dead runner.sprite.set({alpha:0}); //hidden runner --> dead
break; break;
case GUARD_T: case GUARD_T: //guard dead
var id = getGuardId(x,y); var id = getGuardId(x,y);
if(guard[id].hasGold > 0) { //guard has gold and not fall into the hole if(guard[id].hasGold > 0) { //guard has gold and not fall into the hole
decGold(); decGold();
@@ -625,3 +620,19 @@ function removeFillHoleObj(spriteObj)
} }
debug("removeFillHoleObj: design error!"); debug("removeFillHoleObj: design error!");
} }
//==================================
// Check guard is alive or not
// 2014/10/31
//==================================
function guardAlive(x, y)
{
for(var i = 0; i < guardCount; i++) {
if( guard[i].pos.x == x && guard[i].pos.y == y) break;
}
assert( (i < guardCount), "guardAlive() design error !");
if(guard[i].action != ACT_REBORN) return 1; //alive
return 0; //reborn
}
+753 -542
Voir le fichier
Fichier diff supprimé car celui-ci est trop grand Voir la Diff
+47 -8
Voir le fichier
@@ -37,6 +37,8 @@ value | Character | Type
0x9 | & | Player 0x9 | & | Player
2014/10/18 add support dump Revenge_of_Lode_Runner disk
2014/10/18 add support c64 codes
**********************************************************************************/ **********************************************************************************/
#include <stdio.h> #include <stdio.h>
@@ -48,20 +50,29 @@ value | Character | Type
#define READ_LEVEL_DATA_SIZE (256) #define READ_LEVEL_DATA_SIZE (256)
#define ONE_LEVEL_DATA_SIZE (224) #define ONE_LEVEL_DATA_SIZE (224)
#if 1 #define APPLE_DISK_NO (3)
#if (APPLE_DISK_NO == 1)
#define FILE_NAME "Lode_Runner_Apple-II.dsk" #define FILE_NAME "Lode_Runner_Apple-II.dsk"
#define MAX_LEVEL (150) #define MAX_LEVEL (150)
#define TITLE_NAME "Lode Runner (Apple-II 1983)" #define TITLE_NAME "Lode Runner (Apple-II 1983)"
#define DATA_VAR_NAME "baseLevelData" #define DATA_VAR_NAME "baseLevelData"
#else #elif (APPLE_DISK_NO == 2)
#define FILE_NAME "Lode_Runner_Championship _Apple-II.dsk" #define FILE_NAME "Lode_Runner_Championship _Apple-II.dsk"
#define MAX_LEVEL (50) #define MAX_LEVEL (50)
#define TITLE_NAME "Championship Lode Runner (Apple-II 1984)" #define TITLE_NAME "Championship Lode Runner (Apple-II 1984)"
#define DATA_VAR_NAME "champLevelData" #define DATA_VAR_NAME "champLevelData"
#elif (APPLE_DISK_NO == 3)
#define FILE_NAME "Revenge_of_Lode_Runner.dsk"
#define MAX_LEVEL (25)
#define TITLE_NAME "Revenge of Lode Runner (Apple-II 1986)"
#define DATA_VAR_NAME "RevengeLevelData"
#endif #endif
char tileType[] = { char tileType[] = {
@@ -82,14 +93,18 @@ int goodLevel(unsigned char *levelData)
{ {
int i; int i;
unsigned char leftTile, rightTile; unsigned char leftTile, rightTile;
int allZero = 1;
for(i = 0; i < ONE_LEVEL_DATA_SIZE; i++) { for(i = 0; i < ONE_LEVEL_DATA_SIZE; i++) {
//levelData[i] = levelData[i] ^ 0xFF;
leftTile = levelData[i] & 0xF; leftTile = levelData[i] & 0xF;
rightTile = levelData[i] >> 0x04; rightTile = levelData[i] >> 0x04;
if(leftTile >= MAX_TILE_TYPE || rightTile >= MAX_TILE_TYPE) { if(leftTile >= MAX_TILE_TYPE || rightTile >= MAX_TILE_TYPE) {
return 0; return 0;
} }
if(leftTile != 0 || rightTile != 0) allZero = 0;
} }
return !allZero;
return 1; //OK return 1; //OK
} }
@@ -150,13 +165,17 @@ int main(void)
FILE *fp; FILE *fp;
unsigned char levelData[READ_LEVEL_DATA_SIZE]; unsigned char levelData[READ_LEVEL_DATA_SIZE];
int curLevel = 0; int curLevel = 0;
int readSize= 0, isGood;
unsigned long curPos = 0x3000L;
unsigned long dspPos = curPos;
int doubleError = 0;
if((fp = fopen(FILE_NAME, "r")) ==NULL) { if((fp = fopen(FILE_NAME, "rb")) ==NULL) {
printf("Open file %d failed !\n", FILE_NAME); printf("Open file \"%s\" failed !\n", FILE_NAME);
return 1; return 1;
} }
if(fseek(fp, 0x3000L, SEEK_SET) != 0) { if(fseek(fp, curPos, SEEK_SET) != 0) {
printf("Fseek error ! @%d\n", __LINE__); printf("Fseek error ! @%d\n", __LINE__);
fclose(fp); fclose(fp);
return 1; return 1;
@@ -165,13 +184,33 @@ int main(void)
dumpTitle(); dumpTitle();
printf("var %s = [\n", DATA_VAR_NAME); printf("var %s = [\n", DATA_VAR_NAME);
#ifdef C64
do {
#endif
while(curLevel < MAX_LEVEL && while(curLevel < MAX_LEVEL &&
fread(levelData, sizeof(char), READ_LEVEL_DATA_SIZE, fp) == READ_LEVEL_DATA_SIZE && (readSize = fread(levelData, sizeof(char), READ_LEVEL_DATA_SIZE, fp)) == READ_LEVEL_DATA_SIZE &&
goodLevel(levelData) (isGood = goodLevel(levelData))
){ ){
//dumpLevel(++curLevel, levelData); //dumpLevel(++curLevel, levelData);
//printf("%x", dspPos);
dumpLevel4JavaScript(++curLevel, levelData); dumpLevel4JavaScript(++curLevel, levelData);
dspPos += READ_LEVEL_DATA_SIZE;
doubleError=0;
} }
#ifdef C64
doubleError++;
if(!isGood) {
curPos += 0x1500L;
dspPos = curPos;
if(fseek(fp, curPos, SEEK_SET) != 0) {
printf("Fseek error ! @%d\n", __LINE__);
fclose(fp);
return 1;
}
} else doubleError++;
} while(curLevel < MAX_LEVEL && doubleError <= 1);
#endif
printf("];\n"); printf("];\n");
fclose(fp); fclose(fp);
Fichier binaire non affiché.
Fichier binaire non affiché.