hey i got upto the else atthe bottom to get the gameover to work everything was going well then i begin to get these errors can some one please help me?
1>------ Build started: Project: Chili DirectX Framework, Configuration: Release Win32 ------
1> Game.cpp
1>..\Assets\Game.cpp(2749): warning C4390: ';' : empty controlled statement found; is this the intent?
1>..\Assets\Game.cpp(2766): warning C4390: ';' : empty controlled statement found; is this the intent?
1>..\Assets\Game.cpp(2782): warning C4390: ';' : empty controlled statement found; is this the intent?
1>..\Assets\Game.cpp(2788): error C2059: syntax error : 'else'
1>..\Assets\Game.cpp(2789): error C2143: syntax error : missing ';' before '{'
1>..\Assets\Game.cpp(2789): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========
and this is my code for game.ccp
#include "Game.h"
Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx( hWnd ),
kbd( kServer ),
facex( 390),
facey(290),
poo1x(100),
poo1y(100),
poo1iseaten( false),
poo2x(650),
poo2y(200),
poo2iseaten( false),
poo3x(300),
poo3y(510),
poo3iseaten( false)
{}
// above is the codes if you declare varibles here it will set it ONCE then the rest is all the composed frames job.
void Game::Go()
{
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}
Void Game::drawface ( int x, int y)
void Game:: drawpoo( int x, int y)
void Game:: drawgameover( int x, int y)
void Game::ComposeFrame()
{
int speed;
speed = 3;
// move cursor
if(kbd.SpaceIsPressed())
{speed = 1;}
if( kbd.EnterIsPressed())
{speed = 8;}
if( kbd.RightIsPressed() )
{ facex = facex + speed; }
if( kbd.LeftIsPressed() )
{ facex = facex + -speed; }
if( kbd.UpIsPressed() )
{ facey = facey + -speed; }
if( kbd.DownIsPressed() )
{ facey = facey + speed; }
// stop from going of edges
if( facex < 0 )
{facex = 0;}
if ( facex + 20 > 799)
{facex = 799 - 20;}
if( facey < 0 )
{facey = 0;}
if ( facey + 20 > 599)
{facey = 599 - 20;}
if(!(poo1iseaten && poo2iseaten && poo3iseaten))
if( !poo1iseaten)
{
if( facex + 20 > poo1x &&
facex < poo1x + 24 &&
facey + 20 > poo1y &&
facey < poo1y + 24);
{
poo1iseaten = true;
}
drawpoo( poo1x,poo1y);
}
if( !poo2iseaten)
{
if( facex + 20 > poo2x &&
facex < poo2x + 24 &&
facey + 20 > poo2y &&
facey < poo2y + 24);
{
poo2iseaten = true;
}
drawpoo( poo2x,poo2y);
}
if( !poo3iseaten)
{
if( facex + 20 > poo3x &&
facex < poo3x + 24 &&
facey + 20 > poo3y &&
facey < poo3y + 24);
{
poo3iseaten = true;
}
drawpoo( poo3x,poo3y);
}
}
else
{
drawgameover(375,275);
}
thats it, please help i'm finding it really hard to find what is wrong
lesson 8 "ëlse" problems
Re: lesson 8 "ëlse" problems
Wow, there is a lot of things wrong with this code. You really need to work harder on paying attention to the details of the language syntax. Here are some things I saw.
There may very well be other problems, but at first glance this is what I see. Good luck!
Where is the actual code for these function?Void Game::drawface ( int x, int y)
void Game:: drawpoo( int x, int y)
void Game:: drawgameover( int x, int y)
Missing curly braces.if(!(poo1iseaten && poo2iseaten && poo3iseaten))
No semicolon here!if( facex + 20 > poo1x &&
facex < poo1x + 24 &&
facey + 20 > poo1y &&
facey < poo1y + 24);
There may very well be other problems, but at first glance this is what I see. Good luck!
Chili
Re: lesson 8 "ëlse" problems
thanks chill all working fine now