espace

Members
  • Content count

    387
  • Joined

  • Last visited

About espace

  • Rank
    Advanced Member

Recent Profile Visitors

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

  1. hi, i'm searching to use this function like this : var wait=function(callback,duration){ setTimeout(function(){ callback() }, duration); } wait(myfunction,100) but it say callback is not a function...this line is not good interpretated : callback() how to use a function as an argument ?
  2. sorry but how do you do that ?
  3. hi, Assuming i have several tweens for example : var tween_a; var tween_b; var tween_c; var tween_d .... how to cancel for example all the tweens except the tween_c is it possible in a single line code ?
  4. hi, in my job we have several house with different informations and i would use javascript with a gui to allow my colleguas to store these data's...an idea ?
  5. espace

    App not loading out of Brackets

    Hi with chrome you need to start a server. Try with Firefox it doesn't need a web server. If you have yet errors it's in your code. Ps: To start a web server in chrome look at "python simplehttp"
  6. espace

    How to scale only a tile in a tilemap

    really no one ?
  7. espace

    How to scale only a tile in a tilemap

    i find that is possible with createFromObjects but i can't use this feature to reproduce a map. I specify the namegroup, the gid and the image key but the error is invalid namegroup .. var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update}); function preload() { game.load.image('tiles', 'tiles.png'); } var cursors; function create() { // Create some map data dynamically // Map size is 128x128 tiles var data = ''; for (var y = 0; y < 128; y++) { for (var x = 0; x < 128; x++) { data += game.rnd.between(0, 20).toString(); if (x < 127) { data += ','; } } if (y < 127) { data += "\n"; } } // console.log(data); // Add data to the cache game.cache.addTilemap('dynamicMap', null, data, Phaser.Tilemap.CSV); // Create our map (the 16x16 is the tile size) map = game.add.tilemap('dynamicMap', 16, 16); // 'tiles' = cache image key, 16x16 = tile size //map.addTilesetImage('tiles', 'tiles', 16, 16); // 0 is important layer = map.createLayer(0); //createfromobject(name,gid,key,frame,exists,autocull,group,customclass,adjusty) var mygroup=game.add.group(); map.createFromObjects(mygroup,0,'tiles') // Scroll it layer.resizeWorld(); game.physics.startSystem(Phaser.Physics.ARCADE); cursors = game.input.keyboard.createCursorKeys(); } function update() { if (cursors.left.isDown) { game.camera.x--; } else if (cursors.right.isDown) { game.camera.x++; } if (cursors.up.isDown) { game.camera.y--; } else if (cursors.down.isDown) { game.camera.y++; } }
  8. espace

    How to scale only a tile in a tilemap

    Is not possible ?
  9. espace

    How to scale only a tile in a tilemap

    nobody ?
  10. hi, after get the examples from : https://phaser.io/examples/v2/tilemaps/tile-properties i'm searching to modify the object of the tiles, but i can't modify the alpha and the scale (=> see //HERE THE PROBLEM). how do you do to reach that ? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update ,render: render}); function preload() { // tiles are 16x16 each game.load.image('tiles', 'tiles.png'); } var cursors; var currentDataString; function create() { // Create some map data dynamically // Map size is 128x128 tiles var data = ''; for (var y = 0; y < 128; y++) { for (var x = 0; x < 128; x++) { data += game.rnd.between(0, 20).toString(); if (x < 127) { data += ','; } } if (y < 127) { data += "\n"; } } // console.log(data); // Add data to the cache game.cache.addTilemap('dynamicMap', null, data, Phaser.Tilemap.CSV); // Create our map (the 16x16 is the tile size) map = game.add.tilemap('dynamicMap', 16, 16); // 'tiles' = cache image key, 16x16 = tile size map.addTilesetImage('tiles', 'tiles', 16, 16); // 0 is important layer = map.createLayer(0); // Scroll it layer.resizeWorld(); game.physics.startSystem(Phaser.Physics.ARCADE); cursors = game.input.keyboard.createCursorKeys(); // Our painting marker marker = game.add.graphics(); marker.lineStyle(2, 0xffffff, 1); marker.drawRect(0, 0, 32, 32); game.input.addMoveCallback(updateMarker, this); game.input.onDown.add(getTileProperties, this); cursors = game.input.keyboard.createCursorKeys(); } function getTileProperties() { var x = layer.getTileX(game.input.activePointer.worldX); var y = layer.getTileY(game.input.activePointer.worldY); var tile = map.getTile(x, y, layer); console.log(tile) //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //HERE THE PROBLEM tile.scale.x=.1 tile.alpha=.1 // Note: JSON.stringify will convert the object tile properties to a string currentDataString = JSON.stringify( tile.properties ); tile.properties.wibble = true; } function updateMarker() { marker.x = layer.getTileX(game.input.activePointer.worldX) * 32; marker.y = layer.getTileY(game.input.activePointer.worldY) * 32; } function update() { if (cursors.left.isDown) { game.camera.x--; } else if (cursors.right.isDown) { game.camera.x++; } if (cursors.up.isDown) { game.camera.y--; } else if (cursors.down.isDown) { game.camera.y++; } } function render() { if(currentDataString){ game.debug.text('Tile properties: ' + currentDataString, 16, 550); } else { game.debug.text("Click on a tile to reveal the properties of the tile", 16, 550); } }
  11. 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
  12. think solved : https://www.joshmorony.com/how-to-create-a-candy-crush-or-bejeweled-game-in-phaser/
  13. 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.
  14. 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() { }, }
  15. 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();