Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Black Knight Blockade (Minigame)  (Read 6326 times)

0 Members and 1 Guest are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Black Knight Blockade (Minigame)
« on: December 16, 2012, 09:57:39 pm »
So, finally something finished to show off. :)

I've initially created this for Ludum Dare 25. The topic has been "You are the Villain".




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)] [Google Code Repository][Windows Binary (updated)] [Source Code Snapshot][Ludum Dare 25 Entry Page]
« Last Edit: January 02, 2013, 02:51:44 pm by Mario »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Black Knight Blockade (Minigame)
« Reply #1 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.
« Last Edit: December 17, 2012, 12:12:14 am by FRex »
Back to C++ gamedev with SFML in May 2023

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Black Knight Blockade (Minigame)
« Reply #2 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MorleyDev

  • Full Member
  • ***
  • Posts: 219
  • "It is not enough for code to work."
    • View Profile
    • http://www.morleydev.co.uk/
Re: Black Knight Blockade (Minigame)
« Reply #3 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.
« Last Edit: December 17, 2012, 12:39:40 am by MorleyDev »
UnitTest11 - A unit testing library in C++ written to take advantage of C++11.

All code is guilty until proven innocent, unworthy until tested, and pointless without singular and well-defined purpose.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Black Knight Blockade (Minigame)
« Reply #4 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.

Stupebrett

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Black Knight Blockade (Minigame)
« Reply #5 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.

npepinpe

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Black Knight Blockade (Minigame)
« Reply #6 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
« Last Edit: December 18, 2012, 04:35:18 pm by npepinpe »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Black Knight Blockade (Minigame)
« Reply #7 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.
« Last Edit: December 18, 2012, 05:37:02 pm by FRex »
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Black Knight Blockade (Minigame)
« Reply #8 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.