sisquo76
Active member
Hello,
I am working on a small game, Moon Lander and I figured how to make rocket falling from the top of the panel which is on the form. I want to have fuel burning feature so I can land rocket properly on the bottom of the panel. Here is the code so far:
If anyone knows how to burn fuel (minus the gravity) so rocket starts to slow down, and eventually stop, then rise up, I would be grateful.
Regards,
Sisquo76
I am working on a small game, Moon Lander and I figured how to make rocket falling from the top of the panel which is on the form. I want to have fuel burning feature so I can land rocket properly on the bottom of the panel. Here is the code so far:
VB.NET:
Public Class Form1
Dim G As Double = 9.81
Dim T As Double = 0
Private Sub ButtonStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStart.Click
Me.Timer1.Enabled = True
Me.ButtonStart.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.PictureBox1.Location = New Point(120, 0)
End Sub
Private Function H() As Integer
Return CInt((G * T ^ 2) / 2)
End Function
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
T += 0.1
Me.PictureBox1.Location = New Point(120, H)
If H() >= 615 Then
Me.Timer1.Enabled = False
Me.ButtonStart.Enabled = True
T = 0
End If
End Sub
End Class
If anyone knows how to burn fuel (minus the gravity) so rocket starts to slow down, and eventually stop, then rise up, I would be grateful.
Regards,
Sisquo76