View Single Post
  #1 (permalink)  
Old February 28th, 2009, 02:27 PM
ben628 ben628 is offline
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XNA Shooter help

Hey,
I'm interested in adding leveled weapons to XNA shooter. As in, picking up one rocket item will give one rocket per shot, a second one would give two rockets per shot, you get the idea. Heres the code I have so far:
Code:
                    else if (itemType == ItemTypes.Rockets)
                            if (Player.currentWeapon == Player.WeaponTypes.Rockets)
                            Player.currentWeapon = Player.WeaponTypes.UberRockets;
                            else Player.currentWeapon = Player.WeaponTypes.Rockets;
And then the code for the weapon UberRockets will double the shots by creating a second rocket firing at the opposite altnerating point here:
Code:
                    case WeaponTypes.UberRockets:
                        if (gameTimeMs - lastShootTimeMs >= 850)
                        {
                            Vector3 shootPos = shipPos +
                                new Vector3(shootNum % 2 == 0 ? -2.64f : +2.64f, 0, 0);
                            Vector3 shootPos2 = shipPos +
                                new Vector3(shootNum % 2 == 0 ? +2.64f : -2.64f, 0, 0);
                            Mission.AddWeaponProjectile(
                                Projectile.WeaponTypes.Rocket, shootPos, true);
                            EffectManager.AddFireFlash(shootPos);
                            Mission.AddWeaponProjectile(
                                Projectile.WeaponTypes.Rocket, shootPos2, true);
                            EffectManager.AddFireFlash(shootPos2);
                            EffectManager.PlaySoundEffect(
                                EffectManager.EffectSoundType.RocketShoot);
                            shootNum++;
                            lastShootTimeMs = gameTimeMs;
                            Input.GamePadRumble(0.40f, 0.75f);
                            Player.score += 0;
                        } // if
                        break;
Am I missing anything? Also, is it possible to angle the camera instead of having it top down, sort of like an angled chase cam? If anyone can help me out with this I'd be very grateful, thank you.