Lesson 5 problem

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Tyas
Posts: 3
Joined: June 3rd, 2012, 12:33 pm

Lesson 5 problem

Post by Tyas » June 3rd, 2012, 12:37 pm

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 );
}

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Lesson 5 problem

Post by LuX » June 3rd, 2012, 12:51 pm

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.
ʕ •ᴥ•ʔ

Tyas
Posts: 3
Joined: June 3rd, 2012, 12:33 pm

Re: Lesson 5 problem

Post by Tyas » June 3rd, 2012, 1:01 pm

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!

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Lesson 5 problem

Post by chili » June 3rd, 2012, 1:23 pm

Hey LuX, how is your shooting demo coming? :)
Chili

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Lesson 5 problem

Post by LuX » June 3rd, 2012, 2:14 pm

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 : -)
ʕ •ᴥ•ʔ

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Lesson 5 problem

Post by chili » June 4th, 2012, 2:37 pm

Sweet. I liked how the visibility / fog of war looked in one of the screenshots you posted a while back.
Chili

Post Reply