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 - Father_Sloth

Pages: 1 [2] 3 4
16
General / A few Questions..
« on: November 06, 2010, 04:08:54 pm »
Hey

I have read the Michael Dawson C++ through game programming and also a few websites on c++ functions and none of them answered it.

Just saying

Simon

17
General / A few Questions..
« on: November 06, 2010, 03:20:28 pm »
Hey Guys

Haven't Posted in a while, but I've still got this function problem. I keep on getting the same error on the play function mooglwy suggested.


Here is when I try to declare it (In the exact place mooglwy suggested):



Here is when I try to use it:




Thanks ever so much. I've tried every thing I can think of and after scouring the internet nothing has helped.

Simon

18
SFML website / Improve the search please?
« on: November 01, 2010, 06:19:43 pm »
maybe my criteria is too broad but it just seems like the results aren't as specific to the criteria.

Simon

19
General / A few Questions..
« on: November 01, 2010, 05:42:38 pm »
even with the syntax correction it's reads - " error: too many arguments to function 'void play()' "

Simon

20
General / A few Questions..
« on: October 31, 2010, 11:12:23 pm »
Sorry bout that, it's 10pm in the uk  :D . Thanks for that I think I've got it sorted though, but I did the declaration thing before and:

Code: [Select]
void play();


returns: "too many arguments to function 'void play()"

Code: [Select]
void play(App);


returns: "Variable or field 'void' declared void" - well duh you stupid compiler!

Thanks and Good Luck on the exam

Simon

21
SFML website / Improve the search please?
« on: October 31, 2010, 11:04:34 pm »
Hey

I was wondering if you could improve the search, whenever I search things it comes up with the same results. I'm not offering a solution, merely expressing my views :D .

Thanks for reading quite a pointless topic  :roll: .

Simon

22
General / A few Questions..
« on: October 31, 2010, 10:15:51 pm »
Thanks Priomsrb for your real interest. You can't believe me how much paper I've gone through in the last week. Luckily I'm getting a whiteboard soon  :P .

So could you help me logically. Mooglwy helped loads but I still don't know a few things that i'm stumped on. first of how do I declare a function. It say's I have not declared it in the scope which is true - because i dont know how.

Also where does player + enemy score go. I've finally got a scoring system that i'm pleased with but i don't know where to put it. Would I be correct in thinking that it would be best in the while loop.

Thanks Priomsrb.

Simon

23
General / A few Questions..
« on: October 31, 2010, 08:19:40 pm »
Thanks ALOT!!!!

Simon

p.s. I genuinely thank you as much as I can... Thanks  :D

24
General / A few Questions..
« on: October 31, 2010, 07:53:29 pm »
So were would:

1) Ball movement
2) Enemy Logic
3) Player Movement
4) Collision
5) Detecting Whether it scored or not
6) also I see you do not declare the sprite's before drawing them, or is that me misreading it?

Go?

Thanks - could I have a reply in the next hour

Thank you ever so much

Simon

25
Graphics / Graphic Help Needed
« on: October 31, 2010, 06:24:52 pm »
Hey

In my Game all that is displayed is a white window. Could it be to do with my background?

Thanks

Simon

p.s. If i need to provide the code I'll post - just didn't want to bug up the thread.

26
General / A few Questions..
« on: October 31, 2010, 05:09:05 pm »
Code: [Select]

// Headers
#include <SFML/Graphics.hpp>

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(640, 480), "Pong");

bool playing;
float Width, Height;

// Load image.
    sf::Image BackgroundImage, BallImage, BoundaryImage, BatImage;
    if (!BackgroundImage.LoadFromFile("Background.bmp") ||
        !BallImage.LoadFromFile("Ball.bmp") ||
!BoundaryImage.LoadFromFile("Boundary.bmp") ||
!BatImage.LoadFromFile("Bat.bmp"))


    {
return EXIT_FAILURE;
    }


// Create the sprites of the background, the paddles and the ball
    sf::Sprite Background(BackgroundImage);
    sf::Sprite LeftPaddle(BatImage);
    sf::Sprite RightPaddle(BatImage);
    sf::Sprite Ball(BallImage);
sf::Sprite BoundaryTop(BoundaryImage);
sf::Sprite BoundaryBot(BoundaryImage);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();


        }

if (Spawn == True)
{

// Spawn
Background.SetPosition(0.f, 0.f);
Ball.SetPosition(400.f, 300.f);
LeftPaddle.SetPosition(10.f, 300.f);
RightPaddle.SetPosition(760.f, 300.f);
BoundaryTop.SetPosition(10.f, 1.f);
BoundaryBot.SetPosition(10.f, 789.f)
}


if (playing)

{
// Draw Objects
App.Draw(Background);
        App.Draw(LeftPaddle);
        App.Draw(RightPaddle);
        App.Draw(Ball);
App.Draw(BoundaryTop);
App.Draw(BoundaryBot);

// Display Objects on Screen
App.Display();

}

    return EXIT_SUCCESS;
}
}


Please I'm so confused with what code should go where and i what loops.

I want it to go: open game, spawn objects, press spacebar, game starts, if a player scores, +1 to score, when a players score reaches 10 game ends. Once player has scored respawn again.

Simon

27
General / A few Questions..
« on: October 31, 2010, 05:08:02 pm »
ahh thank you for replying. When I spawn objects a window pops up momentarily and then closes. Is there any way to keep it open, am I doing anything? I worked out earlier with help from the ever helpful Laurent that it can't find my Graphics. You have xcode - how can I link them?

Simon

28
General / A few Questions..
« on: October 31, 2010, 02:54:48 pm »
hello? I'd like to get this project finished today ..

29
General / A few Questions..
« on: October 31, 2010, 01:09:16 pm »
ahh thanks that's easier. also how do i get the ball to move from spawn/bounce off the players bat. should I just get a random number from a range and jut set that as the x or y of the ball? thanks a lot mate.

Simon

p.s. quick little note - i can't seem to find out how to spawn objects. I've read over the class of Sf:: sprite and it only mentions setPosition which I don't know how to use. Also where should I spawn it. I don't know where it would go without constantly resetting the images - creating a infinite loop.

30
General / A few Questions..
« on: October 31, 2010, 12:24:54 pm »
Also I'm stumped for what the scoring system should be. I want it to be like the typical pong where if you hit the ball behind the bat the opposite player gets +1 to his score. How would I do this. Maybe creating the horizontal boundaries vertical and instead of collision say if they ball and wall collide the opposite players score +1. Is there an easier route?

Simon

Pages: 1 [2] 3 4
anything