Texted-Based Game (Turing) by Jack140
Author |
Message |
Jack140
|
Posted: Fri Nov 14, 2008 7:40 am Post subject: Texted-Based Game (Turing) by Jack140 |
|
|
Hey Everyone!
]I'd like to quickly introduce myself, My name or username is Jack140. I've been programming for nearly 3 months.
I've been using the turing software, and up to this point I've learned a lot . Now I will be posting my text based game.
Its actually fun and interesting (much like zork8-) . I hope everything goes well with my first new game... please leave
comments, suggestion and report any bugs. Don't be too harsh with me, remember I am a beginner. Also I am still currently working
on it, Since its not quite finished. By the way, I think this website is great! Keep it Up! .
Thanks,
Jack140
PS. I'm not sure of how to post it as an attachment yet, so I will just post it with the message.
code: |
% Author: Jack140
% Date: Monday, September 29, 2008
% Filename: Raybiss.t
% Description: RAYBISS - A game of strategy and adventure.
% You've the only survivor, who had survived from a horrible hurricane,
% you must find a way to be rescued. Remember even thou you are alone,
% there are full of surprise ahead to watch out for...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setscreen ("graphics")
setscreen ("graphics:1000,650")
% Declare Raybiss Variables
% Game Options Variables
var name : string
var age : real
var continue : string
var ready : string
var input : string
% Inventory Variables
var key: int:=0
var keyanswer:string
var radio: int :=0
var radioanswer : string
% Area Variables
var answer : string
var area : int
area := 0
%
% Introduction to Raybiss and Melanie and Ratings
put " RAYBISS "
put skip
color (2)
put "'Hello, My name Is Melanie, your guide to Raybiss.' "
put "'What is your name?' " ..
get name :*
put " "
put "'Before we start, I need to know your age?'" ..
get age
loop
if age <= 12.99 then
put "'Your too young to play,", name, " wait until your 13. "
put " This game may contain scences of violence viewer discretion is advised!'"
put "'Just kidding you can play, there are no graphical images in this game'"
put "'Here are the following rules:'"
end if
exit when age <= 12.99
if age >= 50 then
put "'Sorry, you are too old to play'... ('Just Kidding! ", name, "')"
put "'Here are the following rules:'"
end if
exit when age >= 50
if age >= 13 then
put "'You are allowed to play this game!'", name
put "'Here are the following rules:'"
end if
exit when age >= 13
end loop
put skip
color (3)
% Declare Rules of Game
put " How to play Raybiss Rules: "
put " "
put " 1. You must indicate the direction you are willing to travel "
put " (North, South, East or West) "
put " "
put " 2. You can pick up items and use them for your advantages "
put " "
put " 3. You must clearly use two words... a Verb and a Noun (Ex. use/pickup key), "
put " to activate the action, so that you are able to, "
put " use or pickup any objects, that you've found. "
put " "
put " 4. You must be rescued to be able to win the game "
put " "
loop
put " type 'continue', to proceed "
get input :*
exit when input = "continue"
end loop
put " "
% Explaining Situations
color (12)
put " 'Hi ", name ..
put " this is Melanie, your guide'"
put " "
put " 'Firstly, I will like to introduce you to my game called 'Raybiss' "
put " So...lets begin!, this is your situation..."
put " You are currently in need of help, "
put " meaning that you've just survived from a devastating hurricane. "
put " In fact you are the only survivor, nobody else had survived this deadly strike, "
put " Here are some objective you must accomplish...'"
put " "
loop
put " type 'continue', to proceed "
get input : *
exit when input = "continue"
end loop
put " "
% Explaining Objectives and Circumstances
color (9)
put " Objectives: "
put " 1. Find basic survival supplies (Food, Shelter,) "
put " 2. Find Telecommunication Equipment "
put " 3. Obviously, you must be rescued "
put " 4. Have Fun!!! "
put " "
put " 'Where are you?, you are in your basement. To the east, you see an exit, "
put " Which leads upstairs, I reccommend you go there, and get out of the flooded "
put " basement, but before I go, ", name ..
put ", "
put " I must warn you of the possible upcoming surprises, Good Luck' "
put " "
loop
put " type 'ready', to begin your game... "
get input : *
exit when input = "ready"
end loop
put skip
% Map of Basement
Text.Cls
drawbox (200,200,400,400,16)
drawline (225,275,275,225,red)
drawline (275,275,225,225,red)
put " Your are here (X)..."
put " The box is the staircase (east)"
delay(4000)
cls
color (4)
%//////////////////////Gaming Begins////////////////////////////%
proc basement
put "You are currently in the basement. Exit is to the east"
area := 1
end basement
proc room
put "You are in a room. Exits to the north, south and west"
area := 2
end room
proc kitchen
put "You are in the kitchen. Exits to north, west and south"
area := 3
end kitchen
proc livingroom
put "You are currently in your living room. Exit to the east "
if radio = 0 then
put "you see a radio"
put "It might be useful"
get radioanswer:*
if radioanswer = "get radio" or radioanswer = "grab radio" or radioanswer = "take radio" or radioanswer = "pickup radio" then
put "you've got the radio! Go to your backyard and test the radio out"
radio := 1
else
put "I don't know what that means. Try different words."
end if
end if
area := 4
end livingroom
proc frontdoor
put "You are at the front door, Apparently it has been damaged and blocked,"
put " Please find another exit. Exit is to the north (kitchen)"
area := 5
end frontdoor
proc backyard
put "You are in your backyard. Exits is to the east, west and south"
if radio = 1 then
put "Alright hopefully the radio will work out here"
get radioanswer :*
if radioanswer = "try radio" or radioanswer = "use radio" or radioanswer = "test radio" then
put "Sorry, your radio connection has failed and its been damaged from the flood"
end if
end if
area := 6
end backyard
proc shed
put "You are in the shed. Exit is to the east"
if key = 0 then
put "you see a key"
put "what do you want to do?"
get keyanswer:*
if keyanswer = "get key" or keyanswer = "grab key" or keyanswer = "pickup key" or keyanswer = "take key" then
put "you got the key!"
key:= 1
else
put "I don't know what that means."
end if
end if
area := 7
end shed
proc gate
put "You are at the gates. Exit is to the west unless you have a key"
put "You can then access to many more exits. "
if key = 1 then
put "Hey, it looks like your key might be able fit into the lock"
get keyanswer:*
if keyanswer="try key" or keyanswer = "use key" or keyanswer = "open lock with key" or keyanswer = "open with key" then
put "Your key has successfully unlocked the gate!. It releases a monster"
put " Game Over! You are instantly Dead! Haha"
put " Just kidding, My game isn't finished "
put " Congrats you've made it through section 1 of 4."
end if
end if
area := 8
end gate
%************************Temporary Text*************************%
put "Welcome to a text-based adventure game"
put "As you may have known, you are in your flooded basement "
basement
get answer:*
put "Your roof is collapsing, I suggest you quickly get out of your house... "
put "You may or may not search your house for supplies, the decisions are entirely up to you '", name, "'"
room
get answer
%///////////////Generating Input to Directions//////////////////%
loop
% Basement to Room, Room to Basement (Primary Path)
if area = 1 and (answer = "go east" or answer = "east" or answer = "e") then
room
elsif area = 2 and (answer = "go west" or answer = "west" or answer = "w") then
basement
% Room to Kitchen, Kitchen to Room (Secondary Path)
elsif area = 2 and (answer = "go south" or answer = "south" or answer = "s") then
kitchen
elsif area = 3 and (answer = "go north" or answer = "north" or answer = "n") then
room
% Room to Backyard, Backyard to Room (Primary Path)
elsif area = 6 and (answer = "go south" or answer = "south" or answer = "s") then
room
elsif area = 2 and (answer = "go north" or answer = "north" or answer = "n") then
backyard
% Kitchen to Front Door, Front Door to Kitchen (Secondary Path)
elsif area = 3 and (answer = "go south" or answer = "south" or answer = "s") then
frontdoor
elsif area = 5 and (answer = "go north" or answer = "north" or answer = "n") then
kitchen
% Kitchen to Living Room, Living Room to Kitchen (Secondary Path)
elsif area = 3 and (answer = "go west" or answer = "west" or answer = "w") then
livingroom
elsif area = 4 and (answer = "go east" or answer = "east" or answer = "e") then
kitchen
% Backyard to Shed, Shed to Backyard (Primary Path)
elsif area = 6 and (answer = "go west" or answer = "west" or answer = "w") then
shed
elsif area = 7 and (answer = "go east" or answer = "east" or answer = "e") then
backyard
% Backyard to Gate, Gate to Backyard (Primary Path)
elsif area = 6 and (answer = "go east" or answer = "east" or answer = "e") then
gate
elsif area = 8 and (answer = "go west" or answer = "west" or answer = "w") then
backyard
% If they do not type the required word, this will pop up %
put "I don't Know the word...'", answer, "' "
put "Please type a different word(s) "
end if
put " "
get answer :*
end loop
|
Mod Edit: Code tags! |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Jack140
|
Posted: Fri Nov 14, 2008 7:47 am Post subject: RE:Texted-Based Game (Turing) by Jack140 |
|
|
If interested, I will be posting a tutorial, based on this game. |
|
|
|
|
![](images/spacer.gif) |
metachief
![](http://compsci.ca/v3/uploads/user_avatars/59969875948ed1e6be9fb0.jpg)
|
Posted: Fri Nov 14, 2008 4:36 pm Post subject: RE:Texted-Based Game (Turing) by Jack140 |
|
|
... how much time do you have on your hands! I bet this took like a week to make! And it is all if statements. There is other type of code to do this thing. You should check out how to use cases. Nice job, but don't waste your time on things like this, not saying that it's bad... |
|
|
|
|
![](images/spacer.gif) |
Jack140
|
Posted: Fri Nov 14, 2008 4:54 pm Post subject: Re: Texted-Based Game (Turing) by Jack140 |
|
|
lol, I actually have a lot of time on my hands.
I shall study "cases"... you know what? I actually never heard of that...
I think it reduces lines of code or something along those lines... I think thats what it is...
anyway,
Thanks metachief! |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Sat Nov 15, 2008 4:58 pm Post subject: RE:Texted-Based Game (Turing) by Jack140 |
|
|
It is pretty good.
These types of games are great for testing what you know, but then we move on. check out the turing tutorial to get started on some new ideas, coding practices, and even graphic programming.
I don't know why, but reading through everything you wrote in your first post I kept thinking - "Finally, someone who uses proper English!". Lol |
|
|
|
|
![](images/spacer.gif) |
Jack140
|
Posted: Sat Nov 15, 2008 5:34 pm Post subject: Re: RE:Texted-Based Game (Turing) by Jack140 |
|
|
lol SNIPERDUDE!!!
I don't normally speak "slang" or whatever you call it in todays era, I just write out the full actual words... (Thats why I have a long program lol)
Yes, I am new to turing (its been 3 months), and I am glad you and other people liked it (which means that, so far I have a good understanding and my knowledge is developing and soon I will master the basics)...
Currently, I am working on a more complexed game. (Pacman! )
I can't wait to post it...
Thanks,
Jack140
SNIPERDUDE @ Sat Nov 15, 2008 4:58 pm wrote: It is pretty good.
These types of games are great for testing what you know, but then we move on. check out the turing tutorial to get started on some new ideas, coding practices, and even graphic programming.
I don't know why, but reading through everything you wrote in your first post I kept thinking - "Finally, someone who uses proper English!". Lol |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sat Nov 15, 2008 7:04 pm Post subject: Re: Texted-Based Game (Turing) by Jack140 |
|
|
guh, PacMan. It is definitely possible, but it is very complicated, especially if you want to include things like pathfinding AI and the cool little things that were in the original game (speedy, confused ghost, etc.) |
|
|
|
|
![](images/spacer.gif) |
Jack140
|
Posted: Sat Nov 15, 2008 7:42 pm Post subject: Re: Texted-Based Game (Turing) by Jack140 |
|
|
So far I'm doing pretty good... I have the fundamentals down. (8 point movement, graphics, image, collision detection and other stuff)
I just have to know how to create pacman's and ghost's velocity constant so that when I press the right arrow key for example, it will continue on in that direction. Unless otherwise, I press the up, down or left arrow key. (I will most likely find the answer to this question, because this site has a lot of tutorials about that)
My goal for this is to make my Pacman run smoothly, and obviously get something out of it.
It will take me a long time to do this but hey its worth the experience. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Sun Nov 16, 2008 7:16 pm Post subject: RE:Texted-Based Game (Turing) by Jack140 |
|
|
Awesome, it's good to see your effort is really helping you in your knowledge. For the velocity constant just store what was pressed in a variable (so the moving procedure would use this variable to determine where to move). Pretty simple. |
|
|
|
|
![](images/spacer.gif) |
syntax_error
![](http://compsci.ca/v3/uploads/user_avatars/196798963948cf16794b6e5.jpg)
|
Posted: Sun Nov 16, 2008 11:42 pm Post subject: Re: RE:Texted-Based Game (Turing) by Jack140 |
|
|
metachief @ Fri Nov 14, 2008 4:36 pm wrote: ... how much time do you have on your hands! I bet this took like a week to make! And it is all if statements. There is other type of code to do this thing. You should check out how to use cases. Nice job, but don't waste your time on things like this, not saying that it's bad...
why would he use case?
If and case are exactly the same thing. You can to case to if, but not always if to case; I never have meet a single point in my programming life, where I needed to use case over if. |
|
|
|
|
![](images/spacer.gif) |
delparnel
![](http://compsci.ca/v3/uploads/user_avatars/980326151490c8c77b2278.jpg)
|
Posted: Mon Nov 17, 2008 12:03 am Post subject: Re: RE:Texted-Based Game (Turing) by Jack140 |
|
|
syntax_error @ Sun Nov 16, 2008 11:42 pm wrote: metachief @ Fri Nov 14, 2008 4:36 pm wrote: ... how much time do you have on your hands! I bet this took like a week to make! And it is all if statements. There is other type of code to do this thing. You should check out how to use cases. Nice job, but don't waste your time on things like this, not saying that it's bad...
why would he use case?
If and case are exactly the same thing. You can to case to if, but not always if to case; I never have meet a single point in my programming life, where I needed to use case over if.
I find Case/Switch statements (In general, not necessarily in Turing) useful when you're dealing with a range of integer options. It cleans things up a lot, and makes them more readable. It's not necessarily more efficient in any way. |
|
|
|
|
![](images/spacer.gif) |
|
|