Jump to content

Search the Community

Showing results for tags 'onoutofbounds'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. So i want to add listener to when the sprite goes out of bounds of the screen. It doesn't seem to fire up. Am I missing something? I saw a post here about this but it uses this.physics.world.on("worldbounds".. but isn't there a way to encapsulate the listener inside a new Sprite child class? Btw is there a list of events i can listen to? Thanks! class Meteor extends Phaser.Physics.Arcade.Sprite{ constructor(scene,x,y,key_texture,frame){ super(scene,x,y,key_texture,frame); this.scene = scene; this.scene.addToWorld(this); this.scene.physics.add.existing(this,false); this.setCollideWorldBounds(true); this.addListener("onOutOfBounds",()=>{console.log("hello")}); } } Ok so apparently if i am setting this.collideWorldBounds(true) it console.logs this.body.onWOrlBounds as true but console.log this has it set to false. If I add a new Meteor(..) from scene.create() method it works fine. If I add it from Spawner class it doesn't.
  2. Hi, I was wondering which one would be. I have set the game's viewport to 800x600 and the world bounds to 2048x1024. The player moves and the camera follows it. I want to dynamically load the tiles that are in the bounds of the viewport while the player moves around and kill the ones that are out. I was naively trying to kill() onOutOfBounds and then revive() onEnterBounds. Did not work but i don't know why. Apparently behind scenes is doing: !this.game.world.bounds.intersects(this._bounds)So i tried to replicate the functionality building an array of the killed tiles onOutOfBounds and, on the update() method, iterate over the killed tiles to check the intersect: if( game.world.bounds.intersects(killedTiles[i]._bounds) ){ killedTiles[i].revive();}The conditional is always false (?) and the ammount of process seems like an overkill for me (for big maps). Anyway i am using isometric phaser plugin if that makes any difference (i tried also with killedTiles._isoBounds). Someone has any tips?
×
×
  • Create New...