Page 1 of 1

Lesson 5 problem

Posted: June 3rd, 2012, 12:37 pm
by Tyas
Hey,

I'm Tyas and i'm new here.
I just started your tutorials and now I am at lesson 5.
But when I try to run it is gives this error


1>------ Build started: Project: Chili DirectX Framework, Configuration: Release Win32 ------
1> Game.cpp
1>..\Assets\Game.cpp(26): error C2612: trailing 'identifier' illegal in base/member initializer list
1>..\Assets\Game.cpp(26): error C2064: term does not evaluate to a function taking 1 arguments
1>..\Assets\Game.cpp(27): error C2064: term does not evaluate to a function taking 1 arguments
1>..\Assets\Game.cpp(28): error C2143: syntax error : missing ';' before '{'
1>..\Assets\Game.cpp(31): error C2601: 'Game::Go' : local function definitions are illegal
1>..\Assets\Game.cpp(38): error C2601: 'Game::ComposeFrame' : local function definitions are illegal
1>..\Assets\Game.cpp(75): fatal error C1004: unexpected end-of-file found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It happends when I Try to give the 'x' and 'y' a number in the game.cpp
Do I need to post my whole script or is this error enough?


Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx( hWnd ),
kbd( kServer )
x( 400 );
y( 300 )
{}

void Game::Go()
{
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}

void Game::ComposeFrame()
{

if( kbd.RightIsPressed() )
{
x = x + 1;
}

if( kbd.DownIsPressed() )
{
y = y + 1;
}

if( kbd.UpIsPressed() )
{
y = y - 1;
}

if( kbd.LeftIsPressed() )
{
x = x - 1;
}


gfx.PutPixel( x, y,255,255,255 );
gfx.PutPixel( -5 + x, y,255,255,255 );
gfx.PutPixel( -4 + x, y,255,255,255 );
gfx.PutPixel( -3 + x, y,255,255,255 );
gfx.PutPixel( 3 + x, y,255,255,255 );
gfx.PutPixel( 4 + x, y,255,255,255 );
gfx.PutPixel( 5 + x, y,255,255,255 );
gfx.PutPixel( x,-5 + y,255,255,255 );
gfx.PutPixel( x,-4 + y,255,255,255 );
gfx.PutPixel( x,-3 + y,255,255,255 );
gfx.PutPixel( x, 3 + y,255,255,255 );
gfx.PutPixel( x, 4 + y,255,255,255 );
gfx.PutPixel( x, 5 + y,255,255,255 );
}

Re: Lesson 5 problem

Posted: June 3rd, 2012, 12:51 pm
by LuX

Code: Select all

Game::Game( HWND hWnd,const KeyboardServer& kServer )
:	gfx( hWnd ),
    kbd( kServer )
    x( 400 );
    y( 300 )
{}
separate all values with commas, except the last one.

Re: Lesson 5 problem

Posted: June 3rd, 2012, 1:01 pm
by Tyas
LuX wrote:

Code: Select all

Game::Game( HWND hWnd,const KeyboardServer& kServer )
:	gfx( hWnd ),
    kbd( kServer )
    x( 400 );
    y( 300 )
{}
separate all values with commas, except the last one.
Thanks man!
It worked!

Re: Lesson 5 problem

Posted: June 3rd, 2012, 1:23 pm
by chili
Hey LuX, how is your shooting demo coming? :)

Re: Lesson 5 problem

Posted: June 3rd, 2012, 2:14 pm
by LuX
Coming along fine. Bit of a mess in my code, but already have some "smart" AI, enemies that shoot you, walls, new weapons. Stuff like that, oh and rotating images as well. I'll post a new update of it someday, now that I have a lot of time : -)

Re: Lesson 5 problem

Posted: June 4th, 2012, 2:37 pm
by chili
Sweet. I liked how the visibility / fog of war looked in one of the screenshots you posted a while back.