SFML community forums

General => SFML projects => Topic started by: Srejv on February 13, 2009, 09:56:04 pm

Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 13, 2009, 09:56:04 pm
Hey guys!

I've made little puzzler and I'd like some feedback. :)

http://srejv.radhuset.org/flipgame/


So I rewrote the game, and improved on it. :) Changed a few of the levels too.
I'd still like some feedback! Good luck! :)

I'm using the animation framework in the wiki for animation. :]
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 14, 2009, 12:41:12 pm
Thank you. :)
Title: Re: FlipGame
Post by: Nexus on February 14, 2009, 01:20:08 pm
Nice Game, funny to play. :)

If you want to continue working on it, you could make everything a little bit more colored, add some flip animations or something like this... ;)

Quote from: "Srejv"
I already have a feature request: a save function. Because noone will finish all the 100 (!) levels in one go.
That is definitively not SFML's task. ;)

You can save by writing into files. Use the C++ standard library's file stream std::fstream (http://www.cplusplus.com/reference/iostream/fstream/) to do so.
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 14, 2009, 01:29:58 pm
Thank you! :)

Yes, animation is on the list. :] And colors!

I think I have to rewrite my screen class to support sharing variables between screens. I'm currently using http://www.sfml-dev.org/wiki/en/tutoriels/multiecransjeu_en and I try to add a static bool to that class to check if you press the "load game" option. But it won't compile. :(

1>main.obj : error LNK2001: unresolved external symbol "protected: static bool Screen::load_game" (?load_game@Screen@@1_NA)


So I'm gonna have to think of another way.
Title: FlipGame[Updated 02.18 2009]
Post by: Tank on February 14, 2009, 02:26:02 pm
Would you mind releasing the source code so that non-Windows users can enjoy your game? :)
Title: FlipGame[Updated 02.18 2009]
Post by: Nexus on February 14, 2009, 02:34:38 pm
Quote from: "Srejv"
So I'm gonna have to think of another way.
Not really. You probably forgot to define the Screen::load_game function or didn't define it exactly with the same type as declared. At least the linker cannot find the definition.
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 14, 2009, 02:54:03 pm
Quote from: "Tank"
Would you mind releasing the source code so that non-Windows users can enjoy your game? :)


Yes, that's the plan, only it's kinda broken right now since I'm trying to make it a better game. :] But I'm having some trouble so ... well.

Quote from: "Nexus"
Not really. You probably forgot to define the Screen::load_game function or didn't define it exactly with the same type as declared. At least the linker cannot find the definition.


I just had a public static bool, no function. :\ No idea what I'm doing wrong.

 
Code: [Select]

class Screen
{
public:
    static bool load_game;
    virtual int Run (sf::RenderWindow &App) = 0;
};


Edit:

Code: [Select]

1>square.obj : error LNK2001: unresolved external symbol "protected: static class sf::Image Square::m_White" (?m_White@Square@@1VImage@sf@@A)
1>square.obj : error LNK2001: unresolved external symbol "protected: static class sf::Image Square::m_Grey" (?m_Grey@Square@@1VImage@sf@@A)



Trying to follow http://www.sfml-dev.org/tutorials/1.4/graphics-sprite.php to get static vars working, but it's not working. Checked http://msdn.microsoft.com/en-us/library/f6xx1b1z(vs.71).aspx and I think it's got something to do with accessing the variables from other places. :\


Edit again:

Yes. When I remove the call from square.cpp the error vanishes. Hm. So calling a static variable from another file isn't allowed? :S
Title: FlipGame[Updated 02.18 2009]
Post by: Nexus on February 14, 2009, 03:13:52 pm
Quote from: "Srejv"
I just had a public static bool, no function. :\ No idea what I'm doing wrong.
Ah sorry. But the problem remains the same. The variable needs to be defined in the CPP file:

Code: [Select]
bool Screen::load_game;           // or:
bool Screen::load_game = false;

If you don't initialize load_game, it is initialized with its null value (in this case false) like all static or global variables.
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 14, 2009, 05:07:55 pm
Quote from: "Nexus"
Quote from: "Srejv"
I just had a public static bool, no function. :\ No idea what I'm doing wrong.
Ah sorry. But the problem remains the same. The variable needs to be defined in the CPP file:

Code: [Select]
bool Screen::load_game;           // or:
bool Screen::load_game = false;

If you don't initialize load_game, it is initialized with its null value (in this case false) like all static or global variables.


Aah! It works now! :D Thank you so much!

Though I still think I have to rewrite some of this stuff. Trying to figure out how to make the animation.
Title: FlipGame[Updated 02.18 2009]
Post by: Nexus on February 14, 2009, 05:28:50 pm
Quote from: "Srejv"
Aah! It works now! :D Thank you so much!
No problem. ;)

Quote from: "Srejv"
Trying to figure out how to make the animation.
One way is to have several sprites which represent each step of the animation. So you draw one sprite, wait a certain time, draw the next, and so on... The more steps you have, the more fluent the animation looks.
Title: FlipGame[Updated 02.18 2009]
Post by: Daazku on February 14, 2009, 08:35:02 pm
Just a question :D. I was level 33 and i clicked on start game so i lose my save game... How can i revert back to level 33?
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 15, 2009, 05:12:13 pm
Sorry, if you clicked the start game button the saved game is pretty much gone. :\ I'm working on a better way to solve the saving in a new version.

It's got animation and colors. :)
Title: FlipGame[Updated 02.18 2009]
Post by: Daazku on February 15, 2009, 06:03:50 pm
The game crash when we close the window.
Im stuck at level 54.

Edit: Stuck at level 60!
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 15, 2009, 07:41:12 pm
Yes, the game crash is also fixed in the new version that's coming soon. Working on it right now. :]
Title: FlipGame[Updated 02.18 2009]
Post by: dabo on February 22, 2009, 11:44:31 am
Good job, I like the new animations. Don't know what I think about the way you show the current level though :)

I also get an error when I quit the game:

'The instruction at "0x0930afda" referenced memory at "0x00000080". The memory could not be "read".'
Title: FlipGame[Updated 02.18 2009]
Post by: Srejv on February 24, 2009, 04:28:49 pm
I think the new way of showing the level is better... but maybe that's just me. :\

Yes, it's the sf::font class when it loads the default font. :\ From what I understood it's a sfml bug..
Title: FlipGame[Updated 02.18 2009]
Post by: Nexus on February 25, 2009, 09:58:20 pm
Quote from: "Srejv"
Yes, it's the sf::font class when it loads the default font. :\ From what I understood it's a sfml bug..
Hm, I rather don't think so. Did you initialize it before main() is invoked? If the font is set inside a constructor or a called function from a global or static object, this may lead to problems.