Jump to content

Search the Community

Showing results for tags 'world.setBounds ARCADE Physic'.

  • 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 1 result

  1. Hello. In following example http://oddskill.bplaced.net/coding/2dshooter1/index.html i try to set the world bounds smaller than the whole canvas, to be able to display some scores, controls etc below the world in the canvas (where the background is green ), but the sprite that should bounce in the world bounds enters the area below the bounds i set. I know i could handle that by hand in update function, just wanna know what am i doing wrong. best regards Chris PS: sourcecode below var game = new Phaser.Game(640, 480, Phaser.CANVAS, 'container', { preload: preload, create: create, update: update });var img;var spriteexplosion;var sound;function preload() { game.load.image('cow', './assets/cow.png'); game.load.audio('explosionsfx', 'assets/explosion.wav'); game.load.spritesheet('explosiongfx', 'assets/explosion.png', 128, 128, 16); game.load.spritesheet('background', 'assets/parallax100.png', 640, 480, 1);}function create() { game.stage.backgroundColor = '#00ff00'; game.physics.startSystem(Phaser.Physics.ARCADE); game.bg = game.add.tileSprite(0,0,640,400,'background'); game.bg.autoScroll(0,100); img = game.add.sprite(20, 20, 'cow'); game.physics.enable(img, Phaser.Physics.ARCADE); img.body.velocity.x=100; img.body.velocity.y=100; img.body.collideWorldBounds = true; img.body.bounce.set(1); img.anchor.setTo(0.5, 0.5); img.inputEnabled = true; img.input.start(0, true); img.events.onInputDown.add(select); game.world.setBounds(0,0,640,400); sound = game.add.audio('explosionsfx',1,true);}function update() { }function select(img, pointer) { img.destroy(); sound.play('',0,1,false); spriteexplosion = game.add.sprite(img.x, img.y, 'explosiongfx'); spriteexplosion.anchor.setTo(0.5, 0.5); spriteexplosion.animations.add('explosiongfx_anim'); spriteexplosion.animations.play('explosiongfx_anim', 20, false);}
×
×
  • Create New...