Hashasm

Members
  • Content count

    93
  • Joined

  • Last visited

  1. Error during chrome version change

    hi guys , is anyone find out the solution for the above problem please let me know if you guys find anything on the same
  2. Error during chrome version change

    @obiot It will work for the chrome version which you are using. Only for version 59.0.3071.86 it is not working I checked the link. Its showing the same error in this particular version of chrome. Please check the images.
  3. Error during chrome version change

    yes in the same stack ..
  4. Error during chrome version change

    hi , I checked on that lines lines 20135 and 20136 its giving the proper coordinate value not returning any NAN . i wonder why only for this browser version its giving such error. Note my melon version is : melonJS 4.1.1
  5. Error during chrome version change

    here is the description screen it may help you to understand the error @Parasyte
  6. how to clear cache

    Hi guys , I am almost done with my game now the only thing to take care is browser cache .. the problem is when I am changing my json through playing game and if i am trying to fetch that json tmx file its still giving me the wrong input until i clear my cache and if i clear my cache and cookie my session also removing .. is their any way to clear my cache without affecting my session through melon or simple javascript.. please let me know. i am using chrome and mozilla! thanks HAPPY GAMING
  7. moving cars on roads

    hi all, @Parasyte i found the solution , but i dint change my code , what i did is passing the co-ordinates by converting row and col values .. but before i was passing the coordinates by using event.gameWorld .. but i am curious to understand in depth about setting velocity and acceleration . if you have any resource for the same please share with me thank you
  8. moving cars on roads

    hi @01271 can you tell me wether i am updating velocity in correct place or not game.PlayerEntity = me.Entity.extend({ // _patrol_isReverse: false, init: function(data,rand_color) { this.patrol_path = []; this.patrol_isReverse = false; this.patrol_isInfinite = true; var settings={} //console.log(this.gameWorldX+" "+this.clientX); /* var roadlayer =me.game.world.getChildByName("waterLayer")[0]; var tile= roadlayer.getTile(this.gameWorldX, this.gameWorldY); console.log(tile.row+""+tile.col); */ var vehicle_name; // console.log(data.frequency) if(data.frequency=="RealTime"){ // vehicle_name="chopper"; vehicle_name="scooter_"+rand_color; // vehicle_name="truck_"+rand_color; } else if(data.frequency=="Daily"){ // vehicle_name="van_"+rand_color; // vehicle_name="mini_truck_"+rand_color; // vehicle_name="HORSE_CARRIAGE_"+rand_color; vehicle_name="chopper_"+rand_color; // vehicle_name="chopper_float-01"; } else if (data.frequency=="Monthly"){ vehicle_name="car_"+rand_color; } else if(data.frequency=="BiWeekly"){ vehicle_name="HORSE_CARRIAGE"; } else{ vehicle_name="scooter_"+rand_color; } game.texture = new me.video.renderer.Texture( { framewidth : 48, frameheight : 48, anchorPoint : new me.Vector2d(0.5, 0.5) }, me.loader.getImage(vehicle_name) //make this dynamic ); var obj = game.texture.getAtlas() //make this dynamic settings.width = 0; settings.height =0; var x=data.path[0].x; var y= data.path[0].y; console.log("x"+x+" ==y=="+y); this._super(me.Entity, "init", [/*7324, 3702*/x,y, settings]); this.body.setVelocity(1.8,1.8); this.renderable = game.texture.createAnimationFromName([0, 1, 2, 3/*, 4, 5, 6, 7,*/ ]); for(var i=0;i<data.path.length;i++){ this.patrol_addPoint( new me.Vector2d(data.path.x, data.path.y)); console.log( new me.Vector2d(data.path[0].x, data.path[0].y)) } this.renderable.addAnimation( "down", [ 2 ] ); this.renderable.addAnimation( "left", [0] ); this.renderable.addAnimation( "right", [3 ] ); this.renderable.addAnimation( "up", [1] ); this.afterPatrolFinished = function(){ console.log("patrol finished"); me.game.world.removeChild(this) }; this.patrol_walk(); }, patrol_addPoint:function(point){ this.patrol_path.push(point); }, patrol_walk:function(){ this._isWalking = true; if( !this._target && this.patrol_path[ 0 ] ) { this._target = this.patrol_path[ 0 ]; } this._setDirection(this._target.x - this.pos.x, this._target.y - this.pos.y); this.renderable.setCurrentAnimation( this.direction ); }, _setDirection: function( dx, dy ) { if(dx>0&&dy<0){ this.direction = "up"; } else if(dx<0&&dy>0){ this.direction="down"; } else if(dx<0&&dy<0){ this.direction="left"; }else{ this.direction="right"; } }, update: function(dt) { if( !this._isWalking ){ return false; } this._calculateStep(); this.body.update(dt); return (this._super(me.Entity, 'update', [dt]) || this.body.vel.x !== 0 || this.body.vel.y !== 0); }, _calculateStep: function( ) { if( this._target ) { var dx = this._target.x - this.pos.x; var dy = this._target.y - this.pos.y; console.log("this.pos.x"); console.log(this.pos.x+"=="+this.pos.y); console.log(this._target); console.log(dx+"=="+dy); if( Math.abs( dx ) < this.body.maxVel.x && Math.abs( dy ) < this.body.maxVel.x ) { var idx = this.patrol_path.indexOf( this._target ); console.log(idx); //next point index idx++; if( idx == ( this.patrol_path.length ) ) { delete this._target; if(typeof this.afterPatrolFinished === 'function'){ this.afterPatrolFinished(); } if( this.patrol_isReverse ){ this.patrol_path.reverse( ); } if( this.patrol_isInfinite){ this.patrol_isInfinite = false; } } else { this._target = this.patrol_path[ idx ]; this._setDirection(this._target.x - this.pos.x, this._target.y - this.pos.y); this.renderable.setCurrentAnimation( this.direction ); } return; } var angle = Math.atan2( this._target.y - this.pos.y, this._target.x - this.pos.x ) ; this.body.vel.x = Math.cos( angle ) * this.body.accel.x+1.9 /** me.timer.tick*/; this.body.vel.y = Math.sin( angle ) * this.body.accel.y*0.5 /** me.timer.tick*/; } else { this.body.vel.x = 0; this.body.vel.y = 0; } }, /** * Stop walking */ patrol_stop: function( ) { this._isWalking = false; }, /** * Set reverse. * When is reverse, the movement is there and back * @param {boolean} */ patrol_setReverse: function( isReverse ) { this.patrol_isReverse = isReverse; }, /** * Set infinite. * When is infinite, the movement is in an endless loop * @param {boolean} */ patrol_setInfinite: function( isInfinite ) { this.patrol_isInfinite = isInfinite; }, onCollision : function (/*response, other*/) { return true; } });
  9. shrink map to fit my canvas(viewport)

    I wanted to plot my big 6600*13200 map fix into my viewport and my canvas size is 1000*1440 as mentioned in https://github.com/melonjs/melonJS/issues/4
  10. shrink map to fit my canvas(viewport)

    yeah i tried it before also its also zooming as shown in the below image. and i used me.game.world which return my tiled map and i tried to scale it then also its coming as same as below image
  11. shrink map to fit my canvas(viewport)

    hey guys i understand something correct me if i am wrong . here our canvas widt and height is not changing i am changing my viewport only, me.game.viewport.scale(0.5,0.5) which means the area which we are able to see its a viewport right .so i am thinking we need to update or redraw or repaint it but i am not getting where to do it please help me crak it Thank You ,I hope you guys were understanding ..
  12. shrink map to fit my canvas(viewport)

    @obiot i gone through that discussion it wont help me much i want to resize the currentLevel which is loaded on the canvas https://groups.google.com/forum/#!topic/melonjs/7dUEQGsutjI i gone through this also but no luck .. is their any function which i can get the map and scale it how we moving map by using me.game.viewport.move(0, (me.levelDirector.getCurrentLevel().height / 2)); like this can we use to zoom in and out the map
  13. Hi guys, i am trying to shrink my 100*100 celled isometric map to fit my desktop screen on click of a button (or through scroll event). The only possible option I have managed to get is the canvas zoom-in/out feature in melonJS. It is not suiting my requirement as the border cells are not shown inside my viewport. Could you suggest if there is any better way to do this? My current code looks something like this : // register on mouse event me.input.registerPointerEvent("wheel", me.game.viewport, function (event) { me.event.publish("wheel", [ event ]); },false); this.mousewheel = me.event.subscribe("wheel", function (event) { console.log("^^^"); var viewport = me.game.viewport; //viewport.inViewport = true; if ( event.deltaY >0 ){ console.log("scrolldown"); viewport.currentTransform.scale(0.999); console.log(jq('canvas')); }else{ console.log("scrollup"); viewport.currentTransform.scale(1.001); } });
  14. moving cars on roads

    yes the update function running every frame and i want to have it in a straight line instead of sine wave.Is there any way to fix it sample code can be found here https://github.com/Kibo/melonjs-cookbook/tree/master/cookbook/patrol/js for patrol.
  15. moving cars on roads

    so far i am doing good with patrol thing but i struct at giving Velocity. car is moving on the road but its not going straight , its going in zigzag way within the road but i want it to go straight along with the road this is the code which i am using to give velocity var dx = this._target.x - this.pos.x; var dy = this._target.y - this.pos.y; var angle = Math.atan2( dy, dx ) ; //var angle = Math.atan2( dx, dy ) ; console.log( Math.cos( angle )); this.body.vel.x = Math.cos( angle ) * this.body.accel.x * me.timer.tick; this.body.vel.y = Math.sin( angle ) * this.body.accel.y * me.timer.tick; //alternate way of setting velocity....... // this.body.vel.x = dx.clamp(-1, 1) * this.body.accel.x; // this.body.vel.y = dy.clamp(-1,1) * this.body.accel.y; }