Jump to content

Search the Community

Showing results for tags 'collideWorldBounds'.

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

  1. Hi, I'm learning to make games Phaser, watching a tutorial to create the Pong. For starters, I have to draw all elements in screen, which are ball and two rackets. Failure to draw the ball, the ball is only draws and no draws snowshoes. The code is as follows <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Pong</title> </head> <body> <div id="ejemplo"></div> <script src="phaser.min.js"></script> <script> window.onload = function(){ var game = new Phaser.Game(640, 480, Phaser.CANVAS, 'ejemplo', { preload: preload, create: create, update: update }); var playerBet; var computerBet; var ball; var computerBetSpeed = 190; var ballSpeed = 300; function preload() { game.load.image('bet', 'assets/rocket.png'); game.load.image('ball', 'assets/ball.png'); game.load.image('background', 'assets/backg.png'); } function create() { game.add.tileSprite(0, 0, 640, 480, 'background'); ball = game.add.sprite(game.world.centerX, game.world.centerY, 'ball'); ball.anchor.setTo(0.5, 0.5); ball.body.collideWorldBounds = true; ball.body.bounce.setTo(1, 1); computerBet = createBet(620, game.world.centerY); playerBet = createBet(20, game.world.centerY); computerBet.body.collideWorldBounds = true; computerBet.body.bounce.setTo(1, 1); computerBet.body.immovable = true; } function update () { } //Funciones function createBet(x, y) { var bet = game.add.sprite(x, y, 'bet'); bet.anchor.setTo(0.5, 0.5); bet.body.collideWorldBounds = true; bet.body.bounce.setTo(1, 1); bet.body.immovable = true; return bet; } }; </script> </body> </html> and failure I get is: Uncaught TypeError: Can not set property 'collideWorldBounds' of null In line 39, that is: ball.body.collideWorldBounds = true; Help me please!!
  2. Hi all, I can't seem to find any documented way of initialising a sprite with a negative axis value, whilst having collideWorldBounds enabled. It appears to be resetting my negative axis values to 0 upon rendering, which makes it appear really clunky. app.game.prototype.spawn = function() { var germId = germs[Math.floor(Math.random()*germs.length)], germ = spawnGroup.create( this.rnd.integerInRange(0, this.world.width), -50, germId ); this.physics.arcade.enable(germ); germ.body.gravity.y = this.rnd.integerInRange(200, 500); germ.body.collideWorldBounds = true; germ.inputEnabled = true; germ.events.onInputDown.add(this.onInputDown, this); }; Any suggestions on how to get around this?
  3. I'm using Phaser 2.4.2 with P2 physics. I have a sort of jar shaped body containing some circular bodies (balls). I want to move the jar offscreen but the balls are colliding with the world bounds. I tried setting collideWorldBounds on the balls but this stops them colliding with the jar which I want. You can see a demo here: https://output.jsbin.com/vuyexo Click the red button to make the jar move. Uncomment `collideWorldBounds=false` in the 'balls' section to see my problem. Why is this happening and how can I make the balls collide with the jar body but not the world bounds when the jar is moved offscreen?
  4. I wondered if I could enable collideWorldBounds = true only for bottom, left and right parts of the world bounds (and keep the "up" part to false)? Thanks!
×
×
  • Create New...