Took me five years to figure this out

Posted by Astryl on April 17, 2012, 9:15 a.m.

Apologies

My last blog was too short an irrelevant to anything. This ought to make up for it.

Something for C++ programmers

I've now spent time with both C# and Java, and no longer have too many complaints about them; in fact, I'm using C# for one of my games, and Java for some minor tools, so I must be liking them.

But here's something that bothered me about both languages:

// Java
public MyObject()
{
   super(9001);
}

// C#
public MyObject()
{
   base(9002);
}

Base/Parent constructors.

Don't get me wrong, I love them; what bothers me is… C++ doesn't have them.

Or so I thought. But after wading through many an obscure book and falling into a dark pit on some ancient-and-still-functioning BBS (Yeah, there are still functioning BBS servers), I finally found the knowledge I was seeking (And no thanks to those obscure books/weird message boards).

Completely by accident. You see, I was creating a constructor:

MSprite(int& ic):ID(ic) // This was the intended behavior
{
}

Of course, being Mega as I am and typing away at who-knows-how-many statements per minute, I typed this in and didn't notice the typo until I tried to compile:

MSprite(int& ic):(ic)
{
}

Of course, you'd be expecting a syntax error, but instead I got the "No matching call for Object(int&). Candidates are Object()…" message.

MSprite is inherited from Object, which meant only one thing… I had discovered the way to call a base-class constructor.

I can't believe that in the five years I've been programming in C++, I couldn't find that out, or do it before now. ;_;

Anyway, this is all a part of that game I mentioned I was going to make yesterday.

The little game I started yesterday

Here have another

Made in C++. :D

Also, yay another space shmup that I probably won't get anywhere near to a state of completion, but is great practice.

*Aims the Mega Rifle at Lunacy Star* <- Playful trolling, new members.

Sorry Taizen >:3

I started the actual code yesterday, and in 6 hours I was done with a framework that gives me all the functionality that Hydra had, but works better (Because I now know how to handle my pointers correctly, and make use of Early-Out algorithms for drawing).

It uses SFML, as usual, but was made from scratch. :3

Ludum Dare should be a piece of cake (6 hours working on the 'engine' will leave me with about 42 hours for the rest of the things I need to do).

My last blog was *that* close to being a "I'm feeling depressed" blog. Whay was I feeling depressed? I don't have a clue.

I'm feeling great now though.

My LD plan

Very simple. MAKE GAEM AND WIN!

Or, in simpler terms [/irony]:

> Create a stable and easy to extend OOP framework in the first 6-8 hours of the comp. [Proven that I can]

> Work on design and art assets in the next ?? hours. [Done it before]

> Cobble the final game together. [Done this before as well]

I already have plans for any level-creation I need to do; I'll use a layered map from TileStudio; I just have to write an importer; fortunately I find all binary IO pathetically simple to pull off in a short amount of time. :P

For music, I'm probably going to use GMGME, with standard SFML music objects as a fallback.

In addition to this, I'm going to create an Asset manager (You have no idea how much this speeds up the development process), an Instance manager and who-knows-what-else.

The Instance manager is just a simple system built into my base Game Object's that assigns a unique ID to each instance of the class (Using a global counter), and essentially allows me to remove objects by instance instead of by class.

Well, back to my papered desk (I've got a 'scratchpad' for the RPG design, and another one ready for LD on the weekend).

I've got a checklist for both LD and RPG4D, blank paper stuck on the walls, pencils everywhere, and a blank/cleaned desktop. I think.. Wait, what?!… I'm getting organized?!?! The world is going to end!

*Runs away and spreads the word with bouts of lunatic yelling*

Comments

Rob 12 years, 7 months ago

class Maid : public RapableEntity
{
public:
         inline Maid(int x, int y) : RapableEntity(x, y)
         {
                  resistance = rand() % 7;
                  meidoDress = new Dress(rand() % 4);
                  radius = 8;
         }
         inline virtual ~Maid()
         {
                  delete meidoDress;
         }
private:
         Dress *meidoDress;
};

class RapableEntity
{
public:
         inline RapableEntity(int x, int y)
         {
                  this->x = x;
                  this->y = y;
                  semenContained = 0;
                  radius = 0;
         }
         inline virtual ~RapableEntity()
         {
         }
         inline CumInside(int gallonsOfSemen)
         {
                  semenContained += gallonsOfSemen;
         }
protected:
         int x, y, semenContained, radius;
};

class Dress
{
public:
         inline Dress(int style)
         {
                  this->style = style;
         }
         inline virtual ~Dress()
         {
         }
         inline int GetStyle()
         {
                  return style;
         }
private:
         int style;
};

I decided that I might as well write the Maid class too :3

5:23AM…. I should probably sleep… or I could write a test chassis for my maid-rape classes…

Decisions…

firestormx 12 years, 7 months ago

I like your codes Rob.

colseed 12 years, 7 months ago

64d: always classy

Rob 12 years, 7 months ago

Quote: FSX
I like your codes Rob.

Thanks <3