public Water(WurmsGame parent, Texture2D tex, Vector2 pos) : base(parent, pos) { this._worldPosition = pos; this._velocity = new Vector2(0.0f, 0.0f); this._sprite = new Sprite(tex, this._parent._spriteBatch, this._worldPosition); }
public Player(WurmsGame parent, Texture2D tex, Vector2 pos) : base(parent, pos) { this._worldPosition = pos; this._sprite = new Sprite(tex, this._parent._spriteBatch, this._worldPosition); this._inputEnabled = true; this._inputToggles = new Dictionary<string, bool>(); this._inputToggles["move_left"] = true; this._inputToggles["move_right"] = true; this._inputToggles["jump"] = true; this._applyGravity = true; this._keyboardState = Keyboard.GetState(); this._mouseState = Mouse.GetState(); this._projectiles = new Dictionary<string, Projectile>(); this._bulletAmmo = 10; this._rocketAmmo = 5; this._nextBullet = 0; this._nextRocket = 0; this._currentWeaponType = "BULLETS"; for (int i = 0; i < this._bulletAmmo; i++) { this._projectiles["BULLETS_" + i] = new Projectile(this._parent, this._parent.Content.Load<Texture2D>("Bullet"), new Vector2(-100.0f, -100.0f), 3, 5); } for (int i = 0; i < this._rocketAmmo; i++) { this._projectiles["ROCKETS" + i] = new Projectile(this._parent, this._parent.Content.Load<Texture2D>("Rocket"), new Vector2(-200.0f, -100.0f), 5, 3); } this._nextProjectile = this._projectiles["BULLETS_0"]; }
public GameState(WurmsGame parent) { this._parent = parent; this._mouseState = Mouse.GetState(); this._keyboardState = Keyboard.GetState(); this._next = false; }
public StateManager(WurmsGame parent) { this._parent = parent; this._states = new Dictionary<string, GameState>(); this._states["title"] = new Title(this._parent); this._states["main_game"] = new MainGame(this._parent); this._currentState = this._states["title"]; // Game will start up in the title state. }
public Projectile(WurmsGame parent, Texture2D tex, Vector2 pos, int damage, int speed) : base(parent, pos) { this._worldPosition = pos; this._sprite = new Sprite(tex, this._parent._spriteBatch, this._worldPosition); this._damage = damage; this._velocity = new Vector2(0.0f, 0.0f); this._alive = false; this._speed = speed; }
public MainGame(WurmsGame parent) : base(parent) { this._objects = new Dictionary<string, GameObject>(); this._reticle = new Reticle(this._parent.Content.Load<Texture2D>("CrossHair"), this._parent._spriteBatch, new Vector2(0.0f, 0.0f)); this._objects["water"] = new Water(this._parent, this._parent.Content.Load<Texture2D>("Water"), new Vector2(0.0f, 300.0f)); this._objects["terrain"] = new Terrain(this._parent, this._parent.Content.Load<Texture2D>("FirstLand"), new Vector2(0.0f, 0.0f)); this._objects["player_one"] = new Player(this._parent, this._parent.Content.Load<Texture2D>("RedPlayerWithShotgun"), new Vector2(240.0f, 100.0f)); this._activePlayer = (Player)this._objects["player_one"]; this._collisionMan = new CollisionManager(ref this._objects, ref this._reticle); }
Button _playBtn; //"Play Button" #endregion Fields #region Constructors public Title(WurmsGame parent) : base(parent) { this._background = new Sprite( this._parent.Content.Load<Texture2D>("TitleScreen"), this._parent._spriteBatch, new Vector2(0.0f, 0.0f)); this._playBtn = new Button( this._parent.Content.Load<Texture2D>("PlayButton"), this._parent._spriteBatch, new Vector2(270.0f, 290.0f), this._mouseState, new Callback(this.PlayCallback)); this._exitBtn = new Button( this._parent.Content.Load<Texture2D>("ExitButton"), this._parent._spriteBatch, new Vector2(270, 360.0f), this._mouseState, new Callback(this.ExitCallback)); this._cursor = new Reticle( this._parent.Content.Load<Texture2D>("CrossHair"), this._parent._spriteBatch, new Vector2(0.0f, 0.0f)); }
public Terrain(WurmsGame parent, Texture2D tex, Vector2 pos) : base(parent, pos) { this._worldPosition = pos; this._sprite = new Sprite(tex, this._parent._spriteBatch, this._worldPosition); }
static void Main() { using (var game = new WurmsGame()) game.Run(); }