Hi. I am working on a project for my College assignment. It is due in 6 weeks, which would roughly be the 6th of July. I am pretty new to programming, I am using C++ and SFML 2.0. This is basically the game that i will be making if you haven't played it
http://www.play.vg/games/10-Breakout.html minus a few of the features such as the changing size of the paddle I will not include unless I have time too. I will probably need a fair bit of help. I already having one issue where I am creating the ball but it is not printing to the screen. I assumed that window.draw(ball) would make it appear on the screen but it does not.
This is the code I have so far
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
int main()
{
sf::Vector2f BallSize(4,4);
//Create ball
sf::RectangleShape Ball;
Ball.setSize(BallSize);
Ball.setFillColor(sf::Color::Yellow);
Ball.setOutlineColor(sf::Color::Blue);
float x = 50;
float y = 50;
Ball.setOrigin(x,y);
//Create Blank window
sf::RenderWindow window(sf::VideoMode(1024,720), "Breakout");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed){
window.close();}
if (event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Escape)
{ window.close();}
}
window.clear(sf::Color::Red);
window.draw(Ball); // Shouldn't this make the ball appear???
window.display();
}
return 0;
}
I will be splitting it up into separate files obviously just I want to get the simple aspects of the game done before I do that.
Any help will be appreciated. Thanks.
[attachment deleted by admin]