Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 20 Apr 2010
Offline Last Active Today, 08:02 AM

#5205278 why C++?

Posted by LennyLen on 19 January 2015 - 07:22 AM

what is C++ i see it on many places but nower to be found what it is.


I hope this doesn't come across too harsh, but if you want to be a programmer, then you need to get a LOT better at researching information.  It's an extremely important skill for a programmer, and most of the information you will need to find on an everyday basis will be more difficult to locate than the answer to your question here.

#5203655 how make games in c++

Posted by LennyLen on 12 January 2015 - 07:04 AM

I also suggest you read this.

#5198316 C++ Number guessing

Posted by LennyLen on 15 December 2014 - 08:18 AM

What do you suggest to use to replace system("cls")?


There is no universal way of doing this.   There's no way of guaranteeing that stdout is even going to the screen, so clearing the output when it could be going to a printer or a file makes little sense.  For a simple number guessing game, I'd just leave the console as it is and not worry about clearing it. There are libraries such as ncurses/pdcurses that are designed to allow console output, but I haven't used either one for a long time so I have no idea how portable they are these days.

#5198307 C++ Number guessing

Posted by LennyLen on 15 December 2014 - 07:36 AM

That's definitely better.  Now try doing it without using any global variables at all.


Also, be aware that using system("cls"); is not portable.  It will work on DOS/Windows, but is unlikely to work on any other operating system.

#5198093 C++ Number guessing

Posted by LennyLen on 14 December 2014 - 03:41 AM

Use the prefix std:: to indicate the namespace.
std::cin, std::cout and std::endl, instead of cin, cout and endl.


In addition to this, if there is a particular function/variable from within a namespace that you use a lot you can also do this:

#include <stdio>

int main() {
   using std::cout;
   using std::endl;
   cout << "Hello World!" << endl;

   return 0;

#5195454 accuracy bars - quick question

Posted by LennyLen on 30 November 2014 - 02:24 AM

However, I can foresee a few issues with this in terms of player skill progression, possibly slowing things down, balancing problems, maximum reaction speed....etc etc. Obviously, I don't know how impactful (or not) this might be, so was hunting for some discussions that might have already been had online.


To me a dungeon crawler is more of a tactical game than an action game, and it's one of the reasons I play them (along with other types of strategy/tactical games).  If I was playing such a game and I discovered it had skill testing mechanisms, I would just stop playing immediately.  This is because I have terrible reaction times and timing, and am extremely uncoordinated.  I do not get better with practice and only get frustrated when games require me to do certain things at certain times.

#5195090 Health bar graphics instead of text

Posted by LennyLen on 27 November 2014 - 08:12 PM

You're going to have to be alot more specific if you want somebody to show you in code, since we don know what graphics library or language you are using.


The simplest way is to first draw a background rectangle of a certain width (we'll call the width w).  Then on top of that you can draw another rectangle in a different colour.  The width of this rectangle will be w * total_life / current_life.

#5194315 My Pokemon Game

Posted by LennyLen on 23 November 2014 - 02:42 PM

I hope you realize that despite the fact that you state on your site that the Pokemon IP belongs to Nintendo, and that you also say you don't intend to infringe on it, you still are infringing on it, and they will very likely get your site taken down if it ever gets big enough to get their intention.


Save yourself the hassle and come up with your own idea instead of taking someone else's.

#5193976 Proper C++ header file?

Posted by LennyLen on 21 November 2014 - 09:19 AM

Okay.. that means following standards their teachers set them. What I'm writing is an application of good programming standards, not commonly followed standards. I certainly wouldn't recommend everyone go around throwing macros in everything just because a student comes in here with their teacher having asked for some giant macro horror page for their next assignment.

Just to clarify, I wasn't refering to the arbitrary stylistic standards that some institutions expects students to adhere to, but actual official standards (ie ISO).



I certainly appreciate the point you're trying to make, but I'm also trying to make one that we shouldn't just go "Okay, everyone do it the old fashioned way."


What I'm hoping people will be able to take away from this, is that there are two ways this can be done - one which should always be good enough and which most compilers will support, and one which is the official sanctioned method which is universally supported (at least by standards compliant compilers).  Which should be used is up to the individuals needs.

#5193961 Proper C++ header file?

Posted by LennyLen on 21 November 2014 - 07:45 AM

Frankly I don't see a reason not to use it unless someone specifically asks you not to, like at a job or something. Wasted opportunity to give more information to the preprocessor.


The reason I brought it up was because we're in the "For Beginners" section, where we try to be as exact and correct as possible.  There are also a lot of students reading this section, and students are often instructed to follow standards.  For them, using non-standard pragmas could cost marks.

#5193886 Proper C++ header file?

Posted by LennyLen on 20 November 2014 - 05:44 PM

I would also suggest to replace







#pragma once


it's simpler and you don't need the #endif at the end smile.png


The only problem with it is that it is not part of the C/C++ standard, so while it is supported by major compilers, it can't be guaranteed to always work.

#5191071 Game development by a beginner

Posted by LennyLen on 04 November 2014 - 03:47 AM

You need to know basic Object Oriented Programming principles and no you don't need to be old. 


This is completely false.  While OOP can be used quite effectively for game programming, it is definitely NOT a requirement.

#5181539 newbie in game development

Posted by LennyLen on 19 September 2014 - 08:08 AM

Downvoting somebody for simply asking a question is not a good move.  Especially when it's there first post here.  Yes, it does get frustrating seeing the same questions asked over and over, but that's no reason to make somebody feel like they've done something wrong just for asking a question (that is why this forum is here after all) .


Of course, if they keep asking the same question, that's a different matter, but such was not the case here.

#5179649 Did I begin learning late?

Posted by LennyLen on 11 September 2014 - 12:38 PM

Or, people could be down-voting just because they can. It happens quite often on the internet, especially on youtube.


In this case, I don't think so.  I looked through the history of the person that did the down-voting, and there is no past pattern of this behaviour, which you would expect from a serial down-voter.

#5179568 Did I begin learning late?

Posted by LennyLen on 11 September 2014 - 06:57 AM

why down votes ?!


I can't answer for the person who did it, but my guess would be because you started repeating yourself without saying anything new.