+ 2
Can someone help me with using multiple time.deltatime and .movetowards in C#?
I am trying to get a character to slowly move to a position and wait for some time, then move to a new spot. Using the properties mentioned in the question.
1 Answer
0
01. Add a Label in your Form. //here form name is Form1 & Label name is label1
02. Add a timer on the Form.
03. Set the timer timeout to 100ms.
04. added the following code to the form
If you do properly, it will works!
public Form1()
{
InitializeComponent();
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Location = new Point(label1.Location.X + 5, label1.Location.Y);
if (label1.Location.X > this.Width)
{
label1.Location = new Point(0 - label1.Width, label1.Location.Y);
}
}