public Boss() : base("boss") { PositionAndTarget = new Vector2(520f, 290f); // chase hero Chasing = new ChaseBehavior(Level.Current.hero); Chasing.MoveSpeed = RandomMath.RandomBetween(0.18f, 0.24f); Chasing.ChaseRange = 30f; // RandomMath.RandomBetween(12f, 40f); Chasing.SatisfiedRange = 1f; Add(Chasing); DrawInfo.Center = new Vector2(0.5f, 0.5f); MySpriteBatch = new TTSpriteBatch(Screen.graphicsDevice, SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); }
public override void Process(Entity entity, DrawComp drawComp, PositionComp posComp, LevelBackgroundComp lbc) { // update drawpos var p = posComp.Position + posComp.PositionModifier; drawComp.DrawPosition = activeScreen.ToPixels(p); drawComp.LayerDepth = p.Z; // Z position is translated to a layer depth lbc.DrawCenter = activeScreen.ToPixels(lbc.Center); // TODO check TTSpriteBatch sb = activeScreen.SpriteBatch; // draw sprite sb.Draw(lbc.Texture, drawComp.DrawPosition, null, drawComp.DrawColor, drawComp.DrawRotation, lbc.DrawCenter, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth); }
public override void Process(Entity screenlet, ScreenComp screenComp, DrawComp drawComp) { // check if present screenComp is the active one in this Draw() round if (!screenlet.IsActive) { return; } _gfxDevice.SetRenderTarget(screenComp.RenderTarget); _gfxDevice.Clear(screenComp.BackgroundColor); // in this initial round, start the drawing to this screenlet's spritebatch: TTSpriteBatch sb = screenComp.SpriteBatch; sb.BeginParameterized(); }
public override void Process(Entity entity, ScreenComp screen, DrawComp drawComp) { // check if present screenComp is the active one in this Draw() round if (!screen.IsActive) { return; } // in this final round, end the drawing to this screenlet: TTSpriteBatch sb = screen.SpriteBatch; sb.End(); // then render the screenbuffer onto the actual screen. TTGame.Instance.GraphicsDevice.SetRenderTarget(null); sb.Begin(SpriteSortMode.Immediate, BlendState.Opaque); sb.Draw(screen.RenderTarget, screen.ScreenRectangle, drawComp.DrawColor); sb.End(); }
/// <summary>Processes the specified entity.</summary> /// <param name="entity">The entity.</param> public override void Process(Entity entity, TextComp textComp, PositionComp posComp, DrawComp drawComp) { textComp.UpdateComp(dt); if (drawComp.IsVisible) { // use set screen, or default if not given. ScreenComp screen = drawComp.Screen; if (screen == null) { screen = activeScreen; } // update drawpos FIXME - should one system do this, now it's two? or make a helper method. var p = posComp.Position + posComp.PositionModifier; drawComp.DrawPosition = screen.ToPixels(p); drawComp.LayerDepth = p.Z; // Z position is translated to a layer depth // draw sprite TTSpriteBatch sb = screen.SpriteBatch; sb.DrawString(textComp.Font, textComp.Text, drawComp.DrawPosition, drawComp.DrawColor, 0f, Vector2.Zero, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth); } }
/// <summary>Processes the specified entity.</summary> /// <param name="entity">The entity.</param> public override void Process(Entity entity, SpriteComp spriteComp, PositionComp posComp, DrawComp drawComp) { if (drawComp.IsVisible) { ScreenComp screen = drawComp.Screen; // if no specific screen... if (screen == null) { screen = activeScreen; } // update drawpos var p = posComp.Position + posComp.PositionModifier; drawComp.DrawPosition = screen.ToPixels(p); drawComp.LayerDepth = p.Z; // Z position is translated to a layer depth //spriteComp.DrawCenter = screen.ToPixels(spriteComp.Center); // TODO check TTSpriteBatch sb = screen.SpriteBatch; // draw sprite sb.Draw(spriteComp.Texture, drawComp.DrawPosition, null, drawComp.DrawColor, drawComp.DrawRotation, spriteComp.DrawCenter, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth); } }
/// <summary> /// Init: the scrolling level itself. First Init method that is called /// </summary> protected virtual void InitLevel() { Motion.Scale = DEFAULT_SCALE; Motion.ScaleTarget = DEFAULT_SCALE; MySpriteBatch = new TTSpriteBatch(Screen.graphicsDevice, SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); }
public GameInfoBox() : base() { InitComponents(); MySpriteBatch = new TTSpriteBatch(Screen.graphicsDevice); }