Search the Community

Showing results for tags 'phaser'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3,313 results

  1. Hi guys, I am back with another noobish question. I have created a text object in my game. this.text1 = this.add.text(63, 50, "Option 1", style);and added some fancy tween animation to it. and now in the update function I want to access its position, console.log(this.text1.x);But it only returns "63" i.e the initial position that I created it at, and not the dynamic position. How can I make it return the real time position of the text object ? /*======================================================================*/ I basically wanted to check the position of text to make sure whether it was overlapping with my main character. I went through the docs and I though that maybe I should use the overlap function for this . So I added the following in the update function., this.text1, this.restart_game, null, this);But sadly that didn't work either.
  2. I have been working on a tile-based rogue-like exploration game that is supposed to be very relaxing and peaceful. A lot of it is procedurally generated, and I wanted to procedurally generate the music, too. So I loaded two octaves of notes in the pentatonic scale:'notec', ['../wp-content/themes/toolbox/js/assets/music/notec.ogg','../wp-content/themes/toolbox/js/assets/music/notec.mp3']);'noted', ['../wp-content/themes/toolbox/js/assets/music/noted.ogg','../wp-content/themes/toolbox/js/assets/music/noted.mp3']);'notee', ['../wp-content/themes/toolbox/js/assets/music/notee.ogg','../wp-content/themes/toolbox/js/assets/music/notee.mp3']);'noteg', ['../wp-content/themes/toolbox/js/assets/music/noteg.ogg','../wp-content/themes/toolbox/js/assets/music/noteg.mp3']);'notea', ['../wp-content/themes/toolbox/js/assets/music/notea.ogg','../wp-content/themes/toolbox/js/assets/music/notea.mp3']);'notec2', ['../wp-content/themes/toolbox/js/assets/music/notec2.ogg','../wp-content/themes/toolbox/js/assets/music/notec2.mp3']);'noted2', ['../wp-content/themes/toolbox/js/assets/music/noted2.ogg','../wp-content/themes/toolbox/js/assets/music/noted2.mp3']);'notee2', ['../wp-content/themes/toolbox/js/assets/music/notee2.ogg','../wp-content/themes/toolbox/js/assets/music/notee2.mp3']);'noteg2', ['../wp-content/themes/toolbox/js/assets/music/noteg2.ogg','../wp-content/themes/toolbox/js/assets/music/noteg2.mp3']);'notea2', ['../wp-content/themes/toolbox/js/assets/music/notea2.ogg','../wp-content/themes/toolbox/js/assets/music/notea2.mp3']);And then I called a function every time the person took a step: sound_track: function() { // random music generation if ((stepcounter % 2) == 1) { ckey ='notec'); dkey ='noted'); ekey ='notee'); gkey ='noteg'); akey ='notea'); c2key ='notec'); d2key ='noted'); e2key ='notee'); g2key ='noteg'); a2key ='notea'); ckey.volume = .3; dkey.volume = .3; ekey.volume = .3; gkey.volume = .3; akey.volume = .3; c2key.volume = .3; d2key.volume = .3; e2key.volume = .3; g2key.volume = .3; a2key.volume = .3; console.log("this part's working"); var randtime = Math.floor(Math.random()*8)+1; var randmusic = Math.floor(Math.random()*12)+1; if ((randtime == 1) || ((stepcounter % 4) == 1)) { // guaranteed beat console.log(randmusic); if (randmusic == 1 || randmusic == 11); if (randmusic == 2); if (randmusic == 3); if (randmusic == 4); if (randmusic == 5); if (randmusic == 6); if (randmusic == 7); if (randmusic == 8); if (randmusic == 9); if (randmusic == 10); } } },Which seemed to work fine! (Albeit a bit random: I need to write a few more rules, perhaps a bassline, to give the song more structure. But it's already very zen!) Anyway, this works great for the first hundred or so steps, but then the audio starts to get all staticky. Eventually, it stopped playing at all, and I had to reload the window. I thought maybe I could fix this by making the files shorter and more compressed, and I did that, and it seemed to help a bit, but the audio still got pretty corrupted-sounded and eventually stopped all-together. This affects all audio played by the code, even sound effects which have not been played more than a few times, and does not go away if I wait. I am not a programmer, and this is just a side project for me. So it's very possible that I am doing something silly, or stupid, or preposterously round-about. If so, please correct me! I have really enjoyed the experience of coding in Phaser, and it's been a lot of fun, but this kind of bug (which throws no errors in the console!) totally perplexes me, as it falls outside the realm of internal code-logic and into the realm of technical know-how, of which I have none. (If you would like to test the game out, you can find it a, and the password is trails. It's not completely finished, though, so there might be other bugs!) Also, a PS: I have lurked in these forums and used people's advice to solve a number of issues already. This seems like a great place, and you all seem like great people, and I'm excited to finally register and start contributing (even if my first contribution is a request for help!). Thank you all. EDIT: Well, I think I've figured it out! The problem was that I was doing the "ckey ='notec');" stuff (I'm not actually sure what this is called, only how it functions!) every single time the sound effects were called. This was overloading something and making the sound sound horrible. Hopefully somebody else will do the same stupid thing and this post will serve as helpful information to them!
  3. shahbazk30

    Click On An Image not working

    Hi All, I have recently started exploring phaser. I am struggling with the event. Problem is that the click event is not firing after every click. It fires after clicking sprite multiple times. I have even tried phaser example "02 - click on an image.js" which comes with the download but i am facing same issue with the example. I have also tried same example from following link but problem is the same there too . I am testing on my PC (window 7) on chrome and firefox. here is my code window.onload = function () { var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create}); function preload() { game.load.image('einstein', 'phaser.png'); } var image; function create() { image = game.add.sprite(0, 0, 'einstein'); image.inputEnabled = true;, this); } var n = 0; function listener() { alert('a'); n++; } };
  4. panovsky

    some item in some group

    hi all I have some item in some group. How can i find parent group of my item and index of item in this group?
  5. GrimPanda

    [Phaser] Space Flight

    Space Flight Hi! We just finished up another game, this one is called Space Flight. Use your finger to trace a path from incoming ships to the appropriate colored stations. As the game progresses, you will get more ships, stations, and unique upgrades that make managing your space port easier, but more challenging at the same time! Manage the universe's busiest space station! Help Mr. Warply figure out how to land all the ships coming to land at his stations. Several different stations, ship colors and additional challenges await you as you progress! Can you master this skill? Please let us know your thoughts! Play Space Flight Right Here! Play Space Flight Right Here!
  6. turnA

    [Phaser] Louie's Dog

    Hi there, just want to share my HTML5 games, Louie's Dog. Although this is my first time posting here, this is not my first HTML5 games. Maybe I can share the other games here later. Louie's Dog is a grid sliding puzzle games where you must reunite Louie and his missing white dog. Beware though, there are other special tile to consider, and Angry Dog & Animal Control Officer to avoid. You can also find hidden gold bones under the ground to increase your completion rating. There are no timer or score here, so just sit back, relax, and solve all the level with all the time in the world Link: Alternate Link: If you have problem playing the games, do let me know. Any feedback will be appreciated!
  7. plicatibu

    Cocoon JS - In app purchase

    Have anyone successfully used in-app purchase with CocoonJS and Phaser (for Android platform) ? Could you pinpoint some tutorial, tips and tricks, regarding this matter? Thank you.
  8. plicatibu

    Kiwi.js vs Phaser

    It seems a naive question but is kiwi.js an ancestor of Phaser, is it a borther of Phaser or what? I came across this post and this other one and I didn't get it. Also here you see in kiwi.js the statement Phaser.js (Kiwi Lite). Isn't Phaser suitable for mobile devices too? Why 2 projects? Thanks.
  9. Hello, I have a problem with sprites with a body set as immovable. When my player collide with two immovable bodies, one of these bodies moves. You can try with the two bushes under the player. 1- Go on top of the left bush and collide with it2- While still colliding, try pushing the right bush The code for the player and the bush are easely readable with DevTools (player.js and bush.js, you can read obstaclesgroup.js too). I don't understand what I'm doing wrong so if someone can help me to fix it, I'll owe him one. Thank you.
  10. I want to move a text object , this.option1 =;this.option1 =, 20, "Option 1", { font: "30px Arial", fill: "#ffffff" });this.option1.velocity.x = -200;But it throws a TypeError saying Uncaught TypeError: Cannot set property 'x' of undefined
  11. kavun

    A way to tween font size?

    Is there a way to tween some text's font size?
  12. zenista

    [WIP] [Phaser] Sharp Shooter

    Hi, Here is the game i am working on. Please check it out and provide feedback. Specially try it in a mobile browser. Link: -regards update: latest version uploaded
  13. As you might have seen a few days ago, I've been trying to work out what is needed to get Phaser working as best as possible on an Ouya using CocoonJS. It has been a very frustrating road and, while I have had some successes, I've also finally hit a point where I really want some other people's opinions on where to go next. First, though, some solutions. So, as it turns out, I was only partially right in the additional property to test for in my change to the "pollStatus" code for gamepad input. It actually needs to test for the property and call the function too. Here is the code for that. var rawGamepads = (navigator.webkitGetGamepads && navigator.webkitGetGamepads()) || navigator.webkitGamepads || (navigator.getGamepads && navigator.getGamepads());(This has the added benefit of working in Firefox Aurora too now, but more on that a little later in this post.) Through my testing, I was at first surprised and then highly annoyed to learn that the 'index' property of gamepads in CocoonJS is unreliable. While the specification states indices start at zero, it doesn't include how counting should happen between gamepads being connected, disconnected, or reconnected. The result of this is inconsistency is that, in CocoonJS anyway, you might get "0, 1, 2" for the first three controller indices, or you might get "0, 5, 8" sometimes. (It also doesn't help that the CocoonJS Custom Loader remembers the last index as long as it is running. I was up to an index of 25 at one point yesterday.) To combat this issue, and hopefully not break the existing Phaser code for other systems, I have the following patch for "ongamepadconnect." this._ongamepadconnected = function(event) { var newPad = event.gamepad; _this._rawPads.push(newPad); for (var i in _this._gamepads) { if (!_this._gamepads[i].connected) { _this._gamepads[i].connect(newPad); break; } } };Instead of trusting the index of the gamepad, it looks for the first open slot within the four gamepads (as of 1.1.5 in Phaser) and 'connects' it. If all are connected, "_gamepads" is not updated. And here is the patch for "ongamepaddisconnected" too. this._ongamepaddisconnected = function(event) { var removedPad = event.gamepad; var removedPadIndex = 0; for (var i in _this._rawPads) { if (_this._rawPads[i].index === removedPad.index) { _this._rawPads.splice(i,1); removedPadIndex = i; } } _this._gamepads[removedPadIndex].disconnect(); };This time, instead of removing according to the "removePad.index" (as was previously the case), it finds the index of the pad to remove from "_rawPads" and uses that. Because I wanted to test the above code on another system, I turned to running in Aurora (since I knew it supported the two events). This became a very Good News / Bad News situation. Good News: Aurora passes the same "(navigator.getGamepads && navigator.getGamepads())" test CocoonJS does. No changes there. And there is now a new 'connected' property per gamepad built in too. Bad News: Gamepads no longer have a 'timestamp' property and buttons are now "GamepadButton" objects. The former is a fairly easy fix. Test if the index of the button array is an object and then look for its 'value' (float) or 'pressed' (boolean) property. The later is more complicated, and a problem I've recently learned CocoonJS suffers from too. (After the Aurora testing, I used the same code on my Ouya in CocoonJS. It has a 'timestamp' per gamepad, it turns out, but it remained a '0' during all of my testing. Not helpful. At all.) All of this explanation and code now brings me to some questions: Should the Phaser code be re-written to match these two systems? And if so, what is the best way to go about it?It should be possible to use "" to record our own timestamps. And I think this could even happen as part of "pollStatus" function somehow. But I really want some second, third, and maybe even fourth opinions about how to go about it, or if it should even be done in the first place. After all, the Aurora and CocoonJS timestamp issues might work themselves out in their next versions. Or they may not. I don't know if it is worth waiting several weeks at a minimum to find out. Is there anyone out there willing to either work with me or independently collaborate on this Phaser + CocoonJS debugging?I'm making progress in fits and starts. And I know other people are waiting for the go-ahead to start using Phaser in CocoonJS without problems. I figure there has to be at least one other developer willing to just check over that "Yes, this works for me too" or "Nope, I don't see that here" on these various changes. While I was thrilled @rich was willing to adopt my earlier changes, it has made me more skittish the deeper I go and the more little bits of code I change to get Phaser working in CocoonJS as smoothy as possible.
  14. Gamma

    Font Problems

    I recently launched a game called Robo Dash, and I few people have sent me some comments saying that the game has font issues where when the player loses the match and replay the font gets bolder and bolder. It doesn't seem to register the font I placed in the code. I decided to go with a bold font I found on Google fonts named 'Chango', but when the game starts it's very thin, and then becomes bold once the game restarts. Can someone help me with this issue. Code is down below: HTML Header: <link href='' rel='stylesheet' type='text/css'> Create Function: scoreText =, 210, "SCORE: " + score, { font: "30px Chango", fill: "#ecf0f1" }); highScoreText =, 240, "HIGHSCORE: " + highscore, { font: "30px Chango", fill: "#ecf0f1" }); intensityText =, 270, "INTENSITY: " + counter, { font: "30px Chango", fill: "#ecf0f1" });Robo Dash Game
  15. I've been testing Phaser on Windows Phone 7/8, and I've run into couple of problems. 1) Phaser doesn't recognize Windows Phone as mobile device on game.device Phaser 1.1.5 recognizes Windows Phone as a desktop device at game.device.desktop. I checked the phaser's online docs for game.device, and there doesn't appear to be any user agent checks for windows phone. There is a check for the existence of 'windows' string that subsequently sets the game.device.desktop value true. According to a stack overflow answer, the safest thing would be to check user agent for the 'windows phone' string. In addition to the normal mobile mode, there's also a desktop mode in some windows phone models, that is missing the 'phone' part on user agent. The desktop mode is trying to mask itself as desktop version, it appears to be pretty hard to distinguish it from real windows 8 machine. 2) Game resizes incorrectly on Windows Phone I'm having problems getting my game to scale properly on windows phone 8, when using 480x320 resolution for the game. I have tried using the full screen mobile template under resources folder, with minor changes, but that doesn't seem to work. I'm testing on Nokia Lumia 920 in mobile mode with screen resolution 1280×768. I thought setting game.stage.scalemode to Phaser.StageScaleMode.SHOW_ALL would have resized the app to fit inside the browser, but as it is, it doesn't do that. SHOW_ALL only sets the width of the app to match the width of the screen when in landscape mode. Due to this the height of the game is almost twice the screen's height. EXACT_FIT and NO_SCALE don't work any better. Is this is the intended functionality, or am I just missing something? I have been testing the game on android tablets as well, but windows phone is the only one where I'm running into this problem. My settings: var game = new Phaser.Game(480, 320, Phaser.AUTO, 'game');game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;game.stage.scale.minWidth = 320;game.stage.scale.minHeight = 240;game.stage.scale.maxWidth = 960;game.stage.scale.maxHeight = 640;game.stage.scale.pageAlignVertically = true;game.stage.scale.pageAlignHorizontally = true;game.stage.scale.forceOrientation(true, false);game.stage.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this)game.stage.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this)game.stage.scale.setScreenSize(true); 3) Some Windows Phone models don't trigger game.stage.scale.leaveIncorrectOrientation on orientation switch I'm also having problems with Nokia Lumia 620 (another windows phone) when switching from portrait to landscape. As mentioned above I'm using the full screen mobile template, and i haven't touched the code on this part. The game correctly shows the turn your phone to landscape mode image (from the template) in the portrait mode. When the device is turned to landscape mode, the same image is still visible, only zoomed in to the top left corner of the image. Problem seems to be that game.stage.scale.leaveIncorrectOrientation isn't triggering correctly on the device. The device is able to change from landscape to portrait, so it's no a question of a missing sensor. This problem doesn't appear on Lumia 920, although I've managed to have it happen couple of times with chrome on my laptop when switching browser window size while developer tools are open. Any ideas what could be causing this, or how should I handle this? 4) Using console.log on Windows Phone is a bad idea This last one isn't related to Phaser, just something I realized after trying to debug my app on windows phone, and thought of sharing. Apparently, from time to time, even though Windows Phone's browser doesn't have visible console available. the console in it can crash/close. When it does, it sets the console global undefined. So, if you are getting mysterious crashes when trying to run development code on windows phone, it might be due to your console.log statements. In order to get rid of the problem, you need to create a new console object somewhere in your code, if one doesn't already exist. The code below is from if (typeof console == 'undefined') { var console = new Object(); console.log = function(){} console.error = function(){} console.debug = function(){} console.warn = function(){}}
  16. Gamma

    Robo Dash

    Robo dash is a project that I have been working on for a couple of days now. I started a independent software studio back in 2012 named 'Somnibyte', and since 2012 I have been experimenting, but experimenting without any production. And so today I am happy to say that this is my first HTML5 game to be produced. It may still have some features to be implemented. I went with the theme of challenging/addicting, and so Robo Dash was the result. Robo Dash features a small robot toy named, 'Gamma'. The player is suppose to move Gamma across the kitchen table to dodge oranges that fall from the kitchen cabinets above. I hope you all enjoy this game. Feel free to post some feedback, ideas, bug reports, or comments. [ROBO DASH GAME] *Currently not optimized for mobile use, changes will take place soon.
  17. AprendizEnLaRed

    [Phaser] My CV

    Hello, I create a little game for my personal resume. It's in spanish. Fist the instructions. with C and J start to play. the game is to write phrases that appear in screen. For each word a bullet is fired Spanish characters can be replaced by standard character (ñ->n, á->a ...) It can be improved but to be the first one I'm happy Edit link:
  18. I replace a tile with no collision with one that has, but the collision info stays the same. You can reproduce this by using the paint tiles example. Apply collision to a couple of tiles by using setCollisionBetween() and enable debug on the tilemap layer. Paint with tiles that has collision and you'll see the debug lines never update. You can try it yourself at Shift + click the tiles within the green border, click to paint them anywhere. There's also a test for 1.1.3 at I couldn't find any debug drawing for tilemaps in 1.1.3 so I added the race car from another example. Use the arrows to drive around. You'll see the car stop at the tiles that has collision enabled. Painting new tiles and watch the car stop at them too. How come this worked in 1.1.3 and not in 1.1.5? Am I doing something wrong?
  19. Hello. I'm experiencing some issues with collision between sprites and tilemaps, and cannot figure out how to fix it. It used to work in 1.1.3, so I have clearly messed up something. You can see for yourself here: Use WASD to move and click the mouse to shoot a wooden box. I have limited the shooting to only one box, so you have to reload the page to shoot again. It made it easier to track what's happening. I want the collision callback to fire when the sprite hits a wall so that I can kill the box. The callback only triggers when you shoot at the corner of a tile, and never when the box hits a wall perpendicular. I'm using Phaser 1.1.5. View source to see how I did it. Source code pasted here, in case you prefer that. Bullet = function(game) {, game, -100, -100, 'stuff', 0); this.anchor.setTo(0.5, 0.5); this.outOfBoundsKill = true;};Bullet.prototype = Object.create(Phaser.Sprite.prototype);Bullet.prototype.constructor = Bullet;var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer', {preload:preload, create:create, update:update, render:render});var map;var layer;var player;var cursors;var bullets;var w, a, s, d;var counter = 0;var fireRate = 100;var nextFire = 0;function preload() { var assets = { spritesheet: { player: ['players.png', 16, 16], bullets: ['bullets.png', 32, 32], stuff: ['jerom_eiyeron.png', 16, 16] }, tilemap: { map01: ['map02.json', null, Phaser.Tilemap.TILED_JSON] }, image: { dungeon: ['DF_Tilemap01.png'] } }; Object.keys(assets).forEach(function(type) { Object.keys(assets[type]).forEach(function(id) { game.load[type].apply(game.load, [id].concat(assets[type][id])); }); });}function create() { map = game.add.tilemap('map01'); map.addTilesetImage('DF_Tilemap01', 'dungeon'); map.setCollisionBetween(0, 15, true, 0); layer = map.createLayer('Walls'); layer.resizeWorld(); layer.debug = true; player = game.add.sprite(48, 48, 'player', 0); cursors = game.input.keyboard.createCursorKeys(); w = game.input.keyboard.addKey(Phaser.Keyboard.W); a = game.input.keyboard.addKey(Phaser.Keyboard.A); s = game.input.keyboard.addKey(Phaser.Keyboard.S); d = game.input.keyboard.addKey(Phaser.Keyboard.D); bullets =; bullets.add(new Bullet(game));}function update() { player.body.velocity.x = 0; player.body.velocity.y = 0; if (w.isDown) { player.body.velocity.y = -200; } else if (s.isDown) { player.body.velocity.y = 200; } if (a.isDown) { player.body.velocity.x = -200; } else if (d.isDown) { player.body.velocity.x = 200; } if (game.input.activePointer.isDown) { var bullet = bullets.getFirstDead(); if (bullet !== null) { fire(bullet); } else { bullet = bullets.getAt(0); bullet.kill(); bullet.revive(1); fire(bullet); } } game.physics.collide(player, layer); game.physics.collide(bullets, layer, bulletHitWalls);}function fire(bullet) { if ( > nextFire && bullets.countDead() > 0) { nextFire = + fireRate; bullet.reset(player.x, player.y); var angle = game.physics.angleToPointer( bullet, game.input.activePointer); bullet.body.velocity.x = Math.cos(angle) * 300; bullet.body.velocity.y = Math.sin(angle) * 300; }}function bulletHitWalls(bullet, wall) { bullet.kill(); console.log('wall tile index',wall.tile.index);}function render() { game.debug.renderText('Active Bullets: ' + bullets.countLiving() + ' / ' +, 32, 32);}
  20. hyspanux


    Hi all, I'm new at phaser and TypeScript. I'm starting to use it following the examples. I try to change the text of a bitmapText object but setText function is not defined. I looked for it in the .d.js but it wasnt there. my code is like .. export class MainMenu extends Phaser.State{ fntDesyrel :Phaser.BitmapText; create() { this.fntDesyrel =, 148, "PHASER", { font: '94px Desyrel', align: 'center' }); } newText(_t : string) { this.fntDesyrel.setText(_t); /* <- Unresolved function or method setText */ }} Can anyone help me?thanks in advance.
  21. aurelien974

    [Phaser] Save Flappy Birds

    Hi all ! Here is the first game i released using Phaser (amazing tool, thanks rich and all contributors) ! I made it in a week for the Flappy Jam. Save Flappy Birds is simple : you have to jump over running flappy birds. Its originality consists of the possibility to swap between 2 characters of different weight. Master this to make a great score ! The game is also playable on a touchscreen and i'll soon try to make it available on the AppStore and Google Play Store (never did it before, if you have any advice let me know). >> The link of my entry on : << (and soon on my website too) >>> EDIT : to rate the game : <<< EDIT : here is the source on GitHub : Have fun and give me your feedback
  22. I am currently using the Phaser project template located on Github. I tried to search online for a way to minify my game files, yet I've ran into pages that talk about using 'GruntJS'. I am currently not familiar with the javascript task runner. Can anyone give me links to tutorials on how to minify phaser games? Or can anyone post a detailed description on how to do so? I would appreciate it greatly.
  23. Hi, I just want to mention my Flappy Bird inspired game Tubeyflaps ( I've made it using Phaser. It's far away from a master piece and mainly a proof of concept and proof of my grunt based phaserBoilerplate ( The whole game is MIT licensed and OpenSource. You can find it here: Cheers! Casarock
  24. Hi, I just changed from 1.1.2 to 1.1.4 and i can't detect to collision side of my sprite. define("Play", ['Game', 'Holoboy'], function(Game, Holoboy) { var Play = function (){ = Game; this.holoboy;; this.layer; }; Play.prototype = { preload: function(){, 0, 'preloaderBackground'); }, create: function(){ this.holoboy = new Holoboy(0,0); ='map');'tiles');, 12); this.layer ='Calque de Tile 1'); }, update: function(){ this.holoboy.move();, this.layer); console.log(this.holoboy.sprite.body.touching); } } return Play; });My console.log(this.holoboy.sprite.body.touching); always alert me Object {none: true, up: false, down: false, left: false, right: false…} My holoboy object : My controllable object : The collision works well by the way. My character can jump on the tiles and he is stopped by them. What's wrong with my code? Thank you
  25. Hey guys.I wanted to make a fuctionality through which If i select a sprite its gets replaced by a highlighted version of that sprite(the ones with selected in their name) and the other objects become rplaced by their unhighlighted version however with the current code whats happening is when testing the program it seems to be making an stran instance of the unhighlighted versions. function create () { mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true;,this);;//the bots group bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true;,this); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true;,this); } function listener(sprite, pointer) { if(sprite==mothership) { sprite.kill(); MothershipSelect(); Bot1(); Bot2(); } if(sprite==mothershipSelected) { sprite.kill(); Mothership(); } if(sprite==bot1) { sprite.kill(); Bot1Select(); Mothership(); Bot2(); } if(sprite==bot1Selected) { sprite.kill(); Bot1(); } if(sprite==bot2) { sprite.kill(); Bot2Select(); Mothership(); Bot1(); } if(sprite==bot2Selected) { sprite.kill(); Bot2(); } } function MothershipSelect() { mothership.kill(); mothershipSelected = game.add.sprite(80,100,"mothershipSelected"); mothershipSelected.inputEnabled=true;,this); } function Mothership() { mothershipSelected.kill(); mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true;,this) } function Bot1() { bot1Selected.kill() bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true;,this); } function Bot1Select() { bot1.kill(); bot1Selected=bots.create(400,100,'bot1Selected'); bot1Selected.inputEnabled=true;,this); } function Bot2() { bot2Selected.kill(); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true;,this); } function Bot2Select() { bot2.kill(); bot2Selected=bots.create(700,100,'bot2Selected'); bot2Selected.inputEnabled=true;,this); }