Jump to content


  • Content Count

  • Joined

  • Last visited

About mhcdotcom

  • Rank

Recent Profile Visitors

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

  1. Hey all, I have posted my question in Game Development Stack Exchange. I've stripped the code to make it much easier to read. Feel free to answer on SE or on here. https://gamedev.stackexchange.com/questions/165350/how-can-i-get-reference-my-dialogue-box-object-in-my-scene Your help is much appreciated Thank you
  2. I have a very similar setup and 2 things look different from yours to mine. This line: this.layer.setCollision(1); looks something like this in my code: this.layer.setCollisionByProperty({ collides: true }) Where 'collides' is a custom property I set in Tiled app. Might not apply to your build And here, where you wrote: this.tilemap.layer.setTileIndexCallback(1, this.hitCoin, this); I assigned the `this.tilemap.layer' to a variable and add that to the collider, something like: const itemTiles = this.map.addTilesetImage(imageKey); const itemLayer = thi
  3. Hey All, I hope you can help me. I've asked the same question on Stack overflow. I hope you don't mind using it as a reference and answering either here or there. https://stackoverflow.com/questions/53093928/how-can-i-call-a-function-in-a-class-from-a-collider-method-when-this-is-a-diffe You're help is really appreciated. Thank you.
  4. Thanks @samme I appreciate your time. Your method for removing the bomb looks good. Ideally i still want the bomb sprites to leave the screen before being disabled, with your method the bomb disappears as soon as it touches the world bounds. What is the difference between bomb.disableBody(true, true) and bomb.destroy() ? Is the method I mentioned in my previous comment not ideal? I could update it to look like if (bomb < this.scene.physics.world.bounds.left+bomb.width) { bomb.destroy()// or bomb.disableBody(true, true) } to ensure it is completely offs
  5. I don't know what a bullet classe is. The worldbounds event is useful for when the balls are set to collide with the world bounds(collideWorldBounds = true). I want to detect when the ball has left the game world bounds when collideWorldBounds = false. Reason being, I want entities to get destroyed once they have left the world bounds so performance doesn't suffer. I'm seeing now after some research I could do something like: if (bomb < this.scene.physics.world.bounds.left) { bomb.destroy() } Would that be an ideal method for what I want to accomplish? Th
  6. Hey All, I'm using WebPack to build my game and I've run into a scoping issue. I'll try and explain. Below is my TestScene scene/class. import 'phaser'; import Npcs from 'modules/Npcs.js'; const npcs = new Npcs() export class TestScene extends Phaser.Scene { constructor () { super('TestScene') } preload(){...} create(){ this.physics.add.collider( this.player, this.bombs, npcs.hitBomb, null, this ) } } Below is my npcs class import 'phaser'; const gameplayStates = new GameplayStates() export default class Npcs {
  7. Hey All, var bomb = this.bombs.create(this.enemy1.x, this.enemy1.y, 'bomb'); bomb.setGravityY(-1500); bomb.body.velocity.x = -400; bomb.outOfBoundsKill = true; The bomb appears as expected. With the above in place I don't get any console errors. I got the `bomb.outOfBoundsKill = true;` reference from multiple Phaser 2 resources but cannot find the equivalent for phaser 3. I want to confirm it is being destroyed as expected but I cannot find a method for firing a callback when an image instance leaves the world bounds. I saw this one: `bomb.events.onOutOfB
  8. Beginner chiming in. I'm following along and I appreciated the tutorials for phaser 3. Keep up the good work.
  9. Thanks @samme I think I figured it out. The issue is my misunderstanding of how Tiled is intended to be incorporated into Phaser's framework. I have 2 maps(JSON files) built out from 2 different Tiled files. Phaser seems to be intended to load 1 tilemap instance that is used across an entire game build. // Where the mapObj variable is assigned in Playground.js var mapObj = mapSetup.sceneMap(this, 'map', 'tiles', 'World') // The 'tiles' reference should remain the same as what is assigned in the initial Scene(i.e. 'cave') var mapObj = mapSetup.sceneMap(this, 'map', 'cave', 'World')
  10. Hey Folks, I hope you can help. I am fairly new to Phaser 3 and am currently working on a platformer where my character can run, jump and collect collectibles. My game is modularised through WebPack everything else is plain JS along with the Phaser 3 framework. I am using Tiled where I export my levels as json files and the initial level loads perfectly with all collision tiles in place and working as expected. I've hit a road block with loading/starting new levels. I'll try and explain with my code to clarify. I've reduce the code significantly to make it easier to read. m
  11. I'm late to this party but I cannot find a satisfying tutorial for building levels through tiled for a platformer with Phaser 3. Or at least I cannot find the best method or practice to do it. Would oyu be open to a tutorial covering that?
  12. Hey All, I hope you can help me. I'm quite new to Phaser. I've looked all over google and couldn't find an answer to my question. I have an idea for a Tetris-like game. At the moment I'm learning the basics by setting up a single block to fall on the floor before another single block falls after it. The block falls from the air onto the ground just fine. The issue is: I simply want to have a collision call back happen once. I've simplified the code to make the question easier to read: function create () { this.physics.add.collider(block, ground, hitFloor, null, this); }
  13. Did you end up figuring this out. I'm starting with Phaser 3 and I cannot get a satisfying answer from the DOCs or anywhere online. Hope you can help, much appreciated. MHC
  • Create New...