|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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.
__________________
A work in progress: Card Game Platform (Status: On Hold) | 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.” |
|
#3
|
|||
|
|||
|
Quote:
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 ?? |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Game Development > Need Help for VC.Net |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|