#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2007
    Posts
    39
    Rep Power
    0

    Need Help for VC.Net


    Hi all

    I am very new to gaming and i am trying to learn gaming
    i am using .net 2005 .. Problem is coming here

    sprite.h
    Code:
    #ifndef SPRITE_H
    #define SPRITE_H
    #include "drawEngine.h"
    
    enum
    {
        SPRITE_CLASSID,
    };
    
    struct vector
    {
        float x;
        float y;
    };
    
    class Sprite
    {
    public:
        Sprite(DrawEngine *de, int s_index, float x= , float y=1, int i_lives=1);
        ~Sprite();
        vector getPosition(void);
        float getX(void);
        float getY(void);
        virtual void addLives(int num = 1);
        int getLives(void);
        bool isAlive(void);
        virtual bool move(float x, float y);
    protected:
        DrawEngine *drawArea;
        vector pos;
        int spriteIndex;
        int numLives;
        int classID;
        void draw(float x, float y);
        void erase(float x, float y);
        vector facingDirection;
    };
    
    #endif
    sprite.cpp
    Code:
    #include "sprite.h"
    Sprite::Sprite(DrawEngine *de, int s_index, float x = 1, float y = 1, int i_lives = 1)
    {
        drawArea = de;
        pos.x = x;
        pos.y = y;
        spriteIndex = s_index;
        numLives = i_lives;
        facingDirection.x = 1;
        facingDirection.y = 0;
        classID = SPRITE_CLASSID;
    }
    Sprite::~Sprite()
    {
        erase(pos.x,pos.y);
    }
    vector Sprite::getPosition(void)
    {
        return pos;
    }
    float Sprite::getX(void)
    {
        return pos.x;
    }
    float Sprite::getY(void)
    {
        return pos.y;
    }
    void Sprite::addLives(int num)
    {
        numLives += num;
    }
    int Sprite::getLives(void)
    {
        return numLives;
    }
    bool Sprite::isAlive(void)
    {
       
        return (numLives > 0);
    
    }
    bool Sprite::move(float x, float y)
    {
        erase(pos.x,pos.y);
        pos.x += x;
        pos.y += y;
        facingDirection.x = x;
        facingDirection.y = y;
        draw(pos.x,pos.y);
        return true;
    }
    void Sprite::draw(float x, float y)
    {
        drawArea->drawSprite(spriteIndex,x,y);
    }
    void Sprite::erase(float x, float y)
    {
        drawArea->eraseSprite(x,y);
    }
    error list

    Error 1 error C2143: syntax error : missing ')' before '*' d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 19
    Error 2 error C2143: syntax error : missing ';' before '*' d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 19
    Error 3 error C2460: 'Sprite:rawEngine' : uses 'Sprite', which is being defined d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 19
    Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 19
    Error 5 error C2062: type 'int' unexpected d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 19
    Error 6 error C2327: 'Sprite:rawEngine' : is not a type name, static, or enumerator d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.h 29
    Error 7 error C2065: 'de' : undeclared identifier d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 2
    Error 8 error C2597: illegal reference to non-static member 'Sprite:rawEngine' d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 2
    Error 9 error C2062: type 'int' unexpected d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 2
    Error 10 error C2143: syntax error : missing ';' before '{' d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 3
    Error 11 error C2447: '{' : missing function header (old-style formal list?) d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 3

    Realy i cant understand whats going on

    please any one can help and i am attaching the full source code also..i hope i will get help

    http://www.filefactory.com/file/2d3dc9/

    Thanks

    Kurian
  2. #2
  3. <?PHP user_title("gimp"); ?>
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2005
    Location
    Internet
    Posts
    7,652
    Rep Power
    6084
    Code:
    Sprite(DrawEngine *de, int s_index, float x= , float y=1, int i_lives=1);
    Looks like you're assigning ... nothing to x. But you're trying to.
    Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
    “Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.”
    Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
    -Partial Credit: Sun

    If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
    Ches Koblents
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2007
    Posts
    39
    Rep Power
    0
    Originally Posted by gimp
    Code:
    Sprite(DrawEngine *de, int s_index, float x= , float y=1, int i_lives=1);
    Looks like you're assigning ... nothing to x. But you're trying to.
    yes gimp your true but now issue is very diffrent

    Error 1 error C2572: 'Sprite::Sprite' : redefinition of default parameter : parameter 5 d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 3


    Error 2 error C2572: 'Sprite::Sprite' : redefinition of default parameter : parameter 4 d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 3


    Error 3 error C2572: 'Sprite::Sprite' : redefinition of default parameter : parameter 3 d:\kurian\dotnet\vc\evlmonkeys\evlmonkeys\sprite.cpp 3

    Whats its means ??
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2007
    Posts
    39
    Rep Power
    0
    yes i got it i am sorry i got the issue

    in header file and source file i am trying to declare value
    Sprite(DrawEngine *de, int s_index, float x=1 , float y=1, int i_lives=1);
    so i removed the value Sprite(DrawEngine *de, int s_index, float x, float y, int i_live);
    in header its working with no issue

    sorry for disturbing u people

IMN logo majestic logo threadwatch logo seochat tools logo