bLind17

Members
  • Content Count

    4
  • Joined

  • Last visited

  1. Wow, this is relly nice and helpful! Thanks a lot for the example . Much appreciated. cheers
  2. My current solution to this is: putting the player body in the attachments-group as well and then scaling the whole group. But still, any ideas? cheers bLind
  3. Hi peoplez! This is more or less a follow-up to this Thread in the Pixi.js section of this board. And this is what I want: The Player in the back is my parent. It is an object that is derived from the Phaser.Sprite class. The number and the text are my children, grouped together in player.attachments. I want the number to be centered and the text to be at the bottom of the player. Now this is how I tried to achieve that: player = new Player(game, 'player', 'Christian', player_number, x, y); player_scale = Math.min(magic.config.gameScale.x, magic.config.gameScale.y); player.scale.x = player_scale; player.scale.y = player_scale; player.anchor.setTo(0.5, 0.5); font_size = 30; name = game.add.text( 0, player.height/2, // text should go to the bottom of player's body player.name, {/*style*/}); name.anchor.setTo(0.5, 1); font_size = 50; number = game.add.text( 0, 0, // text should go to center of the player's body (see anchor) player.number, {/*style*/}); number.anchor.setTo(0.5, 0.25); player.attachments.add(name); player.attachments.add(number); game.magic.players.add(player) As long as the player_scale is 1, everything works fine. But when it changes, the positioning is screwed up. And I still don't really get how this happens^^. With a smaller scale, it might look like this: In the Pixi.js thread moszis wrote: and mrBRC wrote: I tried to change my code accordingly, but that didn't put the texts at the correct positions either... If you have any suggestions or ideas, I'd be soo happy to hear them! Thanks for reading, if you made it down here . I really appreciate it! cheers bLind
  4. bLind17

    How to capture a touch event on mobile device

    Hi! Thanks for the help so far. Now I'm wondering if there is some way to get a hold-event on a sprite? Just like game.input.onHold.add - I need a longpress listener for sprites. Is there something already there, or an easy way to do this? cheers bLind