-
December 18th, 2012, 09:25 PM
#1
Need help!
Need help making this game!
http://www.dpcdsb.org/NR/rdonlyres/8...Assignment.pdf
This is what I got so far.
The penguin moves.
I need to make the rocks to fall, and to fall randomly. Once it hits the penguin it will switch to deadPenguin. I also want to add lives. Hearts will randomly fall at random times. Start with 3 lives. Anyone help?
Code:
Imports System.IO
Public Class FallingRocks
Private rnd As New Random
Private rocks(10) As PictureBox
Private imgRock As Image
Private penguin, deadPenguin As Image
Private xPos, yPos, score, xRocks, yRocks As Integer
Private Sub FallingRocks_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Left Then
picPenguin.Location = New Point(picPenguin.Location.X - 10, picPenguin.Location.Y)
End If
If e.KeyCode = Keys.Right Then
picPenguin.Location = New Point(picPenguin.Location.X + 10, picPenguin.Location.Y)
End If
End Sub
Private Sub FallingRocks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrGame.Start()
score = 0
imgRock = Image.FromFile(Directory.GetCurrentDirectory() & "\images\stone.png")
penguin = Image.FromFile(Directory.GetCurrentDirectory() & "\images\penguin.png")
deadPenguin = Image.FromFile(Directory.GetCurrentDirectory() & "\images\deadPenguin.png")
xPos = Me.Width / 2 - picPenguin.Width / 2
yPos = Me.Height - picPenguin.Height - 40
picPenguin.Location = New Point(xPos, yPos)
For i As Integer = 0 To rocks.Length - 1
rocks(i) = New PictureBox
rocks(i).BackColor = Color.Transparent
rocks(i).SizeMode = PictureBoxSizeMode.AutoSize
rocks(i).Image = imgRock
Controls.Add(rocks(i))
Next
lblScore.Text = "SCORE: " & score
End Sub
Private Sub tmrGame_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrGame.Tick
End Sub
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|