oxysoft Posted July 4, 2014 Share Posted July 4, 2014 I create 4 platforms (walls around the screen) and try to have my entities collide with them. This is the result I'm pretty sure the problem is obvious but I can't seem to see itvar game = new Phaser.Game(480, 300, Phaser.AUTO, 'Untitled game', {preload: preload, create: create, update: update})var spriteGroupvar platformGroup function preload() {game.time.advancedTiming = true//game.stage.disableVisibilityChange = truegame.load.image('player', 'res/gfx/player.png')game.load.image('enemy', 'res/gfx/invader.png')game.load.image('platform1', 'res/gfx/platform1.png')game.load.image('platform2', 'res/gfx/platform2.png')} function create() {game.physics.startSystem(Phaser.Physics.ARCADE)game.stage.scale.setTo(200, 200)game.physics.arcade.gravity.y = 100 spriteGroup = game.add.group()platformGroup = game.add.group()platformGroup.enableBody = true player = spriteGroup.create(25, 25, 'player')game.physics.enable(player, Phaser.Physics.ARCADE);player.body.velocity.x = game.rnd.integerInRange(50, 400)player.body.bounce.setTo(.6, .9) platform = platformGroup.create(0, -10, 'platform1')platform.body.immovable = trueplatform.body.gravity = 0 platform = platformGroup.create(0, 290, 'platform1')platform.body.immovable = trueplatform.body.gravity = 0 platform = platformGroup.create(-10, 0, 'platform2')platform.body.immovable = trueplatform.body.gravity = 0 platform = platformGroup.create(480 - 10, 0, 'platform2')platform.body.immovable = trueplatform.body.gravity = 0} function update() {game.physics.arcade.collide(platformGroup, spriteGroup)}Shouldn't the sprite bounce? Link to comment Share on other sites More sharing options...
Recommended Posts