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

Author Topic: It's Raining Snow! - A retro-arcade style Christmas game!  (Read 7865 times)

0 Members and 1 Guest are viewing this topic.

Jallen

  • Newbie
  • *
  • Posts: 40
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« on: December 24, 2010, 05:08:51 pm »
Hey guys, I just finished this little christmas game. It took only about 7 hours but I'm really happy with how it turned out.



Thanks!

There's a video, info, pics and download at my site, here:
http://jallenbah.co.uk/rainingsnow.php

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #1 on: December 24, 2010, 06:38:40 pm »
Nice little game. Could use a little more, like an increase in difficulty over time, but still good for just a little 7 hour project. Gave up around 250k+ points. :P

AdventWolf

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #2 on: December 24, 2010, 07:11:09 pm »
Cool game, I'd definitely add some more to it.

David2010

  • Newbie
  • *
  • Posts: 4
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #3 on: December 24, 2010, 08:13:22 pm »
Nice. I couldn't play it because I was missing a couple DLL's but I saw the video of it.

The snow... It burns.

Jallen

  • Newbie
  • *
  • Posts: 40
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #4 on: December 25, 2010, 02:25:41 pm »
It requires the VC++ 2010 redist.

Thanks for the responses :)

Hugo

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #5 on: December 26, 2010, 12:34:50 am »
Doesn't work on Linux

Jallen

  • Newbie
  • *
  • Posts: 40
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #6 on: December 26, 2010, 01:11:49 pm »
Quote from: "Hugo"
Doesn't work on Linux


Do you mean in Wine? The only non-sfml win32 stuff I used was WinMain and ShellExecuteW for the website link on the game-over screen, so I would be surprised if it wouldn't work in Wine.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #7 on: January 13, 2011, 05:52:00 pm »
It´s a nice and fun game!

By the way, did you wrote your own font system to use those graphics as font? If so, could you just outline how you did it?

Thanks and congratulations!
CJ

Jallen

  • Newbie
  • *
  • Posts: 40
    • View Profile
It's Raining Snow! - A retro-arcade style Christmas game!
« Reply #8 on: January 13, 2011, 10:26:07 pm »
Thanks. I did the font system myself, yes. I first loaded all of the character images into a std::Vector of a struct containing a character which represents that image and the sf::Image itself, so it was like

Code: [Select]
struct CharImg
{
    char cha;
    sf::Image img;
};

(using integer ascii codes is useful for this so you can loop-load them)

Then I made a function which gets a desired character image pointer, like so:
Code: [Select]

sf::Image* Font::GetCharImage(char character)
{
for(int i = 0; i < chars.size(); i++)
{
if(chars[i]->cha == character)
return &chars[i]->img;
   }

return 0;
}


Then for the font drawing, I do something like this:
Code: [Select]
void Font::DrawText(std::string string, sf::Vector2f position, sf::Vector2f scale, sf::RenderWindow* rwindow)
{
std::vector<sf::Sprite> spriteVector;
sf::Vector2f nextpos(position);

for(int i = 0; i < string.length(); i++)
{
if(string[i] == '\n')
nextpos = sf::Vector2f(position.x, nextpos.y + (10 * scale.y));
else if(string[i] == ' ')
nextpos.x += (7 * scale.x);
else
{
spriteVector.push_back(sf::Sprite(*GetCharImage(string[i]), nextpos, scale));
nextpos.x += (7 * scale.x);
}
}

for(int i = 0; i < spriteVector.size(); i++)
{
rwindow->Draw(spriteVector[i]);
}
}

So not super efficient, creating a vector of the sprites each time I want to draw the text, but I wasn't concerned with that at the time since I was on a time limit for a small competition on another forum.

As you can see, for a newline I take the initial position and add some Y to it, that will put me below the first char in the text. For a space I simply advance the X position and for any other char I display the image and advance the X position.

Hope this helped!