Skip to content

A simple interactive physics simulation with a ball.

Notifications You must be signed in to change notification settings

stevendevan/BouncyBall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BouncyBall

A simple interactive physics simulation with a ball.

End goal is to have the ball bounce around the form window smoothly.

Key files:

FormMain.cs

BallPhysics.cs

Ball.cs

Progression


rev2

Got all the skeleton in place for the form layout and appearance.

Got a feel for events such as MouseClick and got the text to successfully disappear when the mouse is held down.

Later I would realize that I can just specify that the text label is not allowed to have focus, and that will make it disappear when I click on it.

rev2


rev3

Got the ball to draw upon clicking the mouse, although I didn't bother getting it centered just yet. Focusing on small steps.

rev3


rev4

This is when I figured out the setting to make elements non-focusable.

As you can see, the ball correctly updates position even if I click inside it's drawbox.

rev4


rev5

Enlarged the ball for better visibility.

The ball now centers on the mouse pointer.

rev5


rev6

Implemented ball physics.

As you can see, I was having some trouble with absolute/relative mouse coordinates. Relative coordinates are not always available depending on where in the scope you try to reference them.

rev6


rev7

Ball position is now consistent with release point. I figured out how to deal with the relative/absolute mouse position stuff.

Ball physics are working ok, but not as smooth as I would like. Not sure how complicated it's going to be to fix. I'm running the physics loop at a time step of 7 milliseconds, so maybe if I increase that to be closer to 60 Hz rather than my monitor's 144 Hz.

Next step is implementing collision with the form walls.

rev7

About

A simple interactive physics simulation with a ball.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages