user1920206
user1920206

Reputation: 69

How to animate a sprite in WinForms c# to achive projectile motion?

I have already developed the algorithms behind the physics of projectile motion. My only problem is drawing on a form.How would I achieve this from scratch.

Upvotes: 0

Views: 961

Answers (1)

Pablo Romeo
Pablo Romeo

Reputation: 11406

The question is a bit too general, but just to shed some light, I think you probably want to create a PictureBox control and draw on that, instead of on the actual form that has your controls and settings.

Here's how you create the Graphics object for a pictureBox, for example, and then draw a line on it: Draw a line on PictureBox from parent

Now, your simulation, I believe, should actually draw lines, between the newly calculated (x,y) and the previously calculated one, in order to plot a full line instead of just dots, and that will probably happen within a loop in which you vary t (time) in intervals.

Upvotes: 1

Related Questions