Jump to content
  • Advertisement
Sign in to follow this  
werd semaj

BlitzPlus Code Help

This topic is 3983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have began a text based game, as my first attempt at a "real" application in BlitzPlus. If you could run it and notice what happens (ends early and and some text that shouldn't be there). ;StoneWall-a text based adventure AppTitle "StoneWall" name$ = Input$ ("Hello, and Welcome to Stonewall. It is not a warm welcome though, Stonewall can be dangerous. Here I have no use for this sword you take it. I should explain how to play: press 'N' to move north 'S' to go south and 'E' and 'W' to go east and west respectivily. If you come across a rope type 'climb' to climb and if you see a character type 'talk' to talk. Oh, I could I be so rude? I'm Vilselence, what is your name?") Print "Nice to meet you " + name$ + ". Please type '0' when you have completed the reading" .mainroom ;Finish If Input$ = ("0") Then ;main room Print "You are in a large, cavernous room there are rooms to your East, West and North. There is a person in the room as well" EndIf If Input$ = ("talk") Then EndIf Print ("Hello " + name$ + " I'm afraid there is not much I can help you with. Press '1' to finish") If Input$ = ("1") Then Goto mainroom EndIf If Input$ = ("S") Then Print "This is not currently an option" Goto mainroom End If If Input$ = ("Climb") Then Print "I'm sorry, you cannot do that here" Goto mainroom EndIf ;North of main If Input$ = ("N") Then .ntunnel Print "You take a long, damp, winding tunnel to a dead end" EndIf If Input$ = ("N") Then Print " You can't go this way" Goto ntunnel EndIf If Input$ = ("E") Then Print " You can't go this way" Goto ntunnel End If If Input$ = ("W") Then Print " You can't go this way" Goto ntunnel EndIf If Input$ = ("Climb") Then Print "You can't do that" Goto ntunnel EndIf If Input$ = ("Talk") Then Print "There is no one here" Goto ntunnel EndIf That's my code so far. If any one wouldn't mind helping me that be great. Like I said I'm new.

Share this post


Link to post
Share on other sites
Advertisement
I don't know anything about blitz, but it's going to be very labour intensive making a text adventure like that. What you want is a more structured approach to storing your world. Something like a tree structure to represent the room connectivity. I'm really a C++ programmer, and I would probably make several object types for things you can interact with in various ways... ie collectables, things you can talk with, things that can be used with. I'd have rooms which are a list of (pointers to) objects and pointers to other rooms associated with exit points. Objects and rooms could also have a description and other associated features. In this way, you can make a generic treatment of a room, object or character which is consistent throughout the game. You could even have characters move around the level along your "level graph." I think it's games of this sort that rogue, and later (the great) nethack. I haven't read your code properly... but I expect you have some logic mistakes in it. Without seperating your game logic from your level/room structure, you have to repeat code all the time and end up with tricky structures (especially working with gotos like that). I guess blitz must support functions so even if you can't use an OOP approach (which it may or may not support) like I'd use in C++... you can definitely come up with some more structured and consistent approach to describing rooms, objects, people and their spatial relationships. Once you have a generic treatment of rooms that form the level, you can easily form a game... as it is, you are freestyling the game logic along with the game. This is doable with a *very* small level like you are using, but once it gets a little large... you'll find it almost impossible to manage. In short, your watchwords should be structured and generic (with respect to your treatment of the room, object, characters etc). This means you'll be able to build it into a non trivial game.
Hope this helps,

Dan

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!