Jump to content

Search the Community

Showing results for tags 'onfloor'.

  • 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. Hi i'm very new to Phaser but i'm struggling with the onFloor and onCeiling events working together - i'm assuming it's syntax or something stopping this working as i want. Basically i'm playing with the sandbox and using code from the examples to familiarize myself with Phaser - my problem is this (code snippet from update below) the player.body.onFloor event works if i comment out the player.body.onCeiling event and a Game over message appears. As it is if i get the player to the top of the screen I get the You win message - but if i hit the floor then the game over message does not appear and the game seems to freeze and Platforms.destroy() does not execute. or is there a better way to implement "top" and "Bottom" of the screen? var text; var message; function update () { emitter.customSort(scaleSort, this); game.physics.arcade.collide(player, platforms); player.body.velocity.x = 0; if (cursors.left.isDown) { player.body.velocity.x = -250; } else if (cursors.right.isDown) { player.body.velocity.x = 250; } if (jumpButton.isDown && (player.body.onFloor() || player.body.touching.down)) { player.body.velocity.y = -400; } // mycode if (player.body.onFloor()) { message ="Game Over!"; GameOver(message); } if (player.body.onCeiling()) { message ="You Win!"; GameOver(message); } } function GameOver() { var bar = game.add.graphics(); bar.beginFill("#FFFFFF", 1); bar.drawRect(0, 250, 800, 100); var style = { font: "bold 32px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }; text = game.add.text(0, 0, message, style); text.setShadow(3, 3, 'rgba(0,0,0,0.5)', 2); text.setTextBounds(0, 250, 800, 100); platforms.destroy(); player.destroy(); }
  2. Hey guys, Does anyone have experience with detecting a Sprite body against a TileSprite? I am making a basic runner game and I would like to detect when the player has touched the "ground" (in this case, it's the top edge of a scrolling TileSprite). I tried checking for Sprite.body.velocity.y === 0, which worked when the player was sitting on top of the bottom edge of the world, but with the addition of the TileSprite it hovers at around 24~28 y velocity. Thanks
  3. Hello! I want the player jump on a platform may be jumping again ... The result is a bit strange because player can not move correctly and it can not jump again. The player only jumps if your body is on the ground. onFloor() This is my code: create: this.game.add.group this.movableTiles = (); this.game.add.tileSprite this.tileMovable1 = (200, 120, 48, 16, 'tileMovable'); this.tileMovable1.anchor.setTo (-0.5, -0.5); this.tileMovable1.body.immovable = true; this.tileMovable1.body.setRectangle (48, 16); this.tileMovable1.body.x = 200; this.tileMovable1.body.y = 120; this.movableTiles.add (this.tileMovable1); update: this.game.physics.collide (this.player, this.movableTiles); Any idea?
×
×
  • Create New...