Closed iCodeForBananas closed 8 years ago
https://streamable.com/fak3
Happens on https://rangersteve.io when shooting. Maybe I should be specifying special slope properties just for bullets?
How I'm shooting the bullets
let bullet = this.bullets.getFirstDead() bullet.body.gravity.y = -GameConsts.BULLET_GRAVITY // 850 bullet.height = 2 bullet.width = 40 bullet.reset(x, y) let pointerAngle = this.game.physics.arcade.moveToPointer(bullet, currentWeapon.bulletSpeed) // currentWeapon.bulletSpeed === 2300 bullet.rotation = pointerAngle
How I'm creating the bullets
this.bullets = this.game.add.group() this.bullets.createMultiple(30, 'bullet') this.bullets.setAll('checkWorldBounds', true) this.bullets.setAll('outOfBoundsKill', true) this.physics.arcade.enable(this.bullets) this.game.slopes.enable(this.bullets) this.bullets.forEach(function(bullet) { bullet.body.height = 15 bullet.body.width = 15 bullet.height = 2 bullet.width = 40 // Define some shortcuts to some useful objects var body = bullet.body // Update player body properties body.drag.x = GameConsts.SLOPE_FEATURES.dragX body.drag.y = GameConsts.SLOPE_FEATURES.dragY body.bounce.x = GameConsts.SLOPE_FEATURES.bounceX body.bounce.y = GameConsts.SLOPE_FEATURES.bounceY // Update player body Arcade Slopes properties body.slopes.friction.x = GameConsts.SLOPE_FEATURES.frictionX body.slopes.friction.y = GameConsts.SLOPE_FEATURES.frictionY body.slopes.preferY = GameConsts.SLOPE_FEATURES.minimumOffsetY body.slopes.pullUp = GameConsts.SLOPE_FEATURES.pullUp body.slopes.pullDown = GameConsts.SLOPE_FEATURES.pullDown body.slopes.pullLeft = GameConsts.SLOPE_FEATURES.pullLeft body.slopes.pullRight = GameConsts.SLOPE_FEATURES.pullRight body.slopes.snapUp = GameConsts.SLOPE_FEATURES.snapUp body.slopes.snapDown = GameConsts.SLOPE_FEATURES.snapDown body.slopes.snapLeft = GameConsts.SLOPE_FEATURES.snapLeft body.slopes.snapRight = GameConsts.SLOPE_FEATURES.snapRight }, this)
GameConsts just in case
// Physics MAX_VELOCITY_X: 500, MAX_VELOCITY_Y: 1000, // Max velocity before player starts going through the ground. BULLET_GRAVITY: 850, // Slope Plugin SLOPE_FEATURES: { acceleration: 1500, bounceX: 0, bounceY: 0, debug: 0, dragX: 1000, dragY: 100, enableGravity: true, frictionX: 0, frictionY: 0, gravity: 1100, jump: 450, minimumOffsetY: 1, pullDown: 0, pullLeft: 0, pullRight: 0, pullUp: 0, snapDown: 0, snapLeft: 0, snapRight: 0, snapUp: 0 },
ugh i figured this out while typing the issue...
body.drag.x = 0 body.drag.y = 0
Yeah, be careful of drag, it rarely suits bullets! :grin:
https://streamable.com/fak3
Happens on https://rangersteve.io when shooting. Maybe I should be specifying special slope properties just for bullets?
How I'm shooting the bullets
How I'm creating the bullets
GameConsts just in case