Register for your free account! | Forgot your password?

You last visited: Today at 09:17

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Any better ways?

Discussion on Any better ways? within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Any better ways?

I know this is not CO related, but since there is quite a few c# programmers here and people actually speak English here then I thought I'd ask here.

Is there any better ways to calculate a movement for mouseclick?

Like when I click a spot the player should move there?

My code just seem to have so much for so little.

Current code:
Code:
        /// <summary>
        /// This method is called whenever a mouse button is lifted.
        /// </summary>
        /// <param name="e">The MouseButtonEventArgs.</param>
        public static void OnMouseUp(SdlDotNet.Input.MouseButtonEventArgs e)
        {
            if (e.X >= Program.GameClient.ScreenX && e.Y >= Program.GameClient.ScreenY)
            {
                Program.GameClient.movedX = (400);
                Program.GameClient.movedY = (300);
                MouseSyncEvent.runEvent = true;

                MouseSyncEvent.Add(e.Position, () =>
                {
                    Movement_DR(e.Position);
                }, 10);
            }
            else if (e.X <= Program.GameClient.ScreenX && e.Y >= Program.GameClient.ScreenY)
            {
                Program.GameClient.movedX = (400);
                Program.GameClient.movedY = (300);
                MouseSyncEvent.runEvent = true;

                MouseSyncEvent.Add(e.Position, () =>
                {
                    Movement_DL(e.Position);
                }, 10);
            }
            else if (e.X >= Program.GameClient.ScreenX && e.Y <= Program.GameClient.ScreenY)
            {
                Program.GameClient.movedX = (400);
                Program.GameClient.movedY = (300);
                MouseSyncEvent.runEvent = true;

                MouseSyncEvent.Add(e.Position, () =>
                {
                    Movement_UR(e.Position);
                }, 10);
            }
            else if (e.X <= Program.GameClient.ScreenX && e.Y <= Program.GameClient.ScreenY)
            {
                Program.GameClient.movedX = (400);
                Program.GameClient.movedY = (300);
                MouseSyncEvent.runEvent = true;

                MouseSyncEvent.Add(e.Position, () =>
                {
                    Movement_UL(e.Position);
                }, 10);
            }
        }

        private static void Movement_DR(Point point)
        {
            if (Program.GameClient.movedX > 0 && Program.GameClient.movedY > 0)
            {
                Graphics.GraphicsLabel.ClearPermLabels();
                Graphics.GraphicsLabel.Create("[" + Program.GameClient.movedX + ", " + point.X + "], [" + Program.GameClient.movedY + ", " + point.Y + "]", Color.White, "Verdana", 18, 0, new Point(5, 5), true);

                if (Program.GameClient.movedX != point.X && Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(2);
                    Mapping.GameMap.SwitchMapPosition(1);
                }
                else if (Program.GameClient.movedX != point.X)
                {
                    Mapping.GameMap.SwitchMapPosition(2);
                }
                else if (Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(1);
                }
                else if (Program.GameClient.movedX == point.X)
                {
                    Program.GameClient.movedX = 0;
                }
                else if (Program.GameClient.movedY == point.Y)
                {
                    Program.GameClient.movedY = 0;
                }
            }
            else
                MouseSyncEvent.Clear();
        }

        private static void Movement_DL(Point point)
        {
            if (Program.GameClient.movedX > 0 && Program.GameClient.movedY > 0)
            {
                Graphics.GraphicsLabel.ClearPermLabels();
                Graphics.GraphicsLabel.Create("[" + Program.GameClient.movedX + ", " + point.X + "], [" + Program.GameClient.movedY + ", " + point.Y + "]", Color.White, "Verdana", 18, 0, new Point(5, 5), true);

                if (Program.GameClient.movedX != point.X && Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(3);
                    Mapping.GameMap.SwitchMapPosition(1);
                }
                else if (Program.GameClient.movedX != point.X)
                {
                    Mapping.GameMap.SwitchMapPosition(3);
                }
                else if (Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(1);
                }
                else if (Program.GameClient.movedX == point.X)
                {
                    Program.GameClient.movedX = 0;
                }
                else if (Program.GameClient.movedY == point.Y)
                {
                    Program.GameClient.movedY = 0;
                }
            }
            else
                MouseSyncEvent.Clear();
        }

        private static void Movement_UR(Point point)
        {
            if (Program.GameClient.movedX > 0 && Program.GameClient.movedY > 0)
            {
                Graphics.GraphicsLabel.ClearPermLabels();
                Graphics.GraphicsLabel.Create("[" + Program.GameClient.movedX + ", " + point.X + "], [" + Program.GameClient.movedY + ", " + point.Y + "]", Color.White, "Verdana", 18, 0, new Point(5, 5), true);

                if (Program.GameClient.movedX != point.X && Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(2);
                    Mapping.GameMap.SwitchMapPosition(0);
                }
                else if (Program.GameClient.movedX != point.X)
                {
                    Mapping.GameMap.SwitchMapPosition(2);
                }
                else if (Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(0);
                }
                else if (Program.GameClient.movedX == point.X)
                {
                    Program.GameClient.movedX = 0;
                }
                else if (Program.GameClient.movedY == point.Y)
                {
                    Program.GameClient.movedY = 0;
                }
            }
            else
                MouseSyncEvent.Clear();
        }

        private static void Movement_UL(Point point)
        {
            if (Program.GameClient.movedX > 0 && Program.GameClient.movedY > 0)
            {
                Graphics.GraphicsLabel.ClearPermLabels();
                Graphics.GraphicsLabel.Create("[" + Program.GameClient.movedX + ", " + point.X + "], [" + Program.GameClient.movedY + ", " + point.Y + "]", Color.White, "Verdana", 18, 0, new Point(5, 5), true);

                if (Program.GameClient.movedX != point.X && Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(3);
                    Mapping.GameMap.SwitchMapPosition(0);
                }
                else if (Program.GameClient.movedX != point.X)
                {
                    Mapping.GameMap.SwitchMapPosition(3);
                }
                else if (Program.GameClient.movedY != point.Y)
                {
                    Mapping.GameMap.SwitchMapPosition(0);
                }
                else if (Program.GameClient.movedX == point.X)
                {
                    Program.GameClient.movedX = 0;
                }
                else if (Program.GameClient.movedY == point.Y)
                {
                    Program.GameClient.movedY = 0;
                }
            }
            else
                MouseSyncEvent.Clear();
        }
But as you can see it works.

I don't have a username is offline  
Reply


Similar Threads Similar Threads
is there any ways to fix lag?
01/12/2011 - General Gaming Discussion - 3 Replies
Result tested by Speedtest.net Ping:361ms ISP: TOT Sever:Bangkok Ping in FT game: always 1red bar ONLY as u guys can see my internet is REAL slow and my parents wouldn't get me a faster one : / more importantly I hate being a LAGGER ! this bothers me a lot b/c
Ways to change exp
05/31/2009 - Dekaron Private Server - 15 Replies
Hey guys, just want to be at the safe side... are there other ways to change the exp than in monster.csv? i heard somethin about formula.ini, but i just saw the party exp there.. and thats not enough :S thank ya for answering
Are there any ways to get around the warehouse pw?
04/13/2008 - Conquer Online 2 - 4 Replies
Anyone got any hacks or something to get by a warehouse pw? i nd one bad!



All times are GMT +1. The time now is 09:18.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.