Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Let us guide good ol' Dary  (Read 1871 times)

0 Members and 1 Guest are viewing this topic.
Let us guide good ol' Dary
« on: July 11, 2009, 12:32:10 am »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Ok, I decided to be a bit more open-minded and check out other programming languages outside GML and html. I spent some time reading through the tutorials in www.learncpp.com and, tight butthole, I haven't got very far yet. This is what I've managed to do in one day :P:
Code: [Select]
// messround.cpp : main project file.

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
cout << "Hello!\nDo you want to play with me?\n\n     Press letter <Y> for Yes, <N> for No. ";
char chAnswer;
cin >> chAnswer;

switch (chAnswer)
{
case('y'):
cout << "\n\nGood! Let's begin.\nIf at any time during the game you wish to quit," <<
"\njust press the <ESC> key, okay? Good." << endl;
break;
case('n'):
cout << "\n\nAw, are you sure?\n\n     Press letter <Y> for Yes, <N> for No. ";
cin >> chAnswer;
switch (chAnswer)
{
case('y'):
cout << "\n\nOkay, see you next time!\n\n     Press the <ESC> key to quit the game.\n\n..." <<
"\n\nChanged your mind? Wanna play now?\n\n     Press letter <Y> for Yes, <N> for No. ";
cin >> chAnswer;
switch (chAnswer)
{
case('y'):
cout << "\n\nThanks for changing your mind!\nI feel really lonely these days, you know.\n " << endl;
break;
case('n'):
cout << "\n\nOkay, I'm not gonna keep making you lose time in that case." <<
"\n\n     Press the <ESC> key to quit the game.\n" << endl;
break;
}
break;
case('n'):
cout << "\n\nOkay, cool! Let's begin.\n\nIf at any time during the game you wish to quit," <<
"\njust press the <ESC> key, okay? Good.\n" << endl;
break;
}
break;
}
system("pause");
}

I'm using Microsoft Visual Basic Express 2008 as my IDE.
I tried installing the Allegro library into it but I'm having lots of trouble...


Anyways, I also plan to check out other languages. I downloaded BlitzMax Demo to check it out tomorrow when I have some time.

Also, I'd like to note that the only programming experience I have is some GML and very little html. I don't know if it's a good idea to move to more serious programming, maybe I should stay with GameMaker for now. I don't know. What are your thoughts?

I find C++ very different than GML. You have to tell the computer exactly what you want it to do, but with GML, it's easier to tell the computer what you want to do. To me, GML is like a 'smart' language, and C++ is more 'raw'.


So, my question is, what would YOU guys suggest? What language should I check out next? What are your preferences?

Thanks :)
« Last Edit: July 11, 2009, 12:33:56 am by Darunia »
Logged

Currently Listening to: Mos Def - Summertime
Re: Let us guide good ol' Dary
« Reply #1 on: July 11, 2009, 12:58:22 am »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
I say you should move up from GML to C++. It's quite more efficient, a little tougher, but probably the closest you'll get to an actual programming language that's similar to GML.  But don't fell afraid to use Game Maker anymore, try starting in GML then convert it to C++.

On another note: I recommend using "return 0;" at the end of the main function instead of "system ("pause");"  so "Press any key to continue..." doesn't come up twice. And it's actually what you're SUPPOSED to do I believe.
Logged
  • https://colbydude.com
Re: Let us guide good ol' Dary
« Reply #2 on: July 11, 2009, 07:16:36 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Well, I would definitely recommend that you start learning other languages. But if you think the step from GML to C++ is to big, I would recommend you take an intermediate step with Java or C#. With C# you can use the XNA libraries as well.

Tutorials on XNA: http://creators.xna.com/en-US/education/gettingstarted

Some pointers for Java: http://www.javagaming.org/

I'm not saying you should be afraid of the challenge C++ might give you.
Logged
Re: Let us guide good ol' Dary
« Reply #3 on: July 11, 2009, 10:30:08 am »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Thanks guys.

Quote
It's quite more efficient, a little tougher, but probably the closest you'll get to an actual programming language that's similar to GML.
But what exactly is more efficient?

I tried a game example in Java earlier and when I tried to move my spaceship around it seems like it took a little while before it actually realised I had pressed a key and started moving.

Colby, if I don't include the system("pause") it just closes the window without waiting. :S The whole reason I put it in is so I have the time to see if my code worked exactly like I wanted it to. Edit: Oopsie, I usually include both pause and return. Must have slipped. :P Thanks


Could anyone please tell me the advantages / disadvantages of each of these languages? I want to know why exactly I should be using this language and not that one.
« Last Edit: July 11, 2009, 10:32:44 am by Darunia »
Logged

Currently Listening to: Mos Def - Summertime
Re: Let us guide good ol' Dary
« Reply #4 on: July 11, 2009, 11:19:42 am »
  • (y)(;>.<;)(y)
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3293
it's called int main() because you have to return an integer value, otherwise 'junk' data gets returned. If you use a command window to run the compiled executable you should get a message like "program returned with value x", where x is what int main() returns, in this case it'd be junk data so it'd be something like "program returned with value 92438".

The standard is that if you return 0, the program ran and finished without complaint, and all higher or lower numbers are 'errors', so if you return 1 it means something went wrong. This is very useful for simple debugging and testing of code, and it's just good practice.

I'm surprised you didn't get a warning when you compiled that said something like "no value returned in function expecting int". Personally I always turn compilers up to maximum security so that they throw warnings whenever I do anything slightly suspect.

More advice:
Personally I suggest not including "using namespace std;" and instead in front of cout, cin etc. putting "std::". For small code like this it's not a problem but for big projects which can have loads of namespaces from various libraries not using "using namespace" is just a good habit to get into in my opinion.
« Last Edit: July 11, 2009, 11:27:12 am by TheDarkJay »
Logged
Re: Let us guide good ol' Dary
« Reply #5 on: July 11, 2009, 11:27:19 am »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Hmmm, that got me thinking. Is it possible to make main void? :P
Logged

Currently Listening to: Mos Def - Summertime
Re: Let us guide good ol' Dary
« Reply #6 on: July 11, 2009, 11:30:05 am »
  • (y)(;>.<;)(y)
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3293
not in C++ standard. MSVC may allow it depending on the settings, but it's not recommended to use ;P
Logged

Starforsaken101

Wake the Beast
Re: Let us guide good ol' Dary
« Reply #7 on: July 11, 2009, 01:05:28 pm »
  • www.mouffers.com
  • *
  • Reputation: +69/-0
  • Offline Offline
  • Gender: Female
  • Posts: 2577
Yeah, C++ is slightly more complicated than other languages out there. I would maybe start learning Java first. It's quite easy to understand and you can learn the basics of object-oriented programming with it pretty much right away. I mean, you could go ahead and continue C++, but I find Java a nicer way of getting into it. It helps you understand class and object structure.
Logged
  • Starforsaken101's DeviantART
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.084 seconds with 53 queries.