Jump to content

Search the Community

Showing results for tags 'wall'.

  • 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 3 results

  1. Hello there. I am dealing for a long time with this issue. I am making an endless runner where platforms are made from small chunks (each 32x32 square). Character should fall down, not stop on the wall. This also happens when chunks don't have any velocity, until I add if( this.body.touching.right ) { this.body.velocity.x = 0; this.body.acceleration.x = 0; } to the player sprite. When I don't apply velocity to the chunks but instead say this.left -= 10 on chunk group in update the things are get more weird I guess that has to do something with chunks, am I doing this in wrong way? Each platform is a group, to which I add those chunks export default class Platform extends Phaser.Group { constructor(game, _) { super(game); const defaults = { startX: 0, startY: game.height - 64, width: game.width * .3, tileLevel: 1, tileFrame: 8, }; this.state = { extended: false }; _ = Object.assign({}, defaults, _); this.physicsBodyType = Phaser.Physics.ARCADE; this.enableBody = true; // Y axis for(let y = _.startY; y <= game.height + game.global.tileSize; y += game.global.tileSize) { // X axis _.tileLevel === 1 ? _.tileFrame = 8 : _.tileFrame = 1; for( let x = 0; x < _.width; x += game.global.tileSize ) { this.create(x + _.startX, y, 'tileset', _.tileFrame); } _.tileLevel++; } const BODY_OFFSET = 4; this.forEach((child) => { child.body.immovable = true; child.body.allowGravity = false; child.body.offset.y = BODY_OFFSET; child.body.friction.set(0); child.body.velocity.x = -10; }, this); } update() { // Spawn another platform if ((this.left <= this.game.width) && (!this.state.extended)) { this.state.extended = true; this.game.global.spawnPlatform.dispatch(this.right); } // Destroy when off bounds if(this.right < 0) { this.destroy(); } } } Best regards.
  2. Play the game! Video Trailer Snake Runner is a fast paced top-down endless runner game inspired by the classic Snake game. It introduces a new gameplay concept based on a single tap control movement scheme. Your goal is to move the snake through an endless dungeon trying to survive as long as possible. You need to eat all food on your way and avoid all deadly obstacles such as walls, barriers, electric fields and so on. To control the snake just press space bar or left click to turn the snake 90 degree's towards the closest pickup!
  3. So we have sprite moving left right and the aim is to make it stop when hit a "invisible" wall. Let's presume that the x coordinate checks are 0px and 300px, so: if(game.input.keyboard.isDown(Phaser.Keyboard.A)) { paddle.body.velocity.x = -paddleSpeed; } else if(game.input.keyboard.isDown(Phaser.Keyboard.D)) { paddle.body.velocity.x = paddleSpeed; }and after checking some Phaser source i came up with this: if(paddle.x < paddle._cache.halfWidth) { paddle.x = paddle._cache.halfWidth; paddle.body.velocity.x *= -paddle.body.bounce.x; } if(paddle.x > game.world.width - paddle._cache.halfWidth) { paddle.x = game.world.width - paddle._cache.halfWidth; paddle.body.velocity.x *= -paddle.body.bounce.x; } If I use: paddle.body.collideWorldBounds = true; //like in the examples it-s all KO no bouncing/jitter when paddle hit the walls And since this is the code for checkWorldBounds: if (this.x < this.game.world.bounds.x){this.x = this.game.world.bounds.x;this.velocity.x *= -this.bounce.x;}else if (this.right > this.game.world.bounds.right){this.x = this.game.world.bounds.right - this.width;this.velocity.x *= -this.bounce.x;}I used the same approach... but still when it hit the right or left border the sprite passes the border and then it's positioned back ... you can check it, here: http://mihail.ilinov.eu/games/PhaserBreakoutJSBuggy/ Just press "A" and "D" for moving left and right and hit the wall you will see the problem... Also what's the deal with: body.bounce
×
×
  • Create New...