Example #1
0
        private void Update_Physics_GDI_Bounds(NetNavi_Type navi)
        {
            //Bounds
            if (navi.FaceLeft == true)
            {
                if (navi.Navi_Location().Left <= Screen.PrimaryScreen.WorkingArea.Left)
                {
                    navi.Location.X = Screen.PrimaryScreen.WorkingArea.Left - (navi.GetSize().X - navi.GetHitBox().Right); navi.Speed.X = 0;
                }
            }
            else
            {
                if (navi.Navi_Location().Left <= Screen.PrimaryScreen.WorkingArea.Left)
                {
                    navi.Location.X = Screen.PrimaryScreen.WorkingArea.Left - navi.GetHitBox().Left; navi.Speed.X = 0;
                }
            }

            if (navi.FaceLeft == true)
            {
                if (navi.Navi_Location().Right >= Screen.PrimaryScreen.WorkingArea.Right)
                {
                    navi.Location.X = Screen.PrimaryScreen.WorkingArea.Right - (navi.GetSize().X - navi.GetHitBox().Left); navi.Speed.X = 0;
                }
            }
            else
            {
                if (navi.Navi_Location().Right >= Screen.PrimaryScreen.WorkingArea.Right)
                {
                    navi.Location.X = Screen.PrimaryScreen.WorkingArea.Right - navi.GetHitBox().Right; navi.Speed.X = 0;
                }
            }

            if (navi.Navi_Location().Bottom > Screen.PrimaryScreen.WorkingArea.Bottom)
            {
                navi.Location.Y = Screen.PrimaryScreen.WorkingArea.Bottom - navi.GetHitBox().Bottom;
            }
            if (navi.Navi_Location().Bottom == Screen.PrimaryScreen.WorkingArea.Bottom)
            {
                navi.OnGround = true; navi.Speed.Y = 0;
            }
            else
            {
                navi.OnGround = false;
            }
        }
Example #2
0
        private void Update_Physics_GL_Bounds(NetNavi_Type navi)
        {
            bool OnGround = false;

            if (navi.Navi_Location().Left < 0)
            {
                navi.Set_LocationX(0); navi.Speed.X = 0; navi.StepMovement.X = 0;
            }

            if (navi.Navi_Location().Right > stage.Bounds.Width)
            {
                navi.Set_LocationX(stage.Bounds.Width - navi.Navi_Location().Width); navi.Speed.X = 0; navi.StepMovement.X = 0;
            }


            if (navi.Navi_Location().Bottom > stage.Bounds.Height)
            {
                navi.Location.Y = stage.Bounds.Height - navi.GetHitBox().Bottom;
            }
            if (navi.Navi_Location().Bottom == stage.Bounds.Height)
            {
                OnGround = true; navi.Speed.Y = 0; navi.StepMovement.Y = 0;
            }

            //Top bounds
            if (navi.Navi_Location().Top < 0)
            {
                navi.Location.Y = 0 - navi.GetHitBox().Top; navi.Speed.Y = 0; navi.StepMovement.Y = 0;
            }

            //CollisionMap
            foreach (StageCollisionTile tile in stage.CollisionMap.Values)
            {
                tile.Active = false;
            }

            Update_Physics_GL_Left(navi);
            Update_Physics_GL_Right(navi);

            Update_Physics_GL_Top(navi);
            Update_Physics_GL_Bottom(navi, OnGround);
        }
Example #3
0
        public void Random_Stuff()
        {
            Random rnd = new Random(DateTime.Now.Millisecond);

            nextaction--;
            if (nextaction <= 0)
            {
                targetlocation = rnd.Next(Screen.PrimaryScreen.WorkingArea.Right - Host_Navi.GetHitBox().Width);
                nextaction     = rnd.Next(500, 1000);
            }
        }