1
General discussions / Can somebody help me understand this code?
« on: July 16, 2011, 05:33:01 am »
Oh ok then, Sorry I'm kinda new to the forum didn't know.
To be honest i'm lost with the entire paddle class.
1)
2)
3)
4
5)
Those are the parts where i'm lost, I'm going back and fort by the tutorial section, but i still can't seem to understand their use right in this program.
Can u help me to understand those parts.[/quote]
To be honest i'm lost with the entire paddle class.
1)
Code: [Select]
Paddle(const Player& play) :
player(play)
2)
Code: [Select]
rect.SetPosition(ScreenWidth - 10, rect.GetPosition().y);
3)
Code: [Select]
void Move(const sf::RenderWindow& win)
4
Code: [Select]
)const float delta = Speed * win.GetFrameTime();
//Collision with walls
if(rect.GetPosition().y < 0)
rect.SetPosition(rect.GetPosition().x, 0);
if(rect.GetPosition().y > ScreenHeight - 100)
rect.SetPosition(rect.GetPosition().x, ScreenHeight - 100);
5)
Code: [Select]
sf::Vector2f Position() const
{
return rect.GetPosition();
}
private:
sf::Shape rect;
Player player;
enum { Speed = 200 };
};
Those are the parts where i'm lost, I'm going back and fort by the tutorial section, but i still can't seem to understand their use right in this program.
Can u help me to understand those parts.[/quote]