All pastes #395234 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-14 21:46 UTC
rendered paste body
        protected void Grab()
        {
            FlatRedBall.Input.Mouse.MouseButtons b = new FlatRedBall.Input.Mouse.MouseButtons();
            foreach (GravObj g in gravObjList)
            {
                if (InputManager.Mouse.ButtonPushed(b) && !g.GetGrabbed())
                {
                    if (g.isInside(InputManager.Mouse.WorldXAt(g.Z), InputManager.Mouse.WorldYAt(g.Z)))
                    {
                        g.SetGrabbed();
                        grabbedObj = g;
                    }
                }
                if (!InputManager.Mouse.ButtonDown(b) && g.GetGrabbed())
                {
                    g.SetGrabbed();
                    grabbedObj = null;
                    g.XVelocity = InputManager.Mouse.XVelocity / 49;
                    g.YVelocity = -1 * (InputManager.Mouse.YVelocity / 49);
                }
            }
        }