Xna Intersect会变慢

时间:2016-04-13 16:56:29

标签: c# xna collision

您好我的代码有问题:

for (int i = 0; i < map.collision_rects.Count(); i++)
        {
            if (player.collision_rect.Intersects(map.collision_rects[i]))
            {

                    Debug.WriteLine("INTERSERCTED:" + player.velocity.Y);
                    player.velocity.Y = 0;
                    player.has_jumped = false;



            }
        }
        player.Update(gameTime);

问题在于它检测到它相交但速度设置为比检测到的帧晚一个零

 if (has_jumped == true)
        {
            float i = 1;
            velocity.Y += 0.15f*i;
        }

设定速度的代码

0 个答案:

没有答案