• Content Count

  • Joined

  • Last visited

  1. Barthandelus

    [PHASER] Rendering player (CANVAS)

    Ok, I understand. Solution found using Arcade Physics : This permit to define a custom hitbox on a sprite. Don't hesitate to use the RENDER function to help you. Problem solved !
  2. Barthandelus

    [PHASER] Rendering player (CANVAS)

    Hi, I'm a actually making a game using PHASER. On this game, player have to jump to escape balls rolling on the ground, like on an infinite runner. Actually, everything is working fine but the player is showed using a spritesheet divided on 128*128 resolution. The character animation running doesn't use 128 pixels on width causing the ball to collide with the player even if the player doesn't hit the ball. The player hitbox is actually configured to 128*128 but I know that in previous versions of PHASER, it was possible to render player to make his hitbox scale his skin. I didn't find this function in the actual version of PHASER. Can someone help ? Thanx in advance. For information : Phaser example on previous versions :
  3. Barthandelus

    How to load sprites on phaser based on database data

    Javascript alone doesn't have any way to connect to a database. Solutions : - Using AJAX to call a PHP file that connect to the database, and then return it as JSON, for example. - Using NodeJS. - Or simply using a PHP Server. For example, having an "index.php" with header that connect to the database, then get some values, for example $characterSprite. If you use external JS to create your game, just do like this : Before your JS includes. It should work fine. While PHASER should be used with an Apache server or similar I think the 3rd solution would be the best for you.
  4. Barthandelus

    [PHASER] Collide an ITEM with GROUND.

    Hello, I am actually trying to make my very first game with Phaser ! Saddly, I am not able to get it work. Actually, the game is simple : There is a ground, a character (player), and a "coin" that fall from the top of the game to the ground. If the player hit it, the score increase by 1. All of this work fine. But I want to end the game if the "coin" hit the grounds. For this, I want the coin to collide with the ground. But unfortunally, the player collide with the ground, and the coin pass through the ground. I don't understand why. Demo here. Keep in mind that this code & game is only for testing PHASER. Here is the full code : Could you please help ? ;...; xxx lol EDIT : I got the problem solved, just misstake to place it : Now I wonder why my function endGame() isn't call when gold hit the ground. EDIT² : I got my second problem solved with this code : But I don't understand the difference between my code and game.physics.arcade.overlap();. Can someone explain me ? Code updated aswell !