Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » My New Game!

This thread is locked; no one can reply to it. rss feed Print
My New Game!
agonvs
Member #15,917
March 2015

Hi all,

Here's my first finished game (well, as finished as it's likely to get. We'll see, I will most likely move on from here). It's called ArkaNerd after the famous arcade game Arkanoid. You will need a joystick or joypad with a digital D-pad in order to play this (I've decided not to support analog sticks at this time in favor of the digital pad's ease of use). The game is over if you lose 3 balls or break all 60 bricks. Any feedback is greatly appreciated. The file is a compressed RAR file, just extract it to any directory and it should work fine. If you'd like to see the code I can post it here too. Remember this game is mostly just practice, so I can only go up from here.

Have fun!

P.S. I am using a Logitech Dual Action joypad without any problems but your mileage may vary. If you have an XBox-compatible pad with 2 analog sticks and a digital D-Pad you should be fine. If you have problems, let me know and I'll see if I can't tweak the code for you.

jmasterx
Member #11,410
October 2009

Crashes as soon as I launch it :-/

NULL pointer problem. eg, something is returning NULL and you are not handling that case.

agonvs
Member #15,917
March 2015

I can't imagine what would be causing the error short of an incompatible joystick. Not that I doubt it would make much difference, but is your system 64-bit or 32-bit? I built this thing on a 64-bit rig. Try this updated version. Here's the code for it too if you want to build it on your own platform. Just remember to keep all these files in the same directory and set it to your target directory.

Vanneto
Member #8,643
May 2007

I also get a crash. It seems that it's because I don't have the correct libstdc++-6.dll. Looking at the Allegro DLL I notice you included the MD version, which, according to the installation guide:

These options affect how the compiler links to the standard C library. The MT version includes it as part of the executable. The MD version leaves it out, and requires you to also include the appropriate system DLLs when you distribute your program.

So, you have two options, either keep using the MD version and include the appropriate libstdc++-6.dll when you distribute your game or use the MT version and avoid this problem. Below is a screen of the crash dialog.

{"name":"609353","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/6\/16f3c12011f123d227cbd1e71361ca5e.png","w":496,"h":171,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/6\/16f3c12011f123d227cbd1e71361ca5e"}609353

EDIT:

After this:

    if(!(al_install_joystick()))
      cout << "Couldn't install joystick." << endl;

You should probably add something like this:

    if (al_get_num_joysticks() == 0) {
        cout << "No joysticks detected. Sorry sucka!" << endl;
        return 0;
    }

So that the program exits gracefully if no joysticks are present instead of crashing horribly.

Alternatively, if you're in the geeky mood, just detect whether a joystick is present and if it's not, you could maybe fall back to keyboard controls? That way there would be no crashes.

EDIT2:

This version should work regardless of whether you have a joystick or not. I also attached the main2.cpp file with all the changes I did. You can view the differences here.

In capitalist America bank robs you.

jmasterx
Member #11,410
October 2009

Vanneto's version works for me :)

devo_au
Member #15,282
August 2013

Vanetto's fix works on mine too. The game works well with my Logitech F310 game pad. Good stuff agonvs

it wasn't me, it was other kids

agonvs
Member #15,917
March 2015

Wow! Thanks for all your great help and feedback. I really appreciate it :D Also, if you have any ideas for simple games you'd like to see, let me know and if it's not too difficult I'll have a crack at it 8-)

StevenVI
Member #562
July 2000
avatar

Got any screen shots?

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

agonvs
Member #15,917
March 2015

Here's a screen capture (I am using dual monitors. The game is on the left).

Go to: