コード例 #1
0
        public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
        {
            Vector2 velocity = projectile.velocity;

            if (falling)
            {
                projectile.velocity = Collision.AnyCollision(projectile.position, projectile.velocity, projectile.width, projectile.height, true);
            }
            else
            {
                projectile.velocity = Collision.TileCollision(projectile.position, projectile.velocity, projectile.width, projectile.height, true, true, 1);
            }
            if (falling)
            {
                int tileX = (int)(projectile.Center.X) / 16;
                int tileY = (int)(projectile.Center.Y) / 16;
                if (projectile.velocity != velocity || Main.tile[tileX, tileY + 1].active())
                {
                    projectile.Kill();
                }
            }
            else if (projectile.velocity != velocity)
            {
                falling            = true;
                projectile.hostile = true;
            }
            return(false);
        }
コード例 #2
0
 public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
 {
     if (falling)
     {
         projectile.velocity = Collision.AnyCollision(projectile.position, projectile.velocity, projectile.width, projectile.height, true);
     }
     else
     {
         projectile.velocity = Collision.TileCollision(projectile.position, projectile.velocity, projectile.width, projectile.height, fallThrough, fallThrough, 1);
     }
     return(false);
 }
コード例 #3
0
ファイル: AurasandBall.cs プロジェクト: Eldrazi/Gyrolite
        public override void PostAI()
        {
            Vector2 oldVelocity = projectile.velocity;

            if (projectile.hostile)
            {
                projectile.velocity = Collision.AnyCollision(projectile.position, projectile.velocity, projectile.width, projectile.height);
            }
            else
            {
                projectile.velocity = Collision.TileCollision(projectile.position, projectile.velocity, projectile.width, projectile.height, true, true, 1);
            }
            if (projectile.velocity != oldVelocity)
            {
                projectile.position += projectile.velocity;
                projectile.Kill();
            }
        }