Projectile motion - simulation w/ wind velocity

Hi First time posting so sorry if i miss some things.

i'm making a project for my A2 computing project on projectile motion with wind velocity on a 2D plane.

I have the basic motion set-up but am having some trouble with my timing. At the moment i'm using the built in timer ticking at 1ms. However with this timer my projectile (a ball) is jumping(looks like its teleporting). It's already double buffered and this made it alot smoother for obvious reasons however i can't seem to find a way to make the projectile move smoothly.

The way i'm moving the ball is by calculating the velocity of the ball and then whatever the velocity is the ball moves that amount in whichever direction obviously this makes the ball move x amount of pixels every ms (not including code runtime) so as i have it the ball is not going to be moving smoothly but i can't seem to find a way to make the ball move at the same speed but smoother say moving a set 2pixels but still moving x amount every ms.

Any help would be greatly appreciated.

if someone could tell me how to add in code i will happily add in the code within my timer tick event.

okay figured out how to use code so heres the code within my timer tick

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
private: System::Void tmrmove_Tick(System::Object^  sender, System::EventArgs^  e) {
			 			   //the circle postion move every 50 millisecods (based on Interval)
     //It'll move 4 px every 50 milliseconds
	System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));



			 if (finish){
				 Force.X = 0;
				 Force.Y = 0;
				 tmrmove->Stop();
			 }
			 else{		 
			 setcircleSpeed();
			 
     circlePos.X += circleSpeed.X;
     circlePos.Y += circleSpeed.Y;
     ////////////////////////////////////////////////////////////////////////////////////////
	 //MOVE BALL TO OPPOSITE SCREN SIDE IF HITS SIDE TO LOOK LIKE CONTINUOUS MOVING
     //if it hits the left of the form
     if(circlePos.X + 25 <= 0)
     {
     circlePos.X = Screen_width - 25;
     
     }
     //if it hits the right of the form 
     //(50 is the width of circle)
     if(circlePos.X + 25 > this->Width)
     {
      circlePos.X = 0;//(this->Width - 0.1) - 25;
     
     }
  //////////////////////////////////////////////////////////////////////////////////////////////////
	 //if it hits the top of the Form
     if(circlePos.Y <= 0)
     {
      circlePos.Y = Screen_height;
	  this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"$this.BackgroundImage")));
	  Screen_level += 1;

      //reverse the direction
      //circleSpeed.Y *= -0.1;
     }
     //if it hits the bottom of the form 
     //(25 is the height of circle)
     else if(circlePos.Y + 25 > this->Height)
     {
      circlePos.Y = (this->Height - 0.1) - 25;
      //reverse the direction
	  if (Screen_level != 0){
		  circlePos.Y = 0;
		  Screen_level -= 1;
	  }
	  else if (Velocity.Y != 0){
		  bounce();}
	 // else{
     //circleSpeed.Y = 0;
	 //circleSpeed.X = 0;
	 //FinalVelocity = Point(Velocity.X, Velocity.Y);
	 //finish = true;
	  }//}
     
  
     //refresh the Form so it'll redraw the circle with the new position
	this->Refresh();
	 }
		 }
Last edited on
hey im doing same project maybe we can help each other
email me please at batousik@yandex.ru
Topic archived. No new replies allowed.