fliXNA_xbox.FlxCamera.follow C# (CSharp) Method

follow() public method

Make the camera follow an object with a specified follow-style
public follow ( FlxObject Target, uint Style = STYLE_LOCKON ) : void
Target FlxObject
Style uint
return void
        public void follow(FlxObject Target, uint Style=STYLE_LOCKON)
        {
            target = Target;
            float helper, w, h;
            switch (Style)
            {
                case STYLE_PLATFORMER:
                    w = width / 8;
                    h = height / 3;
                    deadzone = new FlxRect((width - w) / 2, (height - h) / 2 - h * 0.25f, w, h);
                    break;
                case STYLE_TOPDOWN:
                    helper = FlxU.max(width, height) / 3;
                    deadzone = new FlxRect((width - helper) / 3, (height - helper) / 3, helper, helper);
                    break;
                case STYLE_TOPDOWN_TIGHT:
                    helper = FlxU.max(width, height) / 12;
                    deadzone = new FlxRect((width - helper) / 2, (height - helper) / 2, helper, helper);
                    break;
                case STYLE_LOCKON:
                    break;
                case STYLE_LOOSE:
                    deadzone = new FlxRect(0, 0, width, height);
                    break;
                default:
                    deadzone = null;
                    break;
            }
        }