public Flies() : base(10, 10, 10, 10) { this.EntityType = EntityType.Fly; this.Target = Vector.Create(0, 0); this.Size = Vector.Create(20, 20); GetNewTarget(); this._sprite = new SpriteSheetContext("flies.png", 1, 3) { RenderPosition = new OffsetVector(this.Position, new ScalingVector(this.Size, -0.5f, -0.5f)) }; }
public Enemy() : base(10, 10, 10, 10) { this.Size = Vector.Create(32, 32); var healthbarSize = Vector.Create(50, 5); this._greenHealthbar = new SolidRectangleContext(RGBA.Green) { RenderSize = new ScalingVector(healthbarSize, Vector.Create(this.Health.GetPureRatio(), 1)), RenderBorderColor = RGBA.Black, RenderBorderSize = 2, //-25 + 0, -30 -10 RenderPosition = new OffsetVector(Position, new OffsetVector(new ScalingVector(healthbarSize, -0.5f, -1), new ScalingVector(Size, 0, -1))) }; this._redHealthbar = new SolidRectangleContext(RGBA.Red) { RenderSize = healthbarSize, RenderBorderColor = RGBA.Black, RenderBorderSize = 2, RenderPosition = new OffsetVector(Position, new OffsetVector(new ScalingVector(healthbarSize, -0.5f, -1), new ScalingVector(Size, 0, -1))) }; this.EntityType = EntityType.Enemy; Random random = new Random(); //Generates a random position for the enemy var positionX = random.Next(positionXLowerBound, positionXHigherBound); var positionY = random.Next(positionYLowerBound, positionYHigherBound); //Generates a random speed for the enemy int speed = random.Next(enemyMovementSpeedLowerBound, enemyMovementSpeedHigherBound); this.enemyMovementSpeed = speed; Position.X = positionX; Position.Y = positionY; if (RNG.Next(100) < 10) { IsAnt = true; this._sprite = GetAntSprite(this.Position, this.Size); this.enemyMovementSpeed = enemyMovementSpeedLowerBound; } else { IsAnt = false; this._sprite = GetEnemySprite(this.Position, this.Size); } }
public CharacterSelection() { for (int i = 0; i < characters.Length; i++) { characters[i] = new SpriteSheetContext("Clawdia_Direction_Anim-Sheet.png", 8, 8) { RenderSize = Vector.Create(64, 64), }; //don't tint the first character if (i > 0) { characters[i].RenderColor = new Annex.Data.RGBA((byte)RNG.Next(255), (byte)RNG.Next(255), (byte)RNG.Next(255)); } } this.Events.AddEvent("ChooseCharacter", PriorityType.INPUT, ChooseCharacter, 500); }
public RegenPotion() : base() { this.EntityType = EntityType.RegenPotion; this.buffType = BuffTypes.Regen; this._sprite = new SpriteSheetContext("regen_potion.png", 1, 10) { RenderPosition = new OffsetVector(this.Position, Vector.Create(-16, -16)), RenderSize = Vector.Create(32, 32) }; this._text = new TextContext(this._name, "Default.ttf") { RenderPosition = new OffsetVector(this.Position, Vector.Create(-30, 17)), FontColor = RGBA.White, BorderColor = RGBA.Black, BorderThickness = 2, FontSize = 12 }; }
public Sword() : base() { this.EntityType = EntityType.Sword; this.buffType = BuffTypes.Damage; this._sprite = new SpriteSheetContext("Sword_Sprite_Sheet.png", 1, 23) { RenderPosition = new OffsetVector(this.Position, Vector.Create(-16, -16)), RenderSize = Vector.Create(32, 32) }; this._text = new TextContext(this._name, "Default.ttf") { RenderPosition = new OffsetVector(this.Position, Vector.Create(-16, 12)), FontColor = RGBA.White, BorderColor = RGBA.Black, BorderThickness = 2, FontSize = 12 }; }
public PoisonBow() : base() { this.EntityType = EntityType.PoisonBow; this.buffType = BuffTypes.DOT; this._sprite = new SpriteSheetContext("poison_bow.png", 1, 13) { RenderPosition = new OffsetVector(this.Position, Vector.Create(-16, -16)), RenderSize = Vector.Create(40, 40) }; this._text = new TextContext(this._name, "Default.ttf") { RenderPosition = new OffsetVector(this.Position, Vector.Create(-30, 17)), FontColor = RGBA.White, BorderColor = RGBA.Black, BorderThickness = 2, FontSize = 12 }; }
public SpeedRing() : base() { this.EntityType = EntityType.SpeedRing; this.buffType = BuffTypes.Speed; this._sprite = new SpriteSheetContext("speed_ring.png", 1, 8) { RenderPosition = new OffsetVector(this.Position, Vector.Create(-16, -16)), RenderSize = Vector.Create(40, 40) }; this._text = new TextContext(this._name, "Default.ttf") { RenderPosition = new OffsetVector(this.Position, Vector.Create(-30, 17)), FontColor = RGBA.White, BorderColor = RGBA.Black, BorderThickness = 2, FontSize = 12 }; }
public override void HandleJoystickButtonPressed(JoystickButtonPressedEvent e) { if (e.Button == JoystickButton.A) { selectedCharacter = characters[index]; EditingPlayer._sprite = new SpriteSheetContext(selectedCharacter.SourceTextureName, (uint)selectedCharacter.NumRows, (uint)selectedCharacter.NumColumns) { RenderPosition = new OffsetVector(EditingPlayer.Position, Vector.Create(-32, -32)), RenderSize = Vector.Create(64, 64), RenderColor = selectedCharacter.RenderColor }; EditingPlayer.overlay.SetColors(selectedCharacter.RenderColor); SceneManager.Singleton.LoadScene <Stage1.Stage1>(); } if (e.Button == JoystickButton.Back) { this.HandleCloseButtonPressed(); } }
public Player() { this.Position = Vector.Create(0, 0); this.Name = "Player Name"; this._sprite = new SpriteSheetContext("player.png", 4, 4) { RenderPosition = new OffsetVector(this.Position, Vector.Create(-48, -90)) }; this._hoverText = new TextContext(this.Name, "Augusta.ttf") { RenderPosition = new OffsetVector(this.Position, Vector.Create(-48, -100)), Alignment = new TextAlignment() { HorizontalAlignment = HorizontalAlignment.Center, Size = Vector.Create(96, 0) }, FontColor = RGBA.White, BorderColor = RGBA.Black, BorderThickness = 3, FontSize = 16 }; }
public void Draw(SpriteSheetContext sheet) { if (String.IsNullOrEmpty(sheet.SourceTextureName)) { return; } if (sheet.SourceTextureRect == null) { using var sprite = this.GetSprite(sheet.SourceTextureName); var size = sprite.Texture.Size; sheet.SourceTextureRect = new Data.Shared.IntRect(); int width = (int)(size.X / sheet.NumColumns); int height = (int)(size.Y / sheet.NumRows); sheet.SourceTextureRect.Width.Set(width); sheet.SourceTextureRect.Height.Set(height); } sheet.SourceTextureRect.Top.Set(sheet.SourceTextureRect.Height * sheet.Row); sheet.SourceTextureRect.Left.Set(sheet.SourceTextureRect.Width * sheet.Column); this.Draw(sheet._internalTexture); }
public Fireball(Player target, Vector position) : base(5, 5, 5, 5) { this.target = target; this.Size = Vector.Create(15, 15); this.Position.Set(position); float tx = target.Position.X - this.Position.X; float ty = target.Position.Y - this.Position.Y; double angle = Math.Atan2(ty, tx) + 3.14f; double cos = Math.Cos(angle); double sin = Math.Sin(angle); DX = (float)(2 * cos); DY = (float)(2 * sin); this._fireballSprite = new SpriteSheetContext("fireball.png", 1, 3) { RenderPosition = new OffsetVector(this.Position, new ScalingVector(this.Size, -0.5f, -0.5f)) }; }