hi chili,
I have problem with lesson 9 homework
the thing is that the square dosen't want to move
can you check my code?
game.cpp
#include "Game.h"
Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx ( hWnd ),
kbd( kServer ),
boxX( 200 ),
boxY( 100 ),
boxHeight( 150 ),
boxWidth( 150 )
{}
void Game::Go()
{
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}
void Game::ComposeFrame()
{
int y = boxY;
int x = boxX;
while( y < boxY + boxHeight )
{
for(x < boxX + boxWidth; x++ )
{
gfx.PutPixel( x,y,255,255,255 );
}
y++;
}
int speed = 5;
if(kbd.RightIsPressed())
{
x = x + speed;
}
if(kbd.LeftIsPressed())
{
x = x - speed;
}
if(kbd.DownIsPressed())
{
y = y + speed;
}
if(kbd.UpIsPressed())
{
y = y - speed;
}
}
game.h
#pragma once
#include "D3DGraphics.h"
#include "Keyboard.h"
class Game
{
public:
Game( HWND hWnd,const KeyboardServer& kServer );
void Go();
private:
void ComposeFrame();
/********************************/
/* User Functions */
// TODO: User functions go here
/********************************/
private:
D3DGraphics gfx;
KeyboardClient kbd;
/********************************/
/* User Variables */
int boxX;
int boxY;
int boxWidth;
int boxHeight;
/********************************/
};
can you tell me what thing I fucked up?
lesson 9 homework, help
Re: lesson 9 homework, help
You're updating x and y when you should be updating boxX and boxY.
Chili
-
- Posts: 50
- Joined: May 19th, 2012, 3:00 pm
Re: lesson 9 homework, help
thx, and when I will finish waching your tutorials, than is it possible to use your framework for making 3d games or only 2d?
Re: lesson 9 homework, help
I will eventually be covering 3D graphics. Whether you will be able to make 3D games depends on you bro.
Chili
-
- Posts: 50
- Joined: May 19th, 2012, 3:00 pm
Re: lesson 9 homework, help
ok thx,
so it's possible to make something similar game to minecraft using your framework
or do i have to use a different framework
and if you can make it than how long will it take about to make the basics of it?
so it's possible to make something similar game to minecraft using your framework
or do i have to use a different framework
and if you can make it than how long will it take about to make the basics of it?