Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need a lot of help making a game!
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gnauhZ




PostPosted: Mon May 16, 2011 3:27 pm   Post subject: Need a lot of help making a game!

I'm in grade 10 and just recently started learning Turing language. For my class, my group was given a project to make a game. My group members have decided to make a simplified strategy game involving choice. Basically the story behind my game is that you are a robber who is trying to rob a bank. The user will be able to choose 4 from a set of tools in the beginning. As well as 4 slots to hold items you pick up throughout the adventure. The game is different based on which tools you choose. The gameplay is that the player is given a description of the room or area of the bank he is in. (we might use put in an image if we have enough time) The user will be given a list of commands and he or she will enter the number assigned to each command. For example:

1.Take (take an item from the area)
2.Use (use an item)
3.Move (from a location to another)
4.Action(Can only be used at special times, interact)
(Type a number from 1-4 to choose)
Choice : 2 (I want to use something)

1.Tool (One of the four tools i chose)
2.Inventory(items I have picked up before)
Choice : 1

1.Crowbar
2.Hairpin
3.Gun
4.Rope
Choice : 2

1. On door lock
2. On guard
3. On Dumpster crate
4. On Window
Choice : 1

"You pick the lock with the door and it opens"

This would be the main gameplay.

So basically I want help on how to code the game. Things like how the program remembers the tools you chose in the beginning and ignores the ones that you don't and also for items that you pick up during the game (wear spare uniform you find). I also want to know how to code rooms in the building and also a simple minimap that shows the rooms and where the robber is in. I want the robber to be restricted from entering certain rooms untill a certain task has been done. I want the program to remember what the user had done in that room. I want the robber to be able to interact with items in the room. I want there to be a timer in the game so the user can be scored on how fast they finished the game and how little mistakes were made and how many people were killed.

I could make this game simple but I want to avoid using millions of if statements. I am a beginner to turing and I can code simple tasks like functions procedures, arrays.

Can any of you please maybe give me simple instructions on how to approach and make the game. Can you also post a program for some of the details that I mentioned above? I would really appreciate because I am lost on how to start the game.
If anybody has a game made on turing that is similar to this I would be happy to use it as reference.
I don't know if this is too much to ask or too much for me to handle but I would really appreciate some help. :/


I am also new to this site too so bear with me...
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Mon May 16, 2011 3:33 pm   Post subject: RE:Need a lot of help making a game!

So have you started anything at all, or do you need to know where to begin?
Zren




PostPosted: Mon May 16, 2011 4:23 pm   Post subject: RE:Need a lot of help making a game!

Well considering the "menu" is the most common and used aspect of your game, simplifying that into a sub program (procedure/function) is the obvious first steps.

Goal 1: Write a procedure to print the contents of an array (of strings).
Goal 2: Write a function to get an integer within a range.

Use the two sub programs you made to make a third for use for a menu.
gnauhZ




PostPosted: Mon May 16, 2011 4:49 pm   Post subject: Re: Need a lot of help making a game!

well I have planned out everything that's going to be in the game but I have not started to write the program. I just need help on where to start and what you would do for each part. Also can you give me an example Zren?
Zren




PostPosted: Mon May 16, 2011 5:12 pm   Post subject: RE:Need a lot of help making a game!

Try and take a shot at it first. I gave you some specific keywords you could look up in Turing's help (documentation) (F9). There's some examples of a procedure in there. You can learn about them and more in the Turing Walkthrough.

Combining the logic/mechanics together is your task however.
gnauhZ




PostPosted: Mon May 16, 2011 5:43 pm   Post subject: Re: Need a lot of help making a game!

Zren wrote:

Try and take a shot at it first. I gave you some specific keywords you could look up in Turing's help (documentation) (F9). There's some examples of a procedure in there. You can learn about them and more in the Turing Walkthrough.

Combining the logic/mechanics together is your task however.

will the function be inside the procedure?
Is the array important? Do i need to use it for the different choices or can I just type the choices in the procedure as a put statement?
Also for "put function ()" what is suppose to be in the brackets?
Is it supposed to be a variable which represents the number user enters for his choice?
Do I put if statements as the result of the function?
For example:
if answer = 1 then
put "You pick the lock with the hairpin"
put"The door opens!"
end if
Sorry if I'm asking a lot of questions.
tyuo9980




PostPosted: Mon May 16, 2011 5:56 pm   Post subject: Re: Need a lot of help making a game!

well... its not really much math involved, but conditionals and boolean operators.

start from the simple input procedures and build your project up from there.

personally, i would not like to make a game like this. its just a lot of work to make the scenery, gfx, click/input points. basically its just one task repeated over and over again.

here are some tips if u want to make a gfx based game:
- be sure to use cls and double buffer.
- use input.keydown for continuous movement
- use hasch & getch for single keypress
- put everything into a procedure. this makes everything neat and tidy, more efficient, and easier for your teacher to read.
- for debugging, make a log file or onscreen display to track what's wrong
Raknarg




PostPosted: Mon May 16, 2011 5:59 pm   Post subject: RE:Need a lot of help making a game!

Don't be sorry, learning is part of the process of getting better.

The brackets beside the function are suppposed to be filled with parameters. This will make more sense in the tutorial. Basically, the function does things with the parameters it gives and ouputs a result. For instance:
Turing:

function square (x : int) : int
     result x * x
end square

put square (6)

That would take in a six, then ouput a 36. Understand?
And yes, I'm assuming that the function should be within an if statement; I'm pretty sure it's supposed to change the outcome depending on what the user picked.
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Mon May 16, 2011 6:13 pm   Post subject: RE:Need a lot of help making a game!

will the function be inside the procedure?
You will have 3 or more subprograms (in the way I'm mentioning), most being called within another (the menu sub program).

code:

menu
    showOptions
    slection = getSelection


menu(options : array)
    printArray(options)
    selection = getIntegerInRange(range)


Range would be the size of the array.

Is the array important? Do i need to use it for the different choices or can I just type the choices in the procedure as a put statement?
Yes. Hard coding in put statements into the procedure removes all options of reusablilty. You'd end up having to write a procedure for each menu you have (which isn't the point). The point of sub programs is to find out what's the same, and what's the difference. Take the following:
Turing:

fcn sayHello (target : string) : string
    result "Hello ", target, "!"
end sayHello

put sayHello ("world")
put sayHello ("fred")
put sayHello ("james")

I realized that I was saying Hello every time, but the difference was who I was targeting the hello to. So I used it as a parameter. In this instance, it might seem more work than typing out the put statements individually, however when you're needing to copy+paste 25+ lines of code for every single menu... A good rule to live by is to eliminate the need to copy paste. If you need to do that, then it's probable that you're better off writing a sub program.

Is it supposed to be a variable which represents the number user enters for his choice?
If it was a constant, than he'd be selecting 2 every single time.

Do I put if statements as the result of the function?
Print out "You chose [choice]." for now. We only want to focus on this sub program right now, and that's digging into the area of calling itself (the reaction of one option from the menu bringing up another menu) (or changing a variable like what's in your inventory).
gnauhZ




PostPosted: Mon May 16, 2011 6:15 pm   Post subject: Re: Need a lot of help making a game!

Oh I already know how to write functions. I'm just confused how the result of the function will be. If the right choice opens the door, then how do I continues from there? won't there be many functions and procedures within other functions and procedures. Can you ext the procedure but somehow make the program remember that the door was recently opened and allow the user to advance through?
Raknarg




PostPosted: Mon May 16, 2011 6:17 pm   Post subject: RE:Need a lot of help making a game!

Well, there's probably much better ways to do this, but I would have to say have a variable for all your different possibilities, like have a boolean for whether or not the door was opened.
Maybe you should explain your idea better, Zren?
gnauhZ




PostPosted: Mon May 16, 2011 6:28 pm   Post subject: Re: Need a lot of help making a game!

I don't understand the subprogram that you posted because I have not learned what that is. I might look it up.
For the function. You want the function to tell the user what choice that he or she put. So like:

function choice (answer : int) : string
result put "you have chose number", answer
end choice
put choice (number)
%where number is the user input

so then what comes after
also how do you post turing code without having to type it?

newbie question: what's boolean? I've only heard of it for when you use = or := or something
Raknarg




PostPosted: Mon May 16, 2011 6:37 pm   Post subject: Re: Need a lot of help making a game!

A boolean is a variable type. It only has two values: true or false. I've heard of noobs (me included) using an integer with 1 or 0 to accomplish the same thing, but there's an actual type just for it.

Also, don't use put statements within a function. It's only meant to return a value. But anyways, I don't think that's what Zren meant when me mentioned functions.

For turing code, use syntax="turing" in square brackets for the beginning and /syntax at the end.
gnauhZ




PostPosted: Mon May 16, 2011 7:26 pm   Post subject: Re: Need a lot of help making a game!

For turing code, use syntax="turing" in square brackets for the beginning and /syntax at the end.
What does that mean?

Anyways I did learn a bit about how to start my program. Based on what Zren said, can anyone post an example of the procedure function thing he said. I understand what he told me but I don't know how to put that in code
Zren




PostPosted: Mon May 16, 2011 8:01 pm   Post subject: RE:Need a lot of help making a game!

code:
[syntax="turing"]
put "Nargles"
[/syntax]



1 .. * means that the parameter accepts any size of array. A useful function to find the size of an unknown array size is with upper(arr).
Turing:

proc printArray (arr : array 1 .. * of string)

end printArray

fcn getInteger() : int

end getInteger


The other function requires you to actually get feedback from the user (keyboard input). There's most definitely a tutorial somewhere on that.

As for how to judge the result of the option and reacting. I've brooded over it for the last while and come to a conclusion that anything complex is extreme overkill, and you're probably better off with a procedure per menu. It goes against my better judgement (the reasons I pointed out earlier are the same) it's just that within Turing, in order to make it have enough flexibility to assign certain code to an option, you'd have to have way more than a beginner's know how. Not to mention you'd most likely end up having to type up more in the end.

The functions I pointed out are useful however.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 27 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: