public PowerupPickup(Game game, int type) : base(game, null) { Type = type; Model = PowerupPickup.GetModel(type, Game.GraphicsMode); AddChild(Model); }
public Rowboat(Game game) : base(game, game.GraphicsMode == Game.GRAPHICSMODE_NORMAL ? Graphics.GetAnimatedSprite(game, "assets/sprites/rowboat.xml") : Graphics.GetAnimatedSprite(game, "assets/sprites/blueprint/rowboat.xml")) { Collision = new RectangleShape(new Vector2f(82f, 38f)); Collision.Position = new Vector2f(-41f, -19f); Model.Stop(); HealthMax = 8000; Health = HealthMax; SpeedMax = 50.0f + Math.Min(0.5f * Game.AIManager.Difficulty, 25.0f); Acc = 200.0f; // Add Infantry Passengers AddInfantryman(new Vector2f(0, -10)); AddInfantryman(new Vector2f(0, 10)); AddInfantryman(new Vector2f(25, -10)); AddInfantryman(new Vector2f(25, 10)); AddInfantryman(new Vector2f(-25, -10)); AddInfantryman(new Vector2f(-25, 10)); SetAI(new RowboatAI(Game)); }
public Ship(Game game) : base(game) { if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL) { Model = Graphics.GetAnimatedSprite(game, "assets/sprites/ship.xml"); } else { Model = Graphics.GetSprite("assets/sprites/blueprint/ship.png"); Model.Scale = new Vector2f(0.5f, 0.5f); Model.Origin = new Vector2f(265, 244); } AddChild(Model); Collision = new RectangleShape(new Vector2f(265, 105)); Collision.Position = new Vector2f(-132.5f, -52.5f); SpeedMax = 50.0f + Math.Min(0.5f * Game.AIManager.Difficulty, 25.0f); Acc = 200.0f; AmountOfInfantry = Utils.RandomInt(12, 18); SetAI(new ShipAI(Game)); }
public Weapon(Game game, Entity sourceObject) { Game = game; SourceObject = sourceObject; Init(); }
public HeadsUpDisplay(Game Game) : base(Game, null) { // Score Score = new Text("00000000", Game.TidyHand, 50); Score.Color = new Color(255, 255, 255, 180); Score.Position = new Vector2f(Game.Size.X - 270, 2); AddChild(Score); ScoreMultiplier = new Text("x001", Game.TidyHand, 35); ScoreMultiplier.Color = new Color(200, 200, 200, 180); ScoreMultiplier.Position = new Vector2f(Game.Size.X - 100, 50); AddChild(ScoreMultiplier); // Powerups Layer_Powerups = new Layer(); AddChild(Layer_Powerups); // FPS if (DisplayFPS) { FPS = new Text("00.0", Game.TidyHand, 30); FPS.Position = new Vector2f(Game.Size.X - 70, Game.Size.Y - 40); AddChild(FPS); FPSUpdateTimer = new Timer(500); // Update every 0.5 seconds FPSUpdateTimer.Elapsed += FPSUpdate; FPSUpdateTimer.Start(); } }
public Pickup(Game game, dynamic model = null) : base(game, (object) model) { Collision = new CircleShape(15); Collision.Origin = new Vector2f(15, 15); Collision.FillColor = new Color(0, 255, 0); }
public Projectile(Game game, dynamic model, ProjectileWeapon weapon) : base(game, (object)model) { Weapon = weapon; SourceObject = weapon.SourceObject; Velocity = new Vector2f(); LastPos = new Vector2f(); }
public Entity(Game Game, dynamic model = null) { this.Game = Game; if (model != null) { Model = model; AddChild(Model); } Init(); }
public PhysicalEntity(Game Game, dynamic model = null) : base(Game, (object)model) { HealthMax = 10000; Health = HealthMax; FlashOnDamage = true; SpeedMax = 100.0f; // 100px a second Acc = 400.0f; // hits full speed in 0.25 seconds Friction = 400.0f; // loses all speed in 0.25 seconds Velocity = new Vector2f(0, 0); }
public Cannon(Game game) : base(game, game.GraphicsMode == Game.GRAPHICSMODE_NORMAL ? Graphics.GetSprite("assets/sprites/cannon.png") : Graphics.GetSprite("assets/sprites/blueprint/cannon.png")) { Model.Scale = new Vector2f(0.5f, 0.5f); Model.Origin = new Vector2f(26, 30); CanMove = false; RemoveOnDeath = false; HealthMax = 1000; Health = UpgradeLevels[0]; PowerupEffect = new DisplayObject(); AddChildAt(PowerupEffect, 0); }
/// <param name="spawnDelay">In ms. Used to easily allow infantry to gradually move out of a ship.</param> /// <param name="ship">The ship this infantry is/will be spawned from (used only if spawnDelay is not 0).</param> public Infantryman(Game game, int spawnDelay = 0, Ship ship = null) : base(game, null) { Model = new CircleShape(4, 12); if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL) { Model.FillColor = new Color((byte)Utils.RandomInt(0, 255), (byte)Utils.RandomInt(0, 255), (byte)Utils.RandomInt(0, 255)); Model.OutlineColor = new Color(0, 0, 0); Model.OutlineThickness = 3; } else if (Game.GraphicsMode == Game.GRAPHICSMODE_BLUEPRINT) { Model.FillColor = new Color(0, 0, 0, 0); Model.OutlineColor = new Color(255, 255, 255); Model.OutlineThickness = 2; } AddChild(Model); Origin = new Vector2f(Model.Radius, Model.Radius); Collision = Model; HealthMax = 4000; Health = HealthMax; //SpeedMax = 100.0f; //Acc = 400.0f; SpeedMax = 10.0f + Math.Min(0.1f * Game.AIManager.Difficulty, 10.0f); Acc = 80.0f; Friction = 1000.0f; if (spawnDelay == 0) { SetAI(new InfantrymanAI(Game)); } else { CanTakeDamage = false; Visible = false; if (ship == null) return; Ship = ship; SpawnDelayTimer = new Timer(spawnDelay); SpawnDelayTimer.AutoReset = false; SpawnDelayTimer.Elapsed += OnSpawn; SpawnDelayTimer.Start(); } }
public MessageFade(Game game, string msg, uint fontSize, Vector2f position, Action callBack = null, double showTime = 1500, bool center = true) : base(game) { Text = new Text(msg, Game.TidyHand, fontSize); Text.Color = new Color(255, 255, 255, 0); FloatRect textRect = Text.GetLocalBounds(); if (center) Text.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height / 2.0f); AddChild(Text); Position = position; ShowTimer = new Timer(showTime); ShowTimer.AutoReset = false; ShowTimer.Elapsed += ShowTimerHandler; CallBack = callBack; }
public Explosion(Game Game, float ExplosionRadius) : base(Game, null) { this.ExplosionRadius = ExplosionRadius; ExplosionWaves = new List<CircleShape>(); // Create Waves for (int i = 0; i < WAVE_AMOUNT; i++) { ExplosionWaves.Add(new CircleShape(ExplosionRadius, 40)); ExplosionWaves[i].Origin = new Vector2f(ExplosionRadius, ExplosionRadius); ExplosionWaves[i].FillColor = new Color(0, 0, 0, 0); ExplosionWaves[i].OutlineThickness = 8; ExplosionWaves[i].Scale = new Vector2f(GROW_SPEED, GROW_SPEED); AddChild(ExplosionWaves[i]); } }
/// <summary> /// Dynamic animation of fading circle waves. Used for having waves approach a circle island and fade out on the shore. /// </summary> /// <param name="Game"></param> /// <param name="Radius">End Radius (ie: the radius of an Island that waves are going into).</param> /// <param name="ScaleOverlap">How much waves overlap into the Radius. Between 0-1.</param> /// <param name="ScaleMax">The starting scale of incoming waves.</param> /// <param name="Thickness"></param> /// <param name="PointCount"></param> public CircleWaves(Game Game, float Radius, float ScaleOverlap, float ScaleMax, uint Thickness = 4, uint PointCount = 50) : base(Game, null) { this.Radius = Radius; this.ScaleOverlap = ScaleOverlap; this.ScaleMax = ScaleMax; this.PointCount = PointCount; this.Thickness = Thickness; Colour = new Color(255, 255, 255); Waves = new List<CircleShape>(); Reverse = new List<bool>(); WaveTimer = new Timer(Utils.RandomInt(WAVE_FREQUENCY_MIN, WAVE_FREQUENCY_MAX)); WaveTimer.Elapsed += WaveTimerHandler; WaveTimer.Start(); AddWave(); }
public AnimatedSprite(Game game, AnimatedSpriteData data) : base(game) { Data = data; TotalFrames = Data.Frames.Count; Model = new DisplayObject(); if (Data.Texture != null) { Sprite = new Sprite(Data.Texture); Sprite.Texture.Smooth = true; Model.AddChild(Sprite); } AddChild(Model); CurrentTime = 0; FrameLength = 1 / FPS; SetFrame(0); }
public HowToPlay(Game game) : base(game) { // Background Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png"); BluePrintBackground.Texture.Repeated = true; BluePrintBackground.TextureRect = new IntRect(0, 0, (int)Game.Size.X, (int)Game.Size.Y); AddChild(BluePrintBackground); // help Text help = new Text("(tap to continue)", Game.TidyHand, 30); FloatRect textRect = help.GetLocalBounds(); help.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height / 2.0f); help.Position = new Vector2f(Game.Size.X / 2, Game.Size.Y - 25); AddChild(help); Tutorial = Graphics.GetAnimatedSprite(Game, Graphics.ASSETS_SPRITES + "gui/HowToPlay.xml"); Tutorial.Sprite.Texture.Smooth = false; Tutorial.Stop(); Tutorial.SetFrame(0); AddChild(Tutorial); }
public GameOverGUI(Game game) : base(game) { RectangleShape dim = new RectangleShape(new Vector2f(Game.Size.X, Game.Size.Y)); dim.FillColor = new Color(0, 0, 0, 100); AddChild(dim); RectangleShape back = new RectangleShape(new Vector2f(Game.Size.X, 490)); back.FillColor = new Color(0, 0, 0, 100); back.Position = new Vector2f(0, Game.Size.Y / 2 - (back.Size.Y/2)); AddChild(back); FloatRect textRect; Text gameOver = new Text("Game Over", Game.TidyHand, 120); textRect = gameOver.GetLocalBounds(); gameOver.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height/2.0f); gameOver.Position = new Vector2f(Game.Size.X/2, Game.Size.Y/2 - 190); AddChild(gameOver); Text msg = new Text("Press any key to retry.", Game.TidyHand, 35); textRect = msg.GetLocalBounds(); msg.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height / 2.0f); msg.Position = new Vector2f(Game.Size.X / 2, Game.Size.Y / 2 - 100); AddChild(msg); Text finalScore = new Text("Final Score", Game.TidyHand, 60); textRect = finalScore.GetLocalBounds(); finalScore.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height / 2.0f); finalScore.Position = new Vector2f(Game.Size.X / 2, Game.Size.Y / 2 + 120); AddChild(finalScore); Text score = new Text(Game.Player.GetScore().ToString("00000000"), Game.TidyHand, 50); textRect = score.GetLocalBounds(); score.Origin = new Vector2f(textRect.Left + textRect.Width / 2.0f, textRect.Top + textRect.Height / 2.0f); score.Position = new Vector2f(Game.Size.X / 2, Game.Size.Y / 2 + 180); AddChild(score); }
public CannonWeapon(Game game, Entity sourceObject) : base(game, sourceObject) { ProjectileSpeed = 600.0f; Damage = 4000; ProjectileRotateSpeed = 10; ShootSoundBuffer1 = new SoundBuffer("assets/audio/shotgun1.ogg"); ShootSoundBuffer2 = new SoundBuffer("assets/audio/shotgun2.ogg"); ShootSound1 = new Sound(ShootSoundBuffer1); ShootSound2 = new Sound(ShootSoundBuffer2); ExplosionSoundBuffer1 = new SoundBuffer("assets/audio/explode1.ogg"); ExplosionSoundBuffer2 = new SoundBuffer("assets/audio/explode2.ogg"); ExplosionSound1 = new Sound(ExplosionSoundBuffer1); ExplosionSound2 = new Sound(ExplosionSoundBuffer2); SplashSoundBuffer1 = new SoundBuffer("assets/audio/splash1.ogg"); SplashSoundBuffer2 = new SoundBuffer("assets/audio/splash2.ogg"); SplashSound1 = new Sound(SplashSoundBuffer1); SplashSound2 = new Sound(SplashSoundBuffer2); }
public VoronoiDiagram(Game game, Vector2f Size) : base(game) { // Generate }
public ProjectileWeapon(Game game, Entity sourceObject) : base(game, sourceObject) { }
public Character(Game Game, dynamic model = null) : base(Game, (object)model) { Team = 0; Player = false; }
public UpgradeMenu(Game game) : base(game) { }
public Powerup(Game game, Cannon cannon, int type) { Game = game; Cannon = cannon; Type = type; }
public StartMenu(Game game) : base(game) { }
public InfantrymanAI(Game Game) : base(Game) { }
static void Main(string[] args) { Game Game = new Game(); }
public RowboatAI(Game Game) : base(Game) { }
public PauseMenu(Game game) : base(game) { }
/// <param name="xml">The XML file for the Animated Sprite.</param> public static AnimatedSprite GetAnimatedSprite(Game game, string xml) { AnimatedSprite sprite = new AnimatedSprite(game, GetAnimatedSpriteData(xml)); return sprite; }
public SimpleSingleSwitchMenu(Game game) : base(game) { Setup(); }