public Beam(Game game, Sprite sprite, Player player, List <GameObject> gameObjects, float angle) : base(game, sprite) { this.sprite = sprite; this.player = player; this.angle = angle; PositionRotation(); beamsparks = new Emittor(game, SpriteManager.AddSprite(Textures.Pixeltexture), 0.5f, Color.White, Color.Pink, Color.LightPink, 0.3f, float.MaxValue, this, 1.0f, (angle - (float)Math.PI / 2) - 0.3f, (angle - (float)Math.PI / 2) + 0.3f, rotationoffset, true); gameObjects.Add(beamsparks); }
public void SetPosition(List<GameObject> gameObjects) { angle = (float)Math.Atan2( CursorY - player.Sprite.Y, CursorX - player.Sprite.X); sprite.Position = player.Sprite.Position + new Vector3((player.Sprite.Height-sprite.Height) * (float)Math.Cos(angle), (player.Sprite.Width - sprite.Width) * (float)Math.Sin(angle), 0); sprite.Velocity.X = (float)Math.Cos(angle) * projectilevelocity; sprite.Velocity.Y = (float)Math.Sin(angle) * projectilevelocity; sprite.RotationZ = angle; if (selectedSpell == 1) { firetail = new Emittor(game, SpriteManager.AddSprite(Textures.Pixeltexture), .15f, Color.Tomato, Color.Yellow, Color.Orange, 0.05f, float.MaxValue, this, 1, (angle + (float)Math.PI / 2), ((angle + (float)Math.PI * 3 / 2)), 0, false); gameObjects.Add(firetail); } }
public override void Kill(List<GameObject> gameObjects) { SpriteManager.RemoveSprite(sprite); gameObjects.Remove(this); if (selectedSpell != 1) { Emittor explosion = new Emittor(game, SpriteManager.AddSprite(Textures.Pixeltexture), .3f, Color.Tomato, Color.Yellow, Color.Orange, 0.3f, 0.3f, sprite.Position, 3, (0), ((float)Math.PI * 2)); gameObjects.Add(explosion); } if (selectedSpell == 1) { firetail.Kill(gameObjects); } }