SFML community forums

General => SFML projects => Topic started by: Mario on December 16, 2012, 09:57:39 pm

Title: Black Knight Blockade (Minigame)
Post by: Mario on December 16, 2012, 09:57:39 pm
So, finally something finished to show off. :)

I've initially created this for Ludum Dare 25 (http://www.ludumdare.com/compo/ludum-dare-25/). The topic has been "You are the Villain".


(http://i.imgur.com/2jpqM.png)

You are the feared Black Knight. You are in charge of a small passage in the dark wood and you decide who's allowed to pass: no one!

Unfortunately there are quite a few pesky peasants out trying to cross the bridge to do some of their daily bidding, something you shall not endorse.

Keep the peasants from crossing, but watch your rage, as you might get angry enough causing your head to explode in anger. You don't want your head explode, do you?

Every killed peasant will lower your anger, while every escaped peasant will raise your rage. If your rage exceeds your rage meter, you're going to explode and the game is lost. Use your attack key to restart the game.

Keyboard Controls:

Walk left: Cursor left, A
Walk right: Cursor right, D
Walk up: Cursor up, W
Walk down: Cursor down, S
Sword thrust: Space, Return

If you want, feel free to download the source code (GPL v3) and toy around with it. It should compile out of the box for Windows as well as Unix and similar systems. If you're able to compile SFML, you should be able to compile and run the game as well.

Update - 28.12.2012
- Water now slows down minions.
- It is now possible to hold down the attack key rather than smashing it.
- Some further tweaks.

Update - 01.01.2013
- Added a simple icon (for Windows binary).
- Some minor tweaks.
- Replaced the binary download with a release version (last release has been debug).

[Github Repository (primary) (https://github.com/MarioLiebisch/Black-Knight-Blockade)] [Google Code Repository (http://code.google.com/p/black-knight-blockade/)][Windows Binary (http://code.google.com/p/black-knight-blockade/downloads/detail?name=ld25bkb-win32-20130101.zip&can=2&q=) (updated)] [Source Code Snapshot (http://code.google.com/p/black-knight-blockade/downloads/detail?name=ld24bkb-source-initial.zip&can=2&q=)][Ludum Dare 25 Entry Page (http://www.ludumdare.com/compo/ludum-dare-25/?action=preview&uid=19197)]
Title: Re: Black Knight Blockade (Minigame)
Post by: FRex on December 17, 2012, 12:01:54 am
It's pretty cool. Do you have anything else about your LD entry? Blog, video time lapse ect. I've been told by someone I should try LD myself.
Title: Re: Black Knight Blockade (Minigame)
Post by: eXpl0it3r on December 17, 2012, 12:23:03 am
Do you have anything else about your LD entry? Blog, video time lapse ect.
It doesn't seem like he did a time lapse or something, but he's Smaxx on the LD website (http://www.ludumdare.com/compo/author/Smaxx/).
Title: Re: Black Knight Blockade (Minigame)
Post by: MorleyDev on December 17, 2012, 12:28:01 am
Looks neat.

Flicking through the code, I'm not gonna comment too much because time limit so not-perfect structure and some circular references are probably to be expected.

But I'm just gonna throw out that anything beginning with __ in C++ is considered reserved for the compiler. It won't cause problems unless the compiler decides it wants it, which will vary from compiler to compiler, which is why it is regarded by many as a non-too-good thing to do.

It's not that useful to differentiate between parameters and local variables anyway (parameters can be seen as just extra local variables), as opposed to member variables and local variables where it is useful.
Title: Re: Black Knight Blockade (Minigame)
Post by: Mario on December 17, 2012, 12:43:11 am
Yeah, actually tried something new with the underscores and I think I'll go back to different casing. Underscores get quite messy in MSVC with Intellisense.

Timelapse/streaming would have been interesting, but I've got far too much work stuff on my PC so I'd always have to double check to not leak something important.
Title: Re: Black Knight Blockade (Minigame)
Post by: Stupebrett on December 17, 2012, 08:03:18 pm
Very cool game! I really liked it. The sword slashing was kind of odd though. Something that would have been really cool is to make the sword slashing like in the old 8-bit zelda games (like Link's Awakening). That would probably make it look a lot better.
Title: Re: Black Knight Blockade (Minigame)
Post by: npepinpe on December 18, 2012, 04:33:36 pm
Little gripe about the code, in player.cpp:72

if (_movtick = !_movtick) {
             ^------------- assignment, not comparison!

This is a pretty ambiguous statement that's very hard for someone else to interpret without any comments :P
Title: Re: Black Knight Blockade (Minigame)
Post by: FRex on December 18, 2012, 04:45:08 pm
I feel like I have a deja vu. I've seen(and correct) someone iterate over a c-styled string like that just last week. ;D
int i=0;
while(str[i]=!'\0')//assing every single byte starting at str[0] to 1 in infinite loop
{
/*ect.*/
}
 
When str[i ] finally driven out of the stack for the program, windows started to complain.
Title: Re: Black Knight Blockade (Minigame)
Post by: Mario on December 18, 2012, 11:18:34 pm
With the difference that it's intentional here. But you're both right, not the best way to "simplify" that statement. :)

Actually the whole variable is pretty much obsolete considering I'm counting steps/ticks anyway.

Stupebrett: I thought about it, but due to limited time I went with the straight sword "animation". But I might change that in the future.