Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Search the Community

Showing results for tags 'Offscreen'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 4 results

  1. Hello guys, i'm totally new to Babylon and I was wondering if there's a way to check if an object is hitting the border of the screen and prevent it to get off the screen. This is what i wrote so far: http://www.babylonjs-playground.com/#SKWZP#0 I found these values manually, i hate to hard-code stuff inside my code but it was just for testing. if (box1.position.x > 6 ) { box1.position.x = 6; } if (box1.position.y > 4 ) { box1.position.y = 4; } if (box1.position.x < -6) { box1.position.x = -6; } if (box1.position.y < -4) { box1.position.y = -4; } Can you please me help to understand how can i retrieve the screen boundaries wrt the viewport?
  2. Hi guys ! We're currently try to make a game with Phaser and it's just awesome ! But I have an issue right there with the Touch pointers (and Buttons). My problem is when you put your finger on the screen, the pointer is declared active. But if you slide outside the screen(keep the finger on the screen but go outside the game screen), your pointer is still active. And you cannot unable it (if you touch the screen again, it's the second pointer which is detected). And this is the issue, because i wanted to create buttons on the bottom of the screen but if you touch the screen too close from the edges, the character would not stop moving (if the button is a direction button). I tried first with buttons and not pointers, and it's the same issue. Altough, if you click on the button again, it resets the button and the character stop moving. But we cannot let the character moving across the map if nothing is touched on the screen. I tried something like this to solve this issue, but if you move too fast it doesn't work. (Game screen is 800*600) if(PhaserGame.game.input.pointer1.active && PhaserGame.game.input.pointer1.y <= 595){ //alert(PhaserGame.game.input.pointer1.y); if(PhaserGame.game.input.pointer1.x > 25 && PhaserGame.game.input.pointer1.x < 125){ Player.moveLeft = true; Player.moveRight = false; } else if(PhaserGame.game.input.pointer1.x >= 125 && PhaserGame.game.input.pointer1.x < 225){ Player.moveLeft = false; Player.moveRight = true; } else { Player.moveLeft = false; Player.moveRight = false; PhaserGame.game.input.pointer1.reset(); } } else { Player.moveLeft = false; Player.moveRight = false; PhaserGame.game.input.pointer1.reset(); }Thank you in advance for your answer !
  3. I've got npc's that can go offscreen when player moves left/right but as they go out of bounds collision stops working on ground and they end up colliding with the world bounds, what would be the best way to handle them? do i save their positions on outOfBounds? or disable gravity for them or somehow keep ground collisions working out of camera?
  4. I'm doing a Phaser project for work and I've adopted the current code base. I have a bit of an odd situation. The game width is 1024 by 748. The world bounds are set by game.world.setBounds(-1024,0,3072,748) When adding sprites, the code base I've adopted has game.add.sprite(2424,0,'name of atlas','name of png') Based on this it appears the previous developer was creating these sprites off screen. When I adopted this it was using Phaser 2.1. I upgraded to Phaser 2.2.1 because it had an Internet Explorer Fix I needed. Now however, half the time the sprites will be created on the screen and the other half of the time the sprites are created off screen. What was changed between the versions to create this type of issue? Also note that, if I add a sprite with x coordinate is between 0 and 1024, I indeed see this sprite moving from the left to the right of the screen. From 1024 to roughly 2200 I don't see the sprite at all. However adding the sprite with an x coordinate from 2200 to roughly 2800 has the odd effect of starting at the far right of the screen and moving left. That means, when I use 2200 the sprite is at the edge of my 1024 game screen. When I use 2800 it is at the edge of my left game screen. This is counter intuitive to me because as X goes up the sprite should move farther away from the left. Anyone know why or what is happening here?
  • Create New...