Jump to content

Quick Camera Changes


Recommended Posts

Hello, so what I am trying do is quite simple I think I just don't know the best way to execute it. I want the camera to follow the bullet up until it dies/takes impact to the enemy or boundary then the camera is handed back to the player. I tried an if statement about the bullet being alive and else it would return to the player and that caused the bullet to be stuck on itself. I have additional code as well in the beginning to tell it to follow the player as well as this code in the beginning not too sure if this is causing an overlap or what.


//weapon systems laser = game.add.weapon(10, 'bullet');  laser.bulletKillType = Phaser.Weapon.KILL_CAMERA_BOUNDS;  laser.bulletSpeed = 600;  laser.fireRate = 250;  // set bullet collision area to match its visual size  laser.setBulletBodyOffset(24, 12, 6, 6);  fireSound = game.add.audio('gun', 0.1);  laser.onFire.add(function(bullet) {  fireSound.play(); game.camera.follow(bullet);


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...