VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



sniper-like shooting game,shoot at whatever target you want!

by lotsk8rs (5 Submissions)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 6th July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

sniper-like shooting game,shoot at whatever target you want!

Rate sniper-like shooting game,shoot at whatever target you want!



'drag 2 timers onto the form and copy this code straight on
Private Sub Form_keydown(keycode As Integer, shift As Integer)

If keycode = vbKeyLeft And Shape1.Left > 0 Then
Shape1.Left = Shape1.Left - 150
End If
If keycode = vbKeyRight And Shape1.Left <= (Form1.Width - Shape1.Width) Then
    Shape1.Left = Shape1.Left + 150
End If
If keycode = vbKeyUp And Shape1.Top > 0 Then
Shape1.Top = Shape1.Top - 150
End If
If keycode = vbKeyDown And Shape1.Left <= (Form1.Height - Shape1.Height) Then
    Shape1.Top = Shape1.Top + 150
End If
If keycode = vbKeySpace And Image1.Visible = True And Shape1.Left > Image1.Left And Shape1.Left < (Image1.Left + Image1.Width) And Shape1.Top > Image1.Top And Shape1.Top < (Image1.Top + Image1.Height) And kill1 = False Then
Form1.Image1.Picture = LoadPicture("C:/targetboom.bmp")
Form1.Label1.Caption = Form1.Label1.Caption + 1
Image1.Visible = False
End If
If keycode = vbKeySpace And Image2.Visible = True And Shape1.Left > Image2.Left And Shape1.Left < (Image2.Left + Image2.Width) And Shape1.Top > Image2.Top And Shape1.Top < (Image2.Top + Image2.Height) And kill2 = False Then
Form1.Image2.Picture = LoadPicture("C:/targetboom.bmp")
Form1.Label1.Caption = Form1.Label1.Caption + 1
Image2.Visible = False

End If
If keycode = vbKeySpace And Image3.Visible = True And Shape1.Left > Image3.Left And Shape1.Left < (Image3.Left + Image3.Width) And Shape1.Top > Image3.Top And Shape1.Top < (Image3.Top + Image3.Height) And kill3 = False Then
Form1.Image3.Picture = LoadPicture("C:/targetboom.bmp")
Form1.Label1.Caption = Form1.Label1.Caption + 1
Image3.Visible = False
End If
If keycode = vbKeySpace And Image4.Visible = True And Shape1.Left > Image4.Left And Shape1.Left < (Image4.Left + Image4.Width) And Shape1.Top > Image4.Top And Shape1.Top < (Image4.Top + Image4.Height) And kill4 = False Then
Form1.Image4.Picture = LoadPicture("C:/targetboom.bmp")
Form1.Label1.Caption = Form1.Label1.Caption + 1
Image4.Visible = False
End If

End Sub


Private Sub Form_Load()

MsgBox ("You are a professional sniper, testing you skills. Shoot as many targets as possible.Control the aimer with the cursor keys and shoot with space")
End Sub

Private Sub timer1_timer()
Dim myvalue
'
' Randomize
'
myvalue = Int((4 * Rnd) + 1)   ' Generate random value between 1 and 4.
'
Rnd
If (myvalue = 1) Then

Form1.Image2.Visible = False
Form1.Image3.Visible = False
Form1.Image4.Visible = False
'
Form1.Image1.Visible = True
Form1.Image1.Picture = LoadPicture("c:/target.bmp")

End If
' Case number 2
If (myvalue = 2) Then

Form1.Image1.Visible = False
Form1.Image3.Visible = False
Form1.Image4.Visible = False
'
Form1.Image2.Visible = True
Form1.Image2.Picture = LoadPicture("c:/target.bmp")


End If
' Case number 3
If (myvalue = 3) Then

Form1.Image1.Visible = False
Form1.Image2.Visible = False
Form1.Image4.Visible = False
'
Form1.Image3.Visible = True
Form1.Image3.Picture = LoadPicture("c:/target.bmp")

End If
' Case number 4
If (myvalue = 4) Then

Form1.Image1.Visible = False
Form1.Image2.Visible = False
Form1.Image3.Visible = False
'
Form1.Image4.Visible = True
Form1.Image4.Picture = LoadPicture("c:/target.bmp")


End If
If Label1.Caption = 0 Then
Timer1.Interval = 6000
End If
If Label1.Caption = 1 Then
Timer1.Interval = 5500
End If
If Label1.Caption = 2 Then
Timer1.Interval = 5000
End If
If Label1.Caption = 3 Then
Timer1.Interval = 4500
End If
If Label1.Caption = 4 Then
Timer1.Interval = 4000
End If
If Label1.Caption = 5 Then
Timer1.Interval = 3500
End If
If Label1.Caption = 6 Then
Timer1.Interval = 3000
End If
If Label1.Caption = 7 Then
Timer1.Interval = 2500
End If
If Label1.Caption = 8 Then
Timer1.Interval = 2000
End If
If Label1.Caption = 9 Then
Timer1.Interval = 1500
End If
If Label1.Caption = 10 Then
MsgBox ("you win")
End

End If
End Sub

Private Sub Timer2_Timer()
Label2.Caption = Label2.Caption + 1
End Sub



Download this snippet    Add to My Saved Code

sniper-like shooting game,shoot at whatever target you want! Comments

No comments have been posted about sniper-like shooting game,shoot at whatever target you want!. Why not be the first to post a comment about sniper-like shooting game,shoot at whatever target you want!.

Post your comment

Subject:
Message:
0/1000 characters