Making A Console Based GameThis is a featured page

This tutorial shows how to make a console based game.

I won't walk through the entire process, but rather just show the basics so that the reader can create their own.

Create a new console application and add the following code within the module1 class, outside of the main sub:

dim randomnumber as new random()
dim playerwin as boolean
dim generatednumber as integer
dim playerwinchance as integer
dim playerlosechance as integer


And then add the following code to the main sub:

playerlosechange = 10
playerwinchance = 1
rnd(generatednumber = randomnumber.next(playerlosechance, playerwinchance))
if generatednumber => 5 then playerwin = true
if generatednumber =< 4 then playerwin = false

console.write("Enter Y or N for Yes or No to answer the questions")
console.writeline()
console.write("You are walking along a dark path, when suddenly two demons appear, will you fight?")
console.writline()
If console.readkey.key = consolekey.Y then
if playerwin = true then
console.writeline()
console.write("You fight the evil creatures, and eventually you defeat them both")
console.writeline()
else
console.writeline()
console.write("You try to fight the beasts away, but the are too strong and you fall, beaten")
console.writeline()



As you can see, this is a very simple console game, but if you added to it, and perhaps added a way of increasing the players chance of winning as they made it further into the game, it could be quite entertaining.


Mrgameruler
Mrgameruler
Latest page update: made by Mrgameruler , May 5 2008, 4:53 PM EDT (about this update About This Update Mrgameruler Edited by Mrgameruler

2 words added
2 words deleted

view changes

- complete history)
Keyword tags: console game vb
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)