espace

Members
  • Content count

    377
  • Joined

  • Last visited

  1. hi, i make a grid with column and row and i want after add a new row below the last. how do you that ? i make several test like this example below but that don't works.... var e=[]; for (var i = 0; i < 4; i++){ e[i]=[] for (var x= 0; x < 4; x++){ e[i][x]='tile'; } } //result is //0: Array [ "tile", "tile", "tile",], //1: Array [ "tile", "tile", "tile",], //2: Array [ "tile", "tile", "tile",], //3: Array [ "tile", "tile", "tile",], //now i want to add a row a position 4 below position 3 for (var x= 0; x < 4; x++){ e.push(e[4][x]='hole'); } // expected result would be: //0: Array [ "tile", "tile", "tile",], //1: Array [ "tile", "tile", "tile",], //2: Array [ "tile", "tile", "tile",], //3: Array [ "tile", "tile", "tile",], //4: Array [ "hole", "hole", "hole",], //but don't work
  2. think solved : https://www.joshmorony.com/how-to-create-a-candy-crush-or-bejeweled-game-in-phaser/
  3. hi, i'm searching documentation about grid who give the illusion that the player move. I have found a lot of article about create a grid and move a player in a static grid but not about a "moving grid". By moving grid : i wonder a grid who delete and add line and column each time the player move in a direction, so it give the illusion that the player move on this grid. i could do alone but i have an interrogation for how to translate the data grid each time i'm add or delete line or column in my grid. second interrogation, i move my player on for example grid[3][5] but in the same time my grid move so grid[3][5] become grid[3][6] (vertical movement) how to make this ? thanks for your help.
  4. hi, instead of using a lot of prototype in my futures games, i would use this structure example. using a lot of prototype is a little confusing for me especially if there are more than 2000 lines of codes. i found this structure more easier to understand... especially use this formula : condition && action(); because almost all the time actions requires a condition to be launch. have you comments about this ? recommendations ? ps : sorry for my bad english // ------------------------------------- // HAS // ------------------------------------- var has_jump=false; var has_land=false; // ------------------------------------- // IS // ------------------------------------- var is_on_life=false; var is_game_start=false; // ------------------------------------- // PLAYER // ------------------------------------- var player={}; // ------------------------------------- // INTERFACE // ------------------------------------- var button={}; var background; var score; var text={}; // ------------------------------------- // EFFECTS => SOUNDS - ANIMATION -MOVEMENTS // ------------------------------------- var effect={}; //sounds //animation effect.score=function(){ var condition=true; var action=function(){ }; condition && action(); }; //movement effect.move_player=function(){ var condition=true; var action=function(){ }; condition && action(); }; // ------------------------------------- // RESET - RESTART STATE // ------------------------------------- var action={}; action.restart_game=function(){ var condition=true; var action=function(){ }; condition && action(); }; } // ------------------------------------- // UPDATE // ------------------------------------- var update_lower=function(){ //game.time.events.loop( time,this.function,this ); } var on_touch=function(){ }; update_lower(); // ------------------------------------- // STATE // ------------------------------------- var start_screen={ preload: function() { }, create: function() { }, update: function() { }, } var game={ preload: function() { }, create: function() { }, update: function() { }, }
  5. solved : //install plugin :inappbrowser in cocoon.io // this.testlink=function(){ var link="https://www.google.com" game.time.events.add(4000,function(){cordova.InAppBrowser.open(link, '_blank', 'location=yes')}) }; is_mobile && this.testlink();
  6. hi, i use this code to access a link on the net. it works very well when i'm on browser. When i use it on mobile with cocoon the link don't open...could you tell me what i must do ? thanks var link="https://www.google.com" game.time.events.add(1000,function(){window.location.href = link})
  7. Cardinal Run

    Hi! Howmany installs since the launch ?
  8. while on array unexpected behavior

    find by myself var n = 0; var e=[0,2,1,-1] while (e[n] != -1) { n++; } console.log(n); // 3
  9. while on array unexpected behavior

    sorry but i don't understand very well ....i do that but it's not true : var e=[1,2,1,1,-1]; var n = 0; while (e[n] < 0) { var position=n; n++; } console.log(position); // undefined
  10. hi, I have a gameProgress (e) where each position in my array are stars (1,2) or blocked levels (-1) I want to count the position of the blocked level so i use this ; var e=[1,2,1,1,-1]; var n = 0; while (e[n] < 0) { n++; var position=n; } console.log(position); // expected output: 4 and result is 3 ??? but the result is not 4 => e=[1,2,1,1,-1] could you tell me why ?
  11. hi, the background music of my application is still playing when i leave the application. the back button stop the music (left button) but not the home button (middle button) here is the code of my background music : music=game.add.audio('music'); music.volume=0.4 music.play(); i try different approach but nothing works : //approach 1 // in index.html document.addEventListener("pause",onPause,false) function onPause(){ music.pause(); }; // => don't works //approach 2 //in main.js function update(){ if(game.stage.disableVisibilityChange){ music.pause() } }; // => don't works what must i add to avoid this ? thanks for your assistance.
  12. Enqueue tweens?

    Hi, and how do you do to declare the delay with this syntax ?