Game Test

ARC

Well-known member
Joined
Sep 9, 2006
Messages
63
Location
Minnesota
Programming Experience
Beginner
Hey, could someone check this out and see what they think? I havnt compiled it yet, but just open it, and test it out by doing CTRL+F5

Check out the code, and make any suggestions, good and bad critisism plz! I'm fairly new, as im sure you'll see by the code, but I'm a quick learner.:D :cool:
 

Attachments

  • Dragon Hunt.zip
    42.4 KB · Views: 50
Last edited by a moderator:
Not bad, but i'd look into using ElseIf instead of endless If/End If's e.g

VB.NET:
[CODE] 
If 1=1 then
 
End if
 
If 2=1 then
 
End if
[/CODE]
Or

VB.NET:
If 1=1 then
 
'Do Something
 
Elseif 2=1 then
 
'Do Something
 
Elseif ..

Secondly I'd do Dragon State as an Enum...

VB.NET:
Friend Enum DragonState
 
Sleeping
Wandering
Hungry
 
End Enum


Then the code would be..

VB.NET:
If Form2.dragonstate = Dragonstate.Sleeping then

Other than that, cool bananas!!
 
So Enum chooses one of the options randomly? or do I still have to assign them somehow?

VB.NET:
Friend Enum DragonState
 
Sleeping
Wandering
Hungry
 
End Enum


Also, I was thinking that maybe I should have each command as it's own Public Sub.


VB.NET:
[COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] userinputLOWER
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].inputtext.Text = [/SIZE][SIZE=2][COLOR=#800000]"?"
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"!rules"
[/COLOR][/SIZE][SIZE=2]Rules()
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"!enter"
[/COLOR][/SIZE][SIZE=2]EnterCave()
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"!exit"
[/COLOR][/SIZE][SIZE=2]LeaveCave()
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"!attack"
[/COLOR][/SIZE][SIZE=2]Attack()
[/SIZE][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"!hide"
[/COLOR][/SIZE][SIZE=2]HideAway()
 
[/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE]

Perhaps that would help organize things more too.
[/COLOR]
 
No it won't randomise anything for you. It's just easier themn working with strings, like you were doing. Have a play around with them and there are literally tonnes of articles on the web about Enum's
 
So i've made each command the user can use a seperate public sub... that way the ScrollToCaret() works a lot more organized, as well as the ability to edit and fix errors anywhere... As you're able to see where they are coming from easier.

The problem I'm having now though is that I cant seem to get it to recognize numbers that are typed into the text box. Before, I just typed them all in individually in an ifthen or a select case statement... but if I want the total number of rooms to go beyond 16, like to say 100 or 1000, that's way too much typing. Obviously.

This is what I am trying to do for the 16 rooms.

VB.NET:
Public Sub ChangeRoom()
 
ULocation = userinputTOnumber
Form2.uroom.Text = ULocation
 
Me.displaytext.Focus()
Me.displaytext.ScrollToCaret()
Me.inputtext.Focus()
 
End Sub

VB.NET:
Public Sub GrabText()
 
userinputLOWER = inputtext.Text.ToLower
userinputTOnumber = CInt(userinput)
 
If userinputTOnumber > 0 Then
      If userinputTOnumber < 17 Then
            ChangeRoom()
      End If
End If

Any suggestions on how I'm approaching this?
 
Back
Top