Dragon_Rose (rena_roo) wrote in ncommunity,
Dragon_Rose
rena_roo
ncommunity

  • Mood:

*scream*

stupid stupid program.

I had no idea how to get graphics to work in vb.net. My teacher finally showed me how, and explained how to do the rest of the maze project.
so i've got one maze that works.

what really SUX and can cost me marks is that the other two mazes don't work. no reason not to. they work on keypress, and the code was copy/pasted and then the variable names changed (ie: "maze1" is turned to "maze2", etc) to fit the different mazes. and the damn red dot won't move.

this is an example of the code under the keypress option:\

"

'check for the end of the maze
If x > 33 Then
'close the maze
Me.Close()
'congratulate the user on completion
MsgBox("Congratulations for completing the maze!", MsgBoxStyle.OKOnly, "Congratulations!")
End If

' check for wall with each keypress.
If e.KeyChar = "6"c Then
If maze2.Grid(y, x + 1) = 0 Then
'if no wall, then Otto moves one to the right
x = x + 1
End If
End If
If e.KeyChar = "4"c Then
If maze2.Grid(y, x - 1) = 0 Then
'check to see if Otto is still within the parameters of the maze
If x - 1 >= 1 Then
'if no wall, then Otto moves one to the left
x = x - 1
Else
'otherwise, display a message box to redirect the user
MsgBox("Please go in the other direction. The end of the maze is to your right", MsgBoxStyle.OKOnly, "Wrong Way")
End If
End If
End If
If e.KeyChar = "8"c Then
If maze2.Grid(y - 1, x) = 0 Then
'check to see if Otto is still within the parameters of the maze
If y - 1 >= 2 Then
'if no wall, then Otto moves one space up the maze
y = y - 1
Else
'otherwise, display a message box to redirect the user
MsgBox("Please choose another direction.", MsgBoxStyle.OKOnly, "Wrong Way")
End If
End If
End If
If e.KeyChar = "2"c Then
If maze2.Grid(y + 1, x) = 0 Then
'check to see if Otto is still within the parameters of the maze
If y + 1 <= 33 Then
'if no wall, then Otto moves one space down the maze
y = y + 1
Else
'otherwise, display a message box to redirect the user
MsgBox("Please choose another direction.", MsgBoxStyle.OKOnly, "Wrong Way")
End If
End If
End If
'redraw the maze after every keypress so that Otto appears to be moving
Me.Invalidate()
End Sub

"

can anyone explain why it doesn't work?????

(if you email me, i can send you the .zip file.)
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 2 comments