Jump to content


  • Content Count

  • Joined

  • Last visited

About bexphones

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I would like shake my phone to see my objects collide to the bounds of my phone. i success but the effect doesn't look great. I must rotate my phone to see this effect. What i want is only shake my phone and obtain the same result. What must i do to have this ? Thanks. here my snippet : game.world.setBounds(0,0,1400,1750) o.lot_of_roll = game.add.spriteBatch(); var stars = []; for (var i = 0; i < data.number_rolls_players; i++){ o.rolls = game.add.sprite(random(200,w-550),random(400,h),'roll_rank') game.physics.enable( [ o.rolls ], Phaser.Physics.ARCADE)
  2. hi, i have this index.html : <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>my_game</title> <style> body { margin: auto; display: table; position: absolute; border:0px; top: 0px; left: 0px; padding: 0; margin: 0; background: #1f1d24 } </style> <script src="phaser.js"></script> <script src="main.js"></script> </head> <body> </body> <script> game = new Phaser.Game( safe_zone_width + extra_width, safe_zone_height + extra_height, Phaser.CANVAS, 'game'); game.state.a
  3. hi, thanks both. it works and it works also without game in the 'create:function()' like Théo suggested _mechant = function (game, posx, posy, image) { this.image = image; this.posx = posx; this.posy = posy; Phaser.Sprite.call(this, game, this.posx, this.posy, this.image); game.add.existing(this); }; _mechant.prototype = Object.create(Phaser.Sprite.prototype); var the_game = { create: function () { this.m = new _mechant(game, 100, 100, 'green_circle'); } };
  4. hi, i would put a prototype outside a state. this code works well. var the_game = { create: function(game){ _mechant = function(posx,posy,image){ this.image=image this.posx=posx this.posy=posy Phaser.Sprite.call(this,game,this.posx,this.posy,this.image) game.add.existing(this) } _mechant.prototype=Object.create(Phaser.Sprite.prototype) this.m=new _mechant(100,100,'green_circle') }, }; But when i put the prototype outside the state (to reuse them) i have got this error : ReferenceError: game is not defined _mechant = function(posx,posy,image){ this.image
  5. Go to this there is a good template about . You need only to put the state in different files. It's all
  6. Excellent ! This works for me. Thanks for sharing. Just a question : why arrow functions don't work in canvas+ ?
  7. hi, i'm trying to implement this effect : i have a circle who's animating to incite the player to click on the screen. next the player click and release a pink player who go to an enemy ( the pink rectangle). I would like to let the player the ability to click several times to release multiple players and each time the player is inactive the animation of the circle to prompt him to click. The problem is that this animation launches several times at the same time as soon as the players are dead. How to code this to avoid this behavior? thanks for your help, becau
  8. why not particle effect when destroy enemies ?
  9. hi mattstyles, you are alright for ternary operator (condition(count) && f) ? true : false //don't work let cond = condition(count) (cond && f) ? true : false //works for the 2nd case, i have found my error. i start an another post about that. on the second post maybe you could give me some advice on my beginnings of functional programming...
  10. finded i use an array to store the tween tw_name[0]=.... or it's not necessary because i coudl use one tw_name with 2 different action (alpha and scale). it could be help someone....
  11. it's always interesting to reproduce little example i see that my function is ok ...the mistake is somewhere else in my code.... https://jsfiddle.net/espace3d/muh57trm/ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:preload, create: create, update : update }); function preload() { game.load.image('circle', 'https://s3.postimg.org/bb4aql1lf/touch.png'); } var circle var tw_name var tap_ready = true var flag=true var delay_circle_timer = 1500 //tween on the circle start_tw = (obj,tw_action,tw_name,f) => { tap_ready = true f=true tw_action(
  12. hi, I'm trying to have a animation and when i click this animation stop. https://jsfiddle.net/espace3d/5b8yqrez/ The problem is after x click the tween seems to be launch several times at the same time. However i think this snippet does not allow this....where is my error ? have you a another idea to have this behavior ? Thanks var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:preload, create: create }); function preload() { game.load.image('circle', 'https://s3.postimg.org/bb4aql1lf/touch.png'); } var _tw_name=[] var flag=true var
  13. nobody ? first case : //first console.log(condition(count)) // > true console.log(f) // > true //function 1 if (condition(count) && f){ return true }else{ return false } //return logically true ok! //function 2 but strange result (condition(count) && f) ? true : false //return false ... WHy ? second case : //function 1 > works stop_tw = (tw_name,f,obj) => { if(f){ obj.alpha=0 for(var i=0;i<tw_name.length;i++){ // works but it's the same like for_each! game.tweens.remove(tw_name[i]) } f=false } } //function 2 > don't w
  14. another mistery... function foreach(tableau,action){ for(var i=0;i<tableau.length;i++){ action(tableau[i]); } } stop_tw = (tw_name,f,obj) => { if(f){ obj.alpha=0 //foreach(tw_name,game.tweens.remove) > don't works !!!! for(var i=0;i<tw_name.length;i++){ // works but it's the same like foreach! game.tweens.remove(tw_name[i]) } f=false } }
  15. because in this case this snippet return false and i if i do : console.log(condition(count)) // > true console.log(f) // > true // so true && true must return true ???
  • Create New...