Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CodingNoob

Pages: [1]
1
SFML projects / Re: Breakout Game
« on: May 31, 2012, 04:56:06 pm »
Sorry Laurent, I would delete this but for some reason it doesn't let me.
Thanks everyone else who has commented. I learnt C++ last trimester(12 weeks) just have to learn SFML2.0 and I should be fine. :D

2
SFML projects / Breakout Game
« on: May 30, 2012, 02:32:54 pm »
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]

Pages: [1]