Original Post
Ok, I''m trying to fire a bullet in a 2-d side scroller, and I''m getting 2 errors when I try to set up a RECT so I can blt a small square to the screen.
C:\Program Files\Microsoft Visual Studio\MyProjects\engine\engine.cpp(447) : error C2057: expected constant expression
C:\Program Files\Microsoft Visual Studio\MyProjects\engine\engine.cpp(447) : error C2466: cannot allocate an array of constant size 0
heres the code
Fired[]s are Bullet objects. I made 5 of them, and each frame that one isn''t fired the position of each bullet is moved to that of the player (Homie object). The problem is some where in that segment of code (I think) but I don''t see whats wrong. Hopefully someone here will.
Hibiki
Wheres the any key?
find your element at mutedfaith.com. <º>
int temp = activebullets;
int something = 5;
if(temp == 0)
{
while(something >0)
{
Fired[something].pos_x = Homie.pos_x + 47;
Fired[something].pos_y = Homie.pos_y + 40;
something--;
}
}
if(activebullets !=0)
{
DDBLTFX ddbltfx;
DDRAW_INIT_STRUCT(ddbltfx);
ddbltfx.dwFillColor = RGB565(254,254,254);
while(temp > 0)
{
Fired[temp].MoveBullet(3);
RECT bullet[temp] = {Fired[temp].pos_x,Fired[temp].pos_y,
Fired[temp].pos_x +4,Fired[temp].pos_y + 4};
if(FAILED(lpddsback->Blt(•[temp],NULL,NULL,DDBLT_WAIT | DDBLT_COLORFILL,&ddbltfx)))
MessageBox(main_window_handle,"error","draw bullet",NULL);
if(Fired[temp].Offscreen())
activebullets--;
temp--;
}
}
find your element at mutedfaith.com. <º>