Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Stacker - binary and commented source code

This thread is locked; no one can reply to it. rss feed Print
Stacker - binary and commented source code
HardTranceFan
Member #7,317
June 2006
avatar

This is Fruit Stacker, my PC version of the web game SkullStax and my first attempt at writing a game using Allegro. In the zip file is an executable (Windows) and the source files (C++ code and images).

It's commented as best as I could for anyone wanting to learn how the thing hangs together and appears to work. The main things still missing are sound, a high score table and animation. My initial goal was to write a game that worked, something smallish that could be dissected by others to learn from.

It'd be nice to get some comments on the game - improvements, what you liked, what sucked...

The zip file can be found here

{"name":"590153","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/b\/cba03a13779d6a019e66e49111aa1411.jpg","w":526,"h":425,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/b\/cba03a13779d6a019e66e49111aa1411"}590153

Cheers,
Jeroen

BTW, is there a guide on how to include images or use different text for a link in these messages (like an <a href...></a>)?

{edit - Thanks Kikaru for the HTM Mockup codes...}

--
"Shame your mind don't shine like your possessions do" - Faithless (I want more part 1)

Kikaru
Member #7,616
August 2006
avatar

Click the "HTML Mockup Code is enabled" text to get a list of commands.

Very nice! The gameplay is a lot like the game I am currently working on, Drill Garanz. Very nice for a first!

CGamesPlay
Member #2,559
July 2002
avatar

1$ g++ main.cpp `allegro-config --libs`
2main.cpp: In function 'int main()':
3main.cpp:124: error: 'CLK_TCK' was not declared in this scope
4main.cpp:209: error: 'CLK_TCK' was not declared in this scope
5main.cpp: In function 'void initialiseGame()':
6main.cpp:299: error: 'CLK_TCK' was not declared in this scope
7main.cpp: In function 'eGameState gameMenu()':
8main.cpp:405: error: 'CLK_TCK' was not declared in this scope
9main.cpp: In function 'eGameState playGame()':
10main.cpp:544: error: 'CLK_TCK' was not declared in this scope
11main.cpp:582: error: 'CLK_TCK' was not declared in this scope
12main.cpp: In function 'void displayFrame(clock_t)':
13main.cpp:643: error: 'CLK_TCK' was not declared in this scope
14main.cpp: In function 'int updateScore()':
15main.cpp:944: error: 'CLK_TCK' was not declared in this scope
16main.cpp: In function 'int bonusCheck()':
17main.cpp:1051: error: 'CLK_TCK' was not declared in this scope
18main.cpp: In function 'void waveString(BITMAP*)':
19main.cpp:1135: error: 'CLK_TCK' was not declared in this scope
20main.cpp:1153: error: 'CLK_TCK' was not declared in this scope
21main.cpp: In function 'void instructionsPage1()':
22main.cpp:1240: error: 'CLK_TCK' was not declared in this scope
23main.cpp:1249: error: 'CLK_TCK' was not declared in this scope
24main.cpp: In function 'void instructionsPage2()':
25main.cpp:1341: error: 'CLK_TCK' was not declared in this scope
26main.cpp: In function 'bool instructionsNext(int*, int*, clock_t*)':
27main.cpp:1379: error: 'CLK_TCK' was not declared in this scope

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

HardTranceFan
Member #7,317
June 2006
avatar

I checked the error message out, and it appears CLK_TCK is an obsolete name for CLOCKS_PER_SEC.

So, I've replaced all occurrences of CLK_TCK with CLOCKS_PER_SEC, recompiled and put the new binary & source into this link.

Cheers,
Jeroen

--
"Shame your mind don't shine like your possessions do" - Faithless (I want more part 1)

Pavel Hilser
Member #5,788
April 2005
avatar

The game is fun to play. The only thing that could make it better is - giving time bonuses and showing the time as a bar.
If you show the time bar at the bottom, the player will see if the end is near. Giving time bonuses for multiple fruits - and time penalties for single fruit clicks will do it more action.
And for example, clicking two fruits will do no time - so the player will be forced to click three or more, or click to create this combinations (you already have this, but for creating score).

There is too much time at this time, I played it at the first time to the 8th level without problem and then the time dropped. If you do the time as I write, there will be a lot action, fighting each level.

Anyway, add some sound and perhaps some graphical effect (particles?) when clicking the fruit. Good work :)

_____________________________________
Mein Cannon - see my new 2d game

HardTranceFan
Member #7,317
June 2006
avatar

The game does give a time bonus for multiple fruits clicked (of the same type), and there is a time penalty for clicking only one fruit. These bonuses and penalties increase the higher the level goes (you can also check the source code to see how this is calculated).

I agree with the sound comment. I haven't looked into sound, and want to make it the main area of work in the current game I'm working on, where I'll put in a sound track, sound fx and a basic particle system.

Cheers,
Jeroen

--
"Shame your mind don't shine like your possessions do" - Faithless (I want more part 1)

Go to: