14,423,178 members
Rate this:
See more:
Hello, I am a Searcher in the Postgraduate level at faculty of Information Computing, and my graduation project involves a simulation for a movement of multiple trains, i am trying to stop a point on a specified (x,y), then i want to rotate its heading and change the (angle) of its heading.
"Basic C# Game Programming Moving Object on the form " here : https://www.youtube.com/watch?v=3eIzmcTe0mg[^]
which illustrates how to control the movement of the point using the KeyDown Event in the .NET, but i want to enter different locations at different times ( it will be stored in a variable and entered by a textbox or whatever ) , so if you please, guide and tell me how to rotate the heading of the point when arrived to a specified (x,y) and also how to stop it on its station (another (x,y)) in the railway network .
and if that is related to "grid networking" ??
------------------
i have found that system.Drawing has a function, which can be overloaded such as :
e.Graphics.RotateTransform(30.0F); , but i found that it is not only rotate the transform, but also changes its location, you can check it by yourself.
------------------
also i tried this method :
----------------
```int x_ex = 60, y_ex = 60;
private void increase_distance(PaintEventArgs e)
{
// draw a rectangl
e.Graphics.FillRectangle(Brushes.Blue, x_ex, y_ex, 20, 20);
// increase or decrease it's movement
x_ex = x_ex + (int)2.5;
y_ex = y_ex + (int)2.5;
// try to stop and rotate it
if (x_ex == 90)
{

//x_ex = (int)e.Graphics.Transform.RotateAt(30.0F, search on google
// (RotateTransform method) not only rotate the object but also change the location and its coordinates
e.Graphics.RotateTransform(30.0F);
// you can notice that its color will be changed for a fraction of moment when (x_ex=90)
e.Graphics.FillRectangle(Brushes.Green, 90, 90, 20, 20);

//x_ex = 0;
//y_ex = 0;

}
}```

Thank you.
Posted