- Invasion_WP7_Game_XAP.zip
- Invasion.xap
- Invasion_WP7_Source_Code.zip
- Invasion
- Invasion.sln
- Invasion.suo
- Invasion
- ImproviSoft.Diagnostics
- ImproviSoft.Drawing
- ImproviSoft.System
- Invasion
- InvasionContent
- Backgrounds
- starfield_bg.orig.png
- starfield_bg.png
- title_bg.pdn
- title_bg.png
- bin
- Windows Phone
- Release
- Fonts
- alpha.png
- fpsfont.spritefont
- InvasionContent.contentproj
- Music
- Music.mp3
- Scoreboard
- AutoSelect.png
- AutoSelectDisabled.png
- Scoreboard.png
- Shield.png
- WeaponNext.png
- Weapons.png
- Sounds
- blaster.wav
- blub.wav
- explosion.wav
- gameover.wav
- getextra.wav
- skid.wav
- tap.wav
- ufoshoot.wav
- weaponchange.wav
- Sprites
- explosion1.png
- explosion2.png
- explosion3.png
- extras.png
- select.png
- ship.png
- shipexplode.png
- shoot.png
- shoot2.png
- shootufo.png
- ufo1.png
- ufo2.png
- ufo3.png
- Screenshots.zip
- Screenshots
- Invasion v1.0 Gameplay 1.png
- Invasion v1.0 Gameplay 15.png
- Invasion v1.0 Gameplay 5.png
- Invasion v1.0 Gameplay 6.png
- Invasion v1.0 Help.png
- Invasion v1.0 MainMenu.png
|
using System;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Invasion.SpriteManagers;
namespace Invasion.Sprites
{
/// <summary>
/// Extra Class
/// </summary>
public class Extra : DrawableGameComponent
{
public enum ExtraType { NotSet = -1, PhotonAmmo, Weapons, Hundred, BlasterAmmo, Shield }
private ExtraType extraType = ExtraType.PhotonAmmo;
public Vector2 Position {
get { return position; }
set {
position = value;
destRect.X = (int)position.X;
destRect.Y = (int)position.Y;
}
}
private Vector2 position;
public const int NumExtraTypes = 5;
private int frame = 0;
private Texture2D extrasTex = null;
Rectangle srcRect = Rectangle.Empty;
Rectangle destRect = Rectangle.Empty;
public int SpeedY {
get;
set;
}
public Extra(Game game, Vector2 position, ExtraType extraType) : base(game) {
this.position = position;
this.extraType = extraType;
SpeedY = 0;
SetupTexture();
}
public Extra(Game game, Vector2 position, ExtraType extraType, int speedY) : base(game) {
this.position = position;
this.extraType = extraType;
SpeedY = speedY;
SetupTexture();
}
private void SetupTexture() {
extrasTex = ExtrasManager.ExtrasTex;
srcRect = new Rectangle(0, 0, 25, 25);
destRect = new Rectangle((int)position.X, (int)position.Y, 25, 25);
}
public ExtraType Type {
get { return extraType; }
set { extraType = value; }
}
public void Move() {
position.Y -= SpeedY;
destRect.Y = (int)position.Y;
}
public override void Update(GameTime gameTime) {
Update();
Move();
}
public void Update()
{
srcRect.X = frame*25;
srcRect.Y = (int)extraType*25;
frame++;
if (frame == 19)
frame = 0;
}
public override void Draw(GameTime gameTime) {
InvasionGame.spriteBatch.Draw(extrasTex, position, srcRect, Color.White);
}
public Rectangle BoundingBox {
get { return destRect; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Dan is the Founder and President of
ImproviSoft LLC (mobile software) and
AdStreamer, Inc. (mobile advertising) - both Microsoft BizSpark Plus Startups.
Dan holds a B.S. in Computer Science from Clarkson University and M.S. degrees in Computer Science and Computer Engineering from Syracuse University. He is an ASQ Certified Software Quality Engineer (CSQE) and was a 2012 Microsoft XNA/DirectX MVP.
Prior experience includes Software Engineering, Project Management, and Functional Management in the Aerospace & Defense, Medical Devices, Automotive Engineering, and e-Commerce industries.
Dan's dev-blog is
The ImproviSoft Blog.