I did a copy&paste of the code but it give me the errors
Quote: "1>------ Build started: Project: Fighter, Configuration: Debug Win32 ------
1>Compiling...
1>weapon.cpp
1>c:\program files (x86)\microsoft directx sdk (august 2007)\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(18) : error C2065: 'Bullet' : undeclared identifier
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(18) : error C2228: left of '.Active' must have class/struct/union
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(18) : error C2065: 'Bullet' : undeclared identifier
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(18) : error C2228: left of '.Update' must have class/struct/union
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(21) : error C2065: 'Bullet' : undeclared identifier
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(21) : error C2228: left of '.Active' must have class/struct/union
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(28) : error C2065: 'Bullet' : undeclared identifier
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(28) : error C2228: left of '.Active' must have class/struct/union
1>c:\users\\documents\visual studio 2008\projects\fighter\fighter\weapon.cpp(28) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Users\\Documents\Visual Studio 2008\Projects\Fighter\Fighter\Debug\BuildLog.htm"
1>Fighter - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
"
and my code looks like this
#include "darkgdk.h"
#include "Dinput.h"
struct BULLET{
bool Active;//this is true if the bullet is active
float x,y;//yes even in 2D games you need to use floats for this
float dx,dy;//this is the vector the bullet is traveling. it has direction and magnitude
void Update(void);
}Bullets[500];//you have a max of 500 bullets at your disposal
void BULLET::Update(void){
x+=dx;
y+=dy;
dbDot(x,y);
}
void BulletFire(void)
{
for (int i=0;i<500;i++){
if (Bullet[i].Active) Bullet[i].Update();
if (dbSpriteCollision(11,2)== 1)
{
Bullet[i].Active=false;
}
//check collisions here
//if collide with something then Bullet[i].Active=false and do damage to object
}
if (dbKeyState(DIK_W) == 1){
int i=0;
while ((Bullet[i].Active)&&(i<500)) i++;
if (i<500){
Bullet[i].Active=true;
Bullet[i].x=(playerX);
Bullet[i].y=(playerY);
Bullet[i].dx=the direction times the speed of the bullet
Bullet[i].dy=the direction times the speed of the bullet
}
}
}
Beginner In the Language.