OK, I had some spare time so I added some vector variables. Here is the code now:
Private Sub Physics()
Dim sngXComp As Single 'Resultant X and Y components
Dim sngYComp As Single
Dim i As Integer
'Thrust
If mblnUpKey Then
mblnUpKey = False...
This is actually already done in the Physics subroutine. Here is the code:
Private Sub Physics()
Dim sngXComp As Single 'Resultant X and Y components
Dim sngYComp As Single
Dim i As Integer
'Thrust
If mblnUpKey Then
mblnUpKey = False
'Determine the X and Y...
First things first, I will convert my variables into velocity and acceleration vectors. I will get that fixed, then work on the moving to coordinate problem.
Am I corect in saying that the Xvelocity = speed * Sin(Heading) and Yvelocity = speed * Cos(Heading)?
and the Xacceleration = ACCEL *...
I am testing it in VB6 at the moment, but am going to convert it to VB.NET when I have some time.
The link to the vb6 file is: http://canning.co.nz/shpshoot.zip
It is a simple physics demo, about moving a 2d ship with some physics.
If my ship is not moving, it is pretty easy, just rotate to the target and apply thrust. My problem is if the ship is already moving.
Can I please have some help with the physics ideas behind this and/or some advice on formulas?
thanks
I am writing a 2d computer game and need some help.
I have a spaceship that is moving(or stationary) and I want to move it to a destination coordinate.
Here are the main variables:
Const PI = 3.14159 'Mmmm.. Pi
Const ACCEL = 0.1 'Rate of increase of speed
Const...