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

Author Topic: Sprite + class  (Read 2263 times)

0 Members and 1 Guest are viewing this topic.

Xenavar

  • Newbie
  • *
  • Posts: 40
    • View Profile
Sprite + class
« on: February 18, 2010, 03:47:39 am »
Hello,

I can't make a function "GetSprite" inside of my class somehow...

Caracter.H

private:  int Max_Hp;
              int Current_Hp;
              int Max_Mana;
              int Current_Mana;
              sf::Sprite Sprite;
public:
            sf::Sprite GetSprite();

Caracter.cpp

sf::Sprite GetSprite();
{
   return Sprite;
}

there is an error on the "return Sprite" line with the following:
|134|error: `Sprite' was not declared in this scope|

It says it doesn't recognize it, but if I use ''Sprite.something" on any other function inside the class it works.

I am guessing syntax must be incorrect near the bold text. Any help?

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Sprite + class
« Reply #1 on: February 18, 2010, 04:12:15 am »
You aren't using the class' name in the function description. And that extra semicolon should prevent it from compiling, too...(just before the curly bracket in the cpp file)
I use the latest build of SFML2

Xenavar

  • Newbie
  • *
  • Posts: 40
    • View Profile
Sprite + class
« Reply #2 on: February 18, 2010, 04:23:13 am »
Its fixed now. Thanks!