MovementManagement [C#] [Wired] [Butterfly]

Results 1 to 5 of 5
  1. #1
    Member Al0ne is offline
    MemberRank
    Jan 2012 Join Date
    NetherlandsLocation
    88Posts

    MovementManagement [C#] [Wired] [Butterfly]

    First, this is NOT coded by me i found this somewhere on the internet.

    I'm currently coding wired and this looks pretty good and stable!
    So maybe helpfull for people who are coding wired or who wants to make it better.

    This is not for noobs.

    Oh yeah.. Srry for my bad Dnglish i'm Dutch

    Code:
    using System;
    using System.Drawing;
     
    namespace Butterfly.HabboHotel.Rooms.Wired.WiredHandlers.Effects
    {
        class MovementManagement
        {
            private Random rnd;
     
            public MovementManagement()
            {
                this.rnd = new Random();
            }
     
            private static void HandleMovement(ref Point coordinate, MovementState state)
            {
                switch (state)
                {
                    case MovementState.down:
                        {
                            coordinate.Y++;
                            break;
                        }
     
                    case MovementState.up:
                        {
                            coordinate.Y--;
                            break;
                        }
     
                    case MovementState.left:
                        {
                            coordinate.X--;
                            break;
                        }
     
                    case MovementState.right:
                        {
                            coordinate.X++;
                            break;
                        }
                }
            }
     
            protected Point HandleMovement(Point newCoordinate, MovementState state, int newRotation)
            {
                Point newPoint = new Point(newCoordinate.X, newCoordinate.Y);
     
                switch (state)
                {
                    case MovementState.up:
                    case MovementState.down:
                    case MovementState.left:
                    case MovementState.right:
                        {
                            HandleMovement(ref newPoint, state);
                            break;
                        }
     
                    case MovementState.leftright:
                        {
                            if (rnd.Next(0, 2) == 1)
                            {
                                HandleMovement(ref newPoint, MovementState.left);
                            }
                            else
                            {
                                HandleMovement(ref newPoint, MovementState.right);
                            }
                            break;
                        }
     
                    case MovementState.updown:
                        {
                            if (rnd.Next(0, 2) == 1)
                            {
                                HandleMovement(ref newPoint, MovementState.up);
                            }
                            else
                            {
                                HandleMovement(ref newPoint, MovementState.down);
                            }
                            break;
                        }
     
                    case MovementState.random:
                        {
                            switch (rnd.Next(1, 5))
                            {
                                case 1:
                                    {
                                        HandleMovement(ref newPoint, MovementState.up);
                                        break;
                                    }
                                case 2:
                                    {
                                        HandleMovement(ref newPoint, MovementState.down);
                                        break;
                                    }
     
                                case 3:
                                    {
                                        HandleMovement(ref newPoint, MovementState.left);
                                        break;
                                    }
                                case 4:
                                    {
                                        HandleMovement(ref newPoint, MovementState.right);
                                        break;
                                    }
                            }
                            break;
                        }
                }
     
                return newPoint;
            }
     
            protected int HandleRotation(int oldRotation, RotationState state)
            {
                int rotation = oldRotation;
                switch (state)
                {
                    case RotationState.clocwise:
                        {
                            HandleClockwiseRotation(ref rotation);
                            return rotation;
                        }
     
                    case RotationState.counterClockwise:
                        {
                            HandleCounterClockwiseRotation(ref rotation);
                            return rotation;
                        }
     
                    case RotationState.random:
                        {
                            if (rnd.Next(0, 3) == 1)
                            {
                                HandleClockwiseRotation(ref rotation);
                            }
                            else
                            {
                                HandleCounterClockwiseRotation(ref rotation);
                            }
                            return rotation;
                        }
                }
     
                return rotation;
            }
     
            private static void HandleClockwiseRotation(ref int rotation)
            {
                rotation = rotation + 2;
                if (rotation > 6)
                    rotation = 0;
            }
     
            private static void HandleCounterClockwiseRotation(ref int rotation)
            {
                rotation = rotation - 2;
                if (rotation < 0)
                    rotation = 6;
            }
        }
    }


  2. #2
    Account Upgraded | Title Enabled! kooga is offline
    MemberRank
    Dec 2009 Join Date
    271Posts

    Re: MovementManagement [C#] [Wired] [Butterfly]

    Quote Originally Posted by Al0ne View Post
    First, this is NOT coded by me i found this somewhere on the internet.

    I'm currently coding wired and this looks pretty good and stable!
    So maybe helpfull for people who are coding wired or who wants to make it better.

    This is not for noobs.

    Oh yeah.. Srry for my bad Dnglish i'm Dutch

    Code:
    using System;
    using System.Drawing;
     
    namespace Butterfly.HabboHotel.Rooms.Wired.WiredHandlers.Effects
    {
        class MovementManagement
        {
            private Random rnd;
     
            public MovementManagement()
            {
                this.rnd = new Random();
            }
     
            private static void HandleMovement(ref Point coordinate, MovementState state)
            {
                switch (state)
                {
                    case MovementState.down:
                        {
                            coordinate.Y++;
                            break;
                        }
     
                    case MovementState.up:
                        {
                            coordinate.Y--;
                            break;
                        }
     
                    case MovementState.left:
                        {
                            coordinate.X--;
                            break;
                        }
     
                    case MovementState.right:
                        {
                            coordinate.X++;
                            break;
                        }
                }
            }
     
            protected Point HandleMovement(Point newCoordinate, MovementState state, int newRotation)
            {
                Point newPoint = new Point(newCoordinate.X, newCoordinate.Y);
     
                switch (state)
                {
                    case MovementState.up:
                    case MovementState.down:
                    case MovementState.left:
                    case MovementState.right:
                        {
                            HandleMovement(ref newPoint, state);
                            break;
                        }
     
                    case MovementState.leftright:
                        {
                            if (rnd.Next(0, 2) == 1)
                            {
                                HandleMovement(ref newPoint, MovementState.left);
                            }
                            else
                            {
                                HandleMovement(ref newPoint, MovementState.right);
                            }
                            break;
                        }
     
                    case MovementState.updown:
                        {
                            if (rnd.Next(0, 2) == 1)
                            {
                                HandleMovement(ref newPoint, MovementState.up);
                            }
                            else
                            {
                                HandleMovement(ref newPoint, MovementState.down);
                            }
                            break;
                        }
     
                    case MovementState.random:
                        {
                            switch (rnd.Next(1, 5))
                            {
                                case 1:
                                    {
                                        HandleMovement(ref newPoint, MovementState.up);
                                        break;
                                    }
                                case 2:
                                    {
                                        HandleMovement(ref newPoint, MovementState.down);
                                        break;
                                    }
     
                                case 3:
                                    {
                                        HandleMovement(ref newPoint, MovementState.left);
                                        break;
                                    }
                                case 4:
                                    {
                                        HandleMovement(ref newPoint, MovementState.right);
                                        break;
                                    }
                            }
                            break;
                        }
                }
     
                return newPoint;
            }
     
            protected int HandleRotation(int oldRotation, RotationState state)
            {
                int rotation = oldRotation;
                switch (state)
                {
                    case RotationState.clocwise:
                        {
                            HandleClockwiseRotation(ref rotation);
                            return rotation;
                        }
     
                    case RotationState.counterClockwise:
                        {
                            HandleCounterClockwiseRotation(ref rotation);
                            return rotation;
                        }
     
                    case RotationState.random:
                        {
                            if (rnd.Next(0, 3) == 1)
                            {
                                HandleClockwiseRotation(ref rotation);
                            }
                            else
                            {
                                HandleCounterClockwiseRotation(ref rotation);
                            }
                            return rotation;
                        }
                }
     
                return rotation;
            }
     
            private static void HandleClockwiseRotation(ref int rotation)
            {
                rotation = rotation + 2;
                if (rotation > 6)
                    rotation = 0;
            }
     
            private static void HandleCounterClockwiseRotation(ref int rotation)
            {
                rotation = rotation - 2;
                if (rotation < 0)
                    rotation = 6;
            }
        }
    }
    Ill help you.

    First, this is NOT coded by me I found this somewhere on the internet.

    I'm currently coding wired and this looks pretty good and stable!
    So this may be helpfull for people who are coding wired or who want to make it better.

    This is not for noobs.

    Oh yeah.. Sorry for my bad English I'm Dutch

  3. #3
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: MovementManagement [C#] [Wired] [Butterfly]

    Quote Originally Posted by kooga View Post
    Ill help you.

    First, this is NOT coded by me I found this somewhere on the internet.

    I'm currently coding wired and this looks pretty good and stable!
    So this may be helpfull for people who are coding wired or who want to make it better.

    This is not for noobs.

    Oh yeah.. Sorry for my bad English I'm Dutch
    I helped someone with his English once and now you're helping people with it aswell?

  4. #4
    Retired maritnmine is offline
    MemberRank
    May 2007 Join Date
    North KoreaLocation
    1,103Posts

    Re: MovementManagement [C#] [Wired] [Butterfly]

    This is what happens when you forget to switch the pastebin expiration time from "Forever" to "10 minutes". However, Im sorry that its not gonna be any helpfull for you guys x) But you could at least mention that I coded it clap

    - Martin

  5. #5
    Account Upgraded | Title Enabled! Chapo is offline
    MemberRank
    Jul 2010 Join Date
    United StatesLocation
    944Posts

    Re: MovementManagement [C#] [Wired] [Butterfly]

    Quote Originally Posted by maritnmine View Post
    This is what happens when you forget to switch the pastebin expiration time from "Forever" to "10 minutes". However, Im sorry that its not gonna be any helpfull for you guys x) But you could at least mention that I coded it clap

    - Martin
    http://api.elitevs.net/check2.php nice license for bfly ^^



Advertisement