Hey
So I have this little problem. I'm working on a small project, just for fun, and I'm trying to store the types of various components from the game in sprite diffuse values.
Anyway, when I try to use the command to retrieve this diffuse colour (dbSpriteGreen in this case) it just returns 255!
I don't know if I've done anything wrong, if it's a bug, or if it's my graphics card that doesn't like these functions (NVIDIA GeForce 9600M GT). Here's the code in question:
int Rays;
int PX,PY;
int Width,Height;
int OrganDamage=0;
void CreateMatrix(int px,int py,int width,int height) {
dbLoadImage("Media/Grid.bmp",100);
PX=px;
PY=py;
Width=width;
Height=height;
int cx=dbScreenWidth()/2;//-((40*13)/2);
int cy=dbScreenHeight()/2-50;//-((40*13)/2);
int spr=101;
for(int x=1; x<=width; x++) {
for(int y=1; y<=height; y++) {
dbSprite(spr,cx,cy,100);//px+x*13,py+y*13,100);
dbOffsetSprite(spr,-((x*13)-((40*13)/2)),((y*13))-((40*13)/2));
dbSetSpriteAlpha(spr,0);
dbSetSpriteDiffuse(spr,0,0,0);
spr++;
}
}
dbSetSpriteDiffuse(365,0,255,0);
dbSetSpriteDiffuse(405,0,255,0);
dbSetSpriteDiffuse(404,0,255,0);
dbSetSpriteDiffuse(364,0,255,0);
dbSetSpriteDiffuse(324,0,255,0);
dbSetSpriteDiffuse(323,0,255,0);
dbSetSpriteDiffuse(363,0,255,0);
dbSetSpriteDiffuse(403,0,255,0);
dbSetSpriteDiffuse(362,0,255,0);
dbSetSpriteDiffuse(322,0,255,0);
dbSetSpriteDiffuse(282,0,255,0);
dbSetSpriteDiffuse(281,0,255,0);
dbSetSpriteDiffuse(321,0,255,0);
dbSetSpriteDiffuse(361,0,255,0);
dbSetSpriteDiffuse(360,0,255,0);
dbSetSpriteDiffuse(320,0,255,0);
dbSetSpriteDiffuse(280,0,255,0);
dbSetSpriteDiffuse(279,0,255,0);
dbSetSpriteDiffuse(239,0,255,0);
dbSetSpriteDiffuse(359,0,255,0);
dbSetSpriteDiffuse(319,0,255,0);
dbSetSpriteDiffuse(318,0,255,0);
dbSetSpriteDiffuse(317,0,255,0);
dbSetSpriteDiffuse(358,0,255,0);
dbSetSpriteDiffuse(357,0,255,0);
dbSetSpriteDiffuse(316,0,255,0);
dbSetSpriteDiffuse(356,0,255,0);
dbSetSpriteDiffuse(236,0,255,0);
dbSetSpriteDiffuse(276,0,255,0);
dbSetSpriteDiffuse(237,0,255,0);
dbSetSpriteDiffuse(238,0,255,0);
dbSetSpriteDiffuse(278,0,255,0);
dbSetSpriteDiffuse(277,0,255,0);
Rays=spr;
}
void ShowAreas() {
int spr=101;
for(int x=0; x<40; x++) {
for(int y=0; y<40; y++) {
if(dbSpriteGreen(spr)==255) dbSetSpriteAlpha(spr,255);
spr++;
}
}
dbLoadImage("Mouse.bmp",5000);
}
void TestAreas() {
dbSprite(5000,dbMouseX(),dbMouseY(),5000);
int spr=dbSpriteCollision(5000,0);
char buffer[50];
if(spr!=0) {
sprintf(buffer,"%d",dbSpriteBlue(spr));
dbText(1,20,buffer);
}
else dbText(1,20,"No Sprite");
}
void CheckHit() {
int cx=dbScreenWidth()/2;//-((40*13)/2);
int cy=dbScreenHeight()/2-50;//-((40*13)/2);
int spr=101;
for(int x=0; x<40; x++) {
for(int y=0; y<40; y++) {
if(dbSpriteCollision(8,spr)==1) {
//dbSprite(spr,cx,cy,TUMOR);
//dbOffsetSprite(spr,-((x*13)-((40*13)/2)),((y*13))-((40*13)/2));
int Damage=dbSpriteAlpha(spr)+10;
if(Damage>255) Damage=255;
dbSetSpriteAlpha(spr,Damage);
if(dbSpriteGreen(spr)==255) {
OrganDamage+=Damage;
}
}
spr++;
}
}
}
void RotateMatrix(int Angle) {
int spr=101;
for(int x=1; x<=Width; x++) {
for(int y=1; y<=Height; y++) {
dbRotateSprite(spr,(float)Angle);
spr++;
}
}
}
Maybe it's just something I've missed.
On the code, I know it's not the fastest way to complete tasks, and and many of the functions are just test functions, but the code hasn't been optimised yet. Anyway if you find any critical mistake please tell me :p I'm quite new to C++ still.
So what could be the problem? Thanks in advance,
Nizze
-- Nizze