p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 (http://p2p.wrox.com/forumdisplay.php?f=325)
-   -   XNA Shooter help (http://p2p.wrox.com/showthread.php?t=72994)

ben628 February 28th, 2009 02:27 PM

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.


All times are GMT -4. The time now is 03:00 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.