C++ question
Hey guys I followed your advice and I am a little confused by the swap function.What does it do?Moreover I have been adviced to start with a text game how do we wrtie such a thing?
When you see a roller coaster, get on it,put your hands in the air,and ride it to the very end.Life doesn't remember you unless you kick,scream,and claw your way to the top.There is nothing in the world that is impossible.If you believe that you can do it, you will.
The swap() function swaps the values of two objects. It''s a templated function which takes 2 objects of the same type. You can use any type as long as that type is assignable. Are you having a specific problem with swap()?
No I thought it was just a function he named swap(in the book)DO you have any advice about the text game?
When you see a roller coaster, get on it,put your hands in the air,and ride it to the very end.Life doesn't remember you unless you kick,scream,and claw your way to the top.There is nothing in the world that is impossible.If you believe that you can do it, you will.
quote: Original post by Mage_gr
DO you have any advice about the text game?
If I did, I would have mentioned it! It''s a looong time since I programmed a text game. The best advice I can give is to play some existing text games and get a feel for them. You need to have an idea what you are setting out to do. If you are unsure about what you are trying to achieve, the code you write will reflect that, and your project will eventually grind to a halt.
You might also find it enlightening to learn about state machines - they are likely to be useful in such a game.
Thanks guys for the advice....what is a state machine?
When you see a roller coaster, get on it,put your hands in the air,and ride it to the very end.Life doesn't remember you unless you kick,scream,and claw your way to the top.There is nothing in the world that is impossible.If you believe that you can do it, you will.
These guys are being a bit obtuse aren''t they? Listen, one of the best ways to learn coding is to look at other peoples code. So I suggest you get on the net and search around and look at the source other people are putting up then start your own project.
As far as a text game do you mean an adventure or an rpg where the player walks around and does stuff like a MUD? Your going to need some kind of data structure (start with arrays) to hold 1. the room description 2. the possible exits for that room, 3. the rooms contents 4. the players inventory etc.... Then you can add stuff like NPCs (or mobiles in MUD speak) and fighting or whatever. Set you initial conditions then loop through accepting input from the player and updating her data etc... Super easy to do with console app.
Hope I helped a little bit.
As far as a text game do you mean an adventure or an rpg where the player walks around and does stuff like a MUD? Your going to need some kind of data structure (start with arrays) to hold 1. the room description 2. the possible exits for that room, 3. the rooms contents 4. the players inventory etc.... Then you can add stuff like NPCs (or mobiles in MUD speak) and fighting or whatever. Set you initial conditions then loop through accepting input from the player and updating her data etc... Super easy to do with console app.
Hope I helped a little bit.
I think the best way to learn is through your own experience, guided by a few choice books.
Judging by the number of posts on the NeHe forum that all revolve around the poster not knowing what the API he/she calls actually does, learning by example perhaps isn''t the best way to go.
Copy and paste is all too easy.
- Pete
Judging by the number of posts on the NeHe forum that all revolve around the poster not knowing what the API he/she calls actually does, learning by example perhaps isn''t the best way to go.
Copy and paste is all too easy.
- Pete
quote: Original post by nonnus29
These guys are being a bit obtuse aren''t they?
No, they''re being concise.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement