• Content count

  • Joined

  • Last visited

About espace3d

  • Rank
    Advanced Member
  1. Common Phaser + CocoonJS issues

    hi, Have you this effect ?... When i run my game on chrome or firefox my tweens works very well. Exactly the same on my android phone with my game's site. But when i 'm on cocoon with webview mode the tweens works not properly (it seems appears after changing a state)... Sometimes i just see the end of the transition or the effect appears not properly. Have you similar issues and a solution for that ? Below a piece of code of my tweens : intermediate_screen=(obj,next_action) => { obj.alpha =1 obj.scale.setTo(0,0) this.tween_rotate = game.add.tween(obj).to({angle:45},1100,Phaser.Easing.Elastic.Out,true,500) this.tween_scale = game.add.tween(obj.scale).to({x:1.5,y:1.5},1100,Phaser.Easing.Elastic.Out,true,500) this.tween_alpha = game.add.tween(obj).to({alpha:1},800,Phaser.Easing.Linear.None,true,800) this.tween_alpha.onComplete.add(next_action) } //next_action is go to another state.
  2. why is not https ?

    since my post the situation have no changed...
  3. hi, i would reduce my function to create my levels. acutally i create my level directly inside my state in my main.js. i would use them on another file so i have a function with a lot of arguments eg: init_level0(_obj1,obj2,_flag,_otherparam)=>{} var level0= init_level0(player,enemy,flag,otherparam) //is it possible to do this var level0= init_level(config,otherparam) //where config is equivalent to config=[player,enemy,flag] in fact i have always the same argument in my init_level[number] and for a question of readability i would reduce the arguments. is there a way for that ?
  4. reduce state ...possible with a reuse function ?

    hi, thanks both for your response. simply an interrogation @mattstyles what is id and opts in your function ?
  5. hi, i want reduce my function inside my state with a reuse function.Is it possible ? How ? thanks for your advice . //NORMAL USAGE var level = { create :function(){ } update :function(){ }, render:function(){ }, } game= new Phaser.Game(1280,1920,Phaser.CANVAS,'game') game.state.add('boot',bootstate ) game.state.add ('level',level ) game.state.start('level',level) ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// //WHAT I WANT TO DO ///////////////////////////////////////////////////////// init_level= ()=>{ create :function(){ } update :function(){ }, render:function(){ }, } var level = { init_level() } game= new Phaser.Game(1280,1920,Phaser.CANVAS,'game') game.state.add('boot',bootstate ) game.state.add ('level',level ) game.state.start('level',level)
  6. finded var count_example=0 function countor(count) { return function () { return ++count; }; } var count_increment = countor(count_example); alert(count_increment()); // 1 alert(count_increment()); // 2 alert(count_increment()); // 3
  7. in firefox console function add(a){a=a+1; return a} add(3) //return 4 it's the same however....
  8. hi, thanks how do you do so to have a pure function ? i don't really understand what you describe to soluce that...
  9. hi, i really don't understand this ! why when i put an argument on the function in the CASE 1 and call this function with a the variable count_player it doesn't works ? in the CASE 2 it works with simply the variable as argument. Normally the CASE 1 must works, why is not the case ? //CASE 1 var count_player = 0 launch_player=(count) =>{ count++ } launch_player(count_player) //return 0 launch_player(count_player) // return always 0 //////////////////////////// //CASE 2 var count_player = 0 launch_player=(count_player) =>{ count_player++ } launch_player(count_player) //return 0 launch_player(count_player) // return 1 ok it works
  10. Can't create new objects in phaser group

    try this : var game = new Phaser.Game(448, 448, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload () { game.load.image('tabuleiro','assets/tabuleiro.png') game.load.spritesheet('devil','assets/devil.png',32,32); } function create (){ var capetinhas =; game.add.sprite(window.width,0,'tabuleiro');//loading the background game.add.sprite(128,128,'devil'); // this works capetinhas.create(32,32,'devil'); // this doesnt } function update (){ }
  11. Bouncy -Jump or Die android game

    Honestly in my game I play with 1920x1280 in resolution and I scale it for the others and it works very well perhaps it could help you
  12. reuse function and simplify this

    Nobody for an advice? The difficulty for me is that object have different parameters so create a reuse function is difficult.
  13. help with prototype

    solved var game = new Phaser.Game(800, 600,Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); //class for mechant _mechant = function(game,name,number,posx,posy,image){,game,0,0,this.image) this.number=number this.image=image this.posx=posx this.posy=posy this.anchor.setTo(.5,.5) this.inputEnabled=true this.input.enableDrag(true) this.input.enableSnap(40,40,true,true) this.sprite_for_body=game.add.sprite(this.posx,this.posy,this.image) this.sprite_for_body.anchor.setTo(.5,.5) game.physics.arcade.enable(this.sprite_for_body) this.sprite_for_body.immovable=true this.flag=true } _mechant.prototype=Object.create(Phaser.Sprite.prototype) //not necessary //_mechant.constructor=_mechant _mechant.prototype.hide=function(){ this.tween1=game.add.tween(this.scale).to({x:0,y:0},time_hide,Phaser.Easing.Bounce.In,true,0) this.tween2=game.add.tween(this.sprite_for_body.scale).to({x:0,y:0},time_hide,Phaser.Easing.Bounce.In,true,0) this.sprite_for_body.enable=false this.tween1.onComplete.add(function(){this.visible=false;this.inputEnabled=false},this) this.tween2.onComplete.add(function(){this.sprite_for_body.visible=false},this) } _mechant.prototype.update=function(){ console.log("here") console.log(this.x,"here") this.sprite_for_body.x=this.x this.sprite_for_body.y=this.y } function preload() { game.load.image('circle', ''); } function create() { var e= new _mechant(game,"mech",5,300,300,'circle') game.add.existing(e) } function update() { } function render() { } sorry for the indentation, when i use vim (the best IDE ) with html file it's not good but with js file no problem (==). in fact my problem is due to the fact that this is not assigned really, it was this.something who was declared. thanks