Example #1
0
        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            if (Framing.GetTileSafely(i, j - 1).type != Type && Main.player[Main.myPlayer].mount.Type != ModContent.GetInstance <Boat>().Type)
            {
                Vector2 zero      = new Vector2(Main.offScreenRange, Main.offScreenRange);
                Vector2 pixelPos  = 16f * new Vector2(i, j) + zero;
                Vector2 screenPos = pixelPos - Main.screenPosition;
                Vector2 boatPos   = new Vector2((int)screenPos.X - 140, (int)screenPos.Y + 46 + disp);

                StarSailorMod t = ModContent.GetInstance <StarSailorMod>();
                GuiHelpers.DrawLine(spriteBatch, screenPos + new Vector2(10, 10), boatPos + new Vector2(t.boatTex.Width - 10, 20), t.ropeTex.Height, Color.White, t.ropeTex);
                spriteBatch.Draw(t.boatTex, new Rectangle((int)boatPos.X, (int)boatPos.Y, t.boatTex.Width, t.boatTex.Height), Color.White);
            }
            return(base.PreDraw(i, j, spriteBatch));
        }
Example #2
0
        public void DrawGravGui(SpriteBatch sb)
        {
            Vector2   direction  = dirToGrav / dirToGrav.Length();
            Vector2   perpDir    = new Vector2(-direction.Y, direction.X);
            float     tangVel    = Vector2.Dot(player.velocity, perpDir);
            float     radVel     = Vector2.Dot(player.velocity, direction);
            Player    p          = Main.player[Main.myPlayer];
            Rectangle playerRect = p.getRect();
            float     maxSize    = playerRect.Height;
            float     minSize    = playerRect.Width;
            float     diff       = maxSize - minSize;

            playerRect.Width = (int)maxSize;
            //playerRect.Width = (int)(minSize + (0.5f * diff) + (-0.5f * diff * Math.Cos(2 * p.fullRotation)));
            //playerRect.Height = (int)(minSize + (0.5f * diff) +  (0.5f * diff * Math.Cos(2 * p.fullRotation)));
            playerRect.X -= (int)(0.5f * (playerRect.Width - minSize));
            playerRect.Y -= (int)(0.5f * (playerRect.Height - maxSize));
            Vector2 centre = new Vector2((playerRect.X - Main.screenPosition.X) + (playerRect.Width / 2), (playerRect.Y - Main.screenPosition.Y) + (playerRect.Height / 2));

            sb.Draw(ModContent.GetInstance <StarSailorMod>().pixel, new Rectangle((int)(playerRect.X - Main.screenPosition.X), (int)(playerRect.Y - Main.screenPosition.Y), playerRect.Width, playerRect.Height), Color.Pink * 0.3f);
            GuiHelpers.DrawLine(sb, centre, centre + (tangVel * perpDir * 30f), 5, Color.Red);
            GuiHelpers.DrawLine(sb, centre, centre + (radVel * direction * 30f), 5, Color.Blue);
            GuiHelpers.DrawLine(sb, centre, centre + (16f * dirToGrav), 2, Color.Green);
        }