public void RenewParticle(Vector2 position, Vector2 initialForce, float angle, float angularVelocity, Color color, Vector2 scale, float TTL, IDs id) { this.Sprite = SpriteHandler.GetSprite((int)id); if (Sprite is Sprite) { Sprite.Origin = new Vector2(Sprite.SpriteRect.Width / 2, Sprite.SpriteRect.Height / 2); //! If drawables constructor changes, so must this } Stop(); Sprite.Origin = new Vector2(Sprite.SpriteRect.Width / 2, Sprite.SpriteRect.Height / 2); //! hmmm Position = position; AddForce(initialForce); this.angle = angle; this.angularVelocity = angularVelocity; baseColor = color; this.Sprite.MColor = color; baseScale = scale; this.Sprite.Scale = baseScale; currentTTL = new Timer(TTL); this.TTL = TTL; this.id = id; IsActive = true; Behaviour(); if (id == IDs.AFTERIMAGE) { currentTTL.AddTime(-currentTTL.currentTime / 2); } }
public virtual void SetStats(IDs id) { Sprite = SpriteHandler.GetSprite((int)id); Team = EntityConstants.GetStatsFromID(EntityConstants.TEAM, id); if (Sprite is Sprite) { Sprite.Origin = new Vector2(Sprite.SpriteRect.Width / 2, Sprite.SpriteRect.Height / 2); } }
public AnimatedEventHandler(Game1 game, EventOperator op, GameMode gameMode) { this.gameMode = gameMode; this.game = game; this.op = op; this.font = DrawHelper.BIGFONT; boss = new BossAppearance(); eventTimer = new Timer(COUNTDOWNTIME); logo = SpriteHandler.GetSprite((int)IDs.LOGO); logo.Position = new Vector2(WindowSize.Width / 2, WindowSize.Height / 2); logo.Origin = new Vector2(logo.SpriteRect.Width / 2, logo.SpriteRect.Height / 2); }
public void Draw(SpriteBatch spriteBatch, GameTime gameTime, bool fullDraw) { if (!BetweenLevelsTimer.IsFinished && fullDraw) { Sprite popupBkg = SpriteHandler.GetSprite((int)IDs.POPUPTEXTBKG); popupBkg.Position = wordPos - new Vector2((popupBkg.SpriteRect.Width / 2) - 50, (popupBkg.SpriteRect.Height / 2) - 35); popupBkg.Scale = new Vector2(0.8f, 0.5f); popupBkg.LayerDepth = 0; popupBkg.Draw(spriteBatch, gameTime); // layer deapth doesnt work sp need this string s = "Wave " + Level + " incoming!"; spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), DrawHelper.SCOREFONT, s, DrawHelper.CenteredWordPosition(s, DrawHelper.SCOREFONT, wordPos), Color.Wheat); } }
private void InitBackgrounds() { float xScaleFactorForBkg = (cols + 2) * spacing + offsetX * 2 + (cols + 1) * itemSize * ClickableItem.SCALEFACTOR - itemSize / 2; upgradeBarBkg = SpriteHandler.GetSprite((int)IDs.UPGRADEBAR); screenBkg = SpriteHandler.GetSprite((int)IDs.MENUSCREENBKG); outlineBkg = SpriteHandler.GetSprite((int)IDs.UPGRADEBAR); outlineBkg.MColor = Color.DarkGray; outlineBkg.Position = new Vector2(xScaleFactorForBkg, 0); int yScaleFactorForBkg = WindowSize.Height / 3; // original sprite is 1x3 outlineBkg.Scale = new Vector2(4, yScaleFactorForBkg); screenBkg.Scale = new Vector2(WindowSize.Width, WindowSize.Height); upgradeBarBkg.Scale = new Vector2(xScaleFactorForBkg, yScaleFactorForBkg); upgradeBarBkg.LayerDepth = 1; // background should be in background screenBkg.LayerDepth = 0; }
public UpgradeBarItem(Vector2 position, SpriteFont font, IDs id = IDs.DEFAULT) : base(position, id) { this.font = font; box = SpriteHandler.GetSprite((int)IDs.EMPTYPART); box.Position = position; box.Origin -= new Vector2(-halfSpriteSize, -halfSpriteSize); // corrects origin to sprite box.Scale *= SCALEFACTOR; if (id == IDs.RECTHULLPART || id == IDs.HAMMERPART || id == IDs.ROTATEPART) { Sprite.Scale *= 0.7f; } BoundBox = new Rectangle((int)position.X, (int)position.Y, (int)(32 * SCALEFACTOR), (int)(32 * SCALEFACTOR)); BoundBox.Offset(-halfSpriteSize * SCALEFACTOR, -halfSpriteSize * SCALEFACTOR); SetPrice(); SetName(); Vector2 belowItemVector = new Vector2(position.X, position.Y + halfSpriteSize * SCALEFACTOR + belowItemSpacing); Vector2 belowNameVector = new Vector2(belowItemVector.X, belowItemVector.Y + namePriceSpacing); belowItemPosition = DrawHelper.CenteredWordPosition(Name, font, belowItemVector); belowNamePosition = DrawHelper.CenteredWordPosition("$" + Price.ToString(), font, belowNameVector); }
internal void Draw(SpriteBatch spriteBatch, GameTime gameTime) { UpgradeBar.Draw(spriteBatch, gameTime); Vector2 wordPos = new Vector2(WindowSize.Width / 2, WindowSize.Height / 2 - 350); Sprite popupBkg = SpriteHandler.GetSprite((int)IDs.POPUPTEXTBKG); popupBkg.Scale = new Vector2(0.8f, 0.5f); popupBkg.LayerDepth = 0; string temp = "Upgrade your ship!"; popupBkg.Position = wordPos - new Vector2(popupBkg.SpriteRect.Width / 2 - 55, -40 + popupBkg.SpriteRect.Height / 2); popupBkg.Draw(spriteBatch, gameTime); spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), DrawHelper.UPGRADEFONT, temp, DrawHelper.CenteredWordPosition(temp, DrawHelper.UPGRADEFONT, wordPos), Color.Wheat); popupBkg.Draw(spriteBatch, gameTime); // layer deapth doesnt work sp need this foreach (KeyValuePair <int, ShipItem> item in shipItems) { item.Value.Draw(spriteBatch, gameTime); } }