SFML community forums

Help => General => Topic started by: Father_Sloth on October 24, 2010, 09:10:40 pm

Title: A few Questions..
Post by: Father_Sloth on October 24, 2010, 09:10:40 pm
Hey

I'm making a top down zombie shooter, similar to uzf (i love that game btw). Now straight to the point:

1) How can I get the player sprite to face the mouse?

2) how can I get the Zombies to go towards the player?

3) How should I do the maps? Are their any editors that would work best for my needs (medium sized maps with collision and as the player moves, it scrolls.)

Sorry I'm nooby but i'd love to have some help. Thanks in advance.

- Simon
Title: A few Questions..
Post by: priomsrb on October 25, 2010, 02:06:29 am
Quote
1) How can I get the player sprite to face the mouse?

You need to first get the difference in position for the mouse and player. Then you arctan (tan inverse) the x/y of the position difference. Finally use sf::Sprite::SetRotation() to set the angle. Here is the code I use in uzf:

Code: [Select]
void Player::onUpdate() {
    Input *input = Input::getInstance();

    sf::Vector2f mouseToPlayer = input->getMousePosition() - getPosition();

    float facingAngle = atan(mouseToPlayer.x/mouseToPlayer.y);

    if(mouseToPlayer.x == 0 && mouseToPlayer.y == 0)
        facingAngle = 0;

    facingAngle *= 180/3.14159; // Convert to degrees

    // atan() returns an angle between 0-180 therefore it needs an offset of 180
    // when it is in the negative-Y quadrants
    if(mouseToPlayer.y >= 0) {
        facingAngle += 180;
    }

    setAngle(facingAngle);
    ...



Quote
2) how can I get the Zombies to go towards the player?


This is more trickier.

If you don't have any walls and obstacles, then you can make the zombies head straight for the player. Again using some simple maths you can figure out what the x and y speed of the zombie needs to be.

If you have walls however then you will need to do some pathfinding. Try looking up A* (a star) path finding. I used the micropather library instead of writing my own A* code. It does most of the work for you but it isn't fully straightforward.

This was probably the trickiest part of the game for me to code. There were issues like unit and wall sizes not having the same grid size that took me a while to find a workaround for.

Quote
3) How should I do the maps? Are their any editors that would work best for my needs (medium sized maps with collision and as the player moves, it scrolls.)


For this you have 2 choices: Tile-based map editors, and vector based map editors.

Tile-based map editors are the easiest to use but also the most inflexible as everything is based on the grid size. Most of them export to easy to parse files and so the code to load maps is simpler.

For UZF I used Inkscape, a vector based editor. Inkscape is actually a generic vector editing program but you can still use it to make game maps. It is the most flexible option as it has things like polygons, layers and more advanced functionality. You can also use the description fields of shapes to add game related object information. However the .svg file format is in xml and is quite complicated. So I only implemented a very basic implementation that only handles rectangles with no rotation.

Both types of map editors support medium sized maps and collision. Scrolling is something that you have to code yourself. Thankfully SFML's View classes make scrolling quite simple.


Some parts of the game can be tricky but the more you code the better you get :). Good luck with your project.
Title: A few Questions..
Post by: Father_Sloth on October 28, 2010, 03:57:26 pm
Thanks loads. having you reply has been awesome.

Are their any places you specifically learnt best from I am new to game programming but alright with c++ so are their any places that teach sfml (except the website because i don't find them too helpful) that I should try out?

Thanks loads.

Simon
Title: A few Questions..
Post by: Tank on October 28, 2010, 04:24:11 pm
If you don't find the website and the docs useful, I guess you're not looking for how to learn SFML, but how to learn (game) programming in general. The questions you asked in the initial post have less to do with SFML at all, by the way.
Title: A few Questions..
Post by: Father_Sloth on October 28, 2010, 06:16:14 pm
it's just I know what I want to do, and what concepts will be used now but I don't know the actual commands for them. Could you help?

For example one thing I couldn't find was the structure of classes. How should I go about this? Before I was getting compile failures.

Sorry Tank I didn't mean to be so nooby.
Title: A few Questions..
Post by: Tank on October 28, 2010, 07:54:06 pm
Classes documentation can be found here for SFML 1.6: http://sfml-dev.org/documentation/1.6/

It's no problem to be new, but it's sometimes a problem to answer a question when it's similar to "How do I write a strategy game?" ;) This is no offense, don't get me wrong.

Especially question 4 is a bit like that. SFML isn't a game maker but a library to get access to your multimedia hardware (with some utility and helper classes that make things easier). So a question like "How do I create a map?" is just to general to be answered in a forum. What kind of game do you create? How shall the map look like? What have you done so far?

The trick is to be as precise as possible. :)
Title: A few Questions..
Post by: Father_Sloth on October 28, 2010, 11:15:33 pm
ok thanks tank. So is there a trick or fast way to add collision to walls on a map with out drawing each wall as a sprite? I want to make map's indoors but with an outside view as well (just to give it a tad more realism). Also I'm all of a sudden struggling to compile. I'm following all the details of the tutorial precisely (btw I'm using xcode on a mac). But every time I build and run, even the just the code that it provides in the template it says loads of errors and doesn't start.

heres a screenshot:

(http://i1105.photobucket.com/albums/h349/Father_Sloth/Screenshot2010-10-28at221013.png)
Title: A few Questions..
Post by: priomsrb on October 29, 2010, 05:57:32 am
Hey Father_Sloth

It seems like you are new to game programming. My suggestion is to first make a very simple game.

Whenever I learn a new framework or library I try to make a pong game. Pong games are good because they are simple to code and teach you how to deal with sprites, collisions, controls, sounds, etc. After you finish that you'll get a good understanding of the basics and can move on to your next project.

I learnt SFML from the offical tutorials. In fact I think the tutorials are one of big strengths of SFML because they are so simple yet so comprehensive.

As for your errors, it seems that you have not specified the SFML include/ directory in your include path.
Title: A few Questions..
Post by: Father_Sloth on October 29, 2010, 10:59:54 am
Thank you very much Priomsrb for that. I will do that today and post my results later. Also I included al the headers but am I missing one? I did this

(http://i1105.photobucket.com/albums/h349/Father_Sloth/Screenshot2010-10-29at095618.png)

are there any extra's I should include?

Simon
Title: A few Questions..
Post by: priomsrb on October 29, 2010, 02:56:37 pm
You have included the right headers but the compiler can't find them. So you'll need to add SFML's include/ directory to your search path. I haven't used xpath before but this page gives some information on how to add directories to your search path: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/XcodeProjectManagement/210-Building_Products/building.html#//apple_ref/doc/uid/TP40002693-SW23
Title: A few Questions..
Post by: Father_Sloth on October 29, 2010, 03:45:45 pm
So do I need to add it to my Header Search Path, Library Path or Framework Path?

Simon

p.s. also just a little question about sfml. I am reading the tutorials and I keep on seeing this " .f " - what does it mean?
Title: A few Questions..
Post by: priomsrb on October 29, 2010, 07:27:41 pm
You'll need to add it to your header search path.

Quote
p.s. also just a little question about sfml. I am reading the tutorials and I keep on seeing this " .f " - what does it mean?


I didn't notice anything like that last time I checked. Can you give an example?
Title: A few Questions..
Post by: darekg11 on October 29, 2010, 09:09:32 pm
Maybe he means float mark or whatever is called like:
303.f ?
Title: A few Questions..
Post by: Father_Sloth on October 29, 2010, 09:46:47 pm
Well in the example source code this keeps popping up

Code: [Select]
const float Speed = 50.f;
float Left = 0.f;
float Top  = 0.f;


and I'm just stumped on what ' .f ' is. It's probably something obvious and I'm just being an idiot :roll: .

Simon

p.s. I haven't figured out the Xcode compile error but I think I'm getting to bottom of it on this new thread I started : http://www.sfml-dev.org/forum/viewtopic.php?t=3447
Title: A few Questions..
Post by: priomsrb on October 30, 2010, 12:31:40 am
Code: [Select]
float Left = 0.f;

The ".f" explicitly marks a value as a float instead of a double. For more info see here: http://stackoverflow.com/questions/2391818/f-after-number-float-in-objective-c-c
Title: A few Questions..
Post by: Father_Sloth on October 30, 2010, 09:18:26 pm
thanks. I'm trying currently on the pong collision and I want to do something like this:

Code: [Select]
bool collison;

int angle, response_angle;

bool collision = false;

if (bool collision = true)
{
// Detect what angle it hit the boundary.

???

// Send the ball in the direction of the bounce.

Sprite.Move( //get it to go in response_angle direction.

}



Now that's just me trying to explain how I kinda guess the formats gonna be. Just so you don't think i'm being lazy and stuff.... :D

Heres a diagram:

(http://i1105.photobucket.com/albums/h349/Father_Sloth/collisiondetectiondiagram.png)

Simon
Title: A few Questions..
Post by: Canadadry on October 30, 2010, 10:20:51 pm
If the wall is horizontal or vertical, you just have to change a signe in your deplacement vector. Else you will have tu you dot product
Title: A few Questions..
Post by: Father_Sloth on October 30, 2010, 10:27:42 pm
sorry i didn't understand what you said last in that bit but could you write an example code? just so I get wat your saying.
Title: A few Questions..
Post by: priomsrb on October 31, 2010, 01:10:56 am
Actually it is very simple. If the ball hits a horizontal wall (like the ground) you just reverse it's y-velocity. And if the ball hits a vertical wall you reverse it's x-velocity.

Unless you have walls that are angled in different directions, you don't need to do calculations using collision angles and stuff.
Title: A few Questions..
Post by: Disch on October 31, 2010, 05:57:10 am
you can use some linear algebra for this.

given two vectors A and B:

The dot product (dot(A,B)) = (A.x * B.x) + (A.y * B.y)
Perpendicular dot product (perpdot(A,B)) = (A.y * B.x) - (A.x * B.y)

The neat thing is, dot(A,B) is equal to sin(t)*length(A)*length(B)
and perpdot(A,B) is equal to cos(t)*length(A)*length(B)

(where 't' is the angle between the two vectors... so if the vectors are parallel, PerpDot is zero for example)

This means you can easily get the sin and cos of the impact angle between two lines if you have unit vectors (lines with a length of 1)


Knowing the impact angle, it's just a matter of rotating the "wall" line the opposite way at the same angle.  You can do this with a simple rotation matrix.


But don't let the heavy math jargon deceive you.  It's not really that complicated.  Here's some [untested!!!] code that I'm pretty sure will have the desired effect:

Code: [Select]

// first, some helper functions that no 2d game should be without....

// get's the length of a vector
float GetLength(const sf::Vector2f& v)
{
  return sqrt( (v.x*v.x) + (v.y*v.y) );
}

// dot product
float Dot(const sf::Vector2f& A, const sf::Vector2f& B)
{
  return (A.x*B.x) + (A.y*B.y);
}

// perp dot
float PerpDot(const sf::Vector2f& A, const sf::Vector2f& B)
{
  return (A.y*B.x) - (A.x*B.y);
}

//======================
//  now that those are out of the way....

sf::Vector2f BounceAngle(sf::Vector2f move,sf::Vector2f wall)
{
  // 'move' is how much the object is moving
  // 'wall' is the orientation of the wall
  //  (ie:  wall_point_B - wall_point_A)

  // first find the velocity that the ball is moving at
  float velocity = GetLength(move);

  // then make both move and wall unit vectors
  move /= velocity;
  wall /= GetLength(wall);

  // get the sin(angle) and cos(angle)
  float sintheta = PerpDot(move,wall);
  float costheta = Dot(move,wall);

  // invert the sine so that we rotate in opposite direction
  sintheta = -sintheta;

  // rotate the wall in the opposite direction with a simple rotation matrix
  sf::Vector2f r;
  r.x = (wall.x * costheta) - (wall.y * sintheta);
  r.y = (wall.x * sintheta) + (wall.y * costheta);

  // scale so it has the same velocity as move
  return r * velocity;
}


And there you have it.  BounceAngle will return a vector pointing to the direction the object it to bounce towards -- although it will be a unit vector, so multiply it by whatever speed you want to move the object at.


And again note this code is untested so I can't say for sure it will work without tweaking.  The concept is solid, I just might be off on my math somewheres.


EDIT:  Also, "BounceAngle" is poorly named since it doesn't return an angle.  But whatever.  It's late.

EDIT2:  Changed code so that the velocity is maintained.


EDIT3:  But holy crap this is for pong?  Yeah then this is all overkill.  Just invert the X or Y magnitude as someone else suggested.
Title: A few Questions..
Post by: Father_Sloth on October 31, 2010, 11:18:04 am
Thank you all very much :D.

Yes this is for pong but pong is just for me getting used to the library (as Priomsrb suggested). Immediatly after this I will implement this code into my ultimate project (for the moment at least :D ) which as you can see on page one will be a zombie top down shooter. I'm gonna keep this thread open until it's done and believe me will be asking questions throughout. Thank you for your patience with me and keep on Rocking.

Simon

Side note: Should I
1) Make the walls in like paint and just load them as a sprite.
2) Construct them using a simple shape made by SFML.
3) Do Number 1 but load them as an Image?
Title: A few Questions..
Post by: priomsrb on October 31, 2010, 11:29:57 am
Quote
Side note: Should I
1) Make the walls in like paint and just load them as a sprite.
2) Construct them using a simple shape made by SFML.
3) Do Number 1 but load them as an Image?


Do number 1. You will use sprites in most typical games so it's best to get use to them.
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: priomsrb on October 31, 2010, 12:34:41 pm
You could do it that way. Or you could check the ball's x position. If the x position is less than a certain value, say 0, then player 2 should get a point. If the x position is higher than a value, say 640(or whatever your game width is), then player 1 should get a point.
Title: A few Questions..
Post by: Father_Sloth 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.
Title: A few Questions..
Post by: Father_Sloth on October 31, 2010, 02:54:48 pm
hello? I'd like to get this project finished today ..
Title: A few Questions..
Post by: Canadadry on October 31, 2010, 05:02:32 pm
Quote from: "Father_Sloth"
i can't seem to find out how to spawn objects.


I don't get it, what do you wanna do ?
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Canadadry on October 31, 2010, 07:19:28 pm
Okay i get your problem. Your logic is wrong, there is some sophisticated and long way but i'll try to explain it to you.  You must have several main loop. First one which draw you window for selecting game or else. Then when use press space for example you jump into another main loop for playing the game.

Something like that
Code: [Select]

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(640, 480), "Pong");
   
   sf::Sprite backgroun; //a backgroun
   [..] //some other thing to make it your taste
   
    // 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(user press space)
{
play(App);
}
         
        }
       
      App.Clear();
      App.Draw(sprite);
      App.Display();
     
   }
   return EXIT_SUCCESS;
}

void play()
{
// creating your sprite for the game
sf::Sprite ball;
[…]

while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
if(user win or loose)
{
return;
}
        }
       
      App.Clear();
      App.Draw(ball);
      App.Display();
   }
}


This this the simpliest way of doing that.

For Xcode you have to drag your data on the resources folder of your project. Normally they will be copied on the resources folder of your App, which must be (if i'm not mistaken) the working dir. I remember reading on the change log that ceylo has change it recently. There is one easy way to know where the working dir is, you should create an new file like "fopen("test","w");" then finding this file. I remember one other thing, last time i checked the working dir by launching manually the app and by lauching in xcode in not the same.
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Canadadry on October 31, 2010, 08:12:20 pm
You have to think about your main loop, what does it do, in what order what for. The question you is basic question of a program design.

Fisrt, the event loop, that will allow you to know what user had done. You could simplify your program by using Input.

Then there is the update phase. depending on time and user input you will trying to move object and testing collision then removing them according to it.

And finally draw you object.

The best way you have to succeed, is trying failling and trying and failling.. Until you succeed. Even if you don't really know what to do, try... You also should read code from other people, start with the sfml's sample, especially the pong one. You could also read the wiki.
Title: A few Questions..
Post by: Father_Sloth on October 31, 2010, 08:19:40 pm
Thanks ALOT!!!!

Simon

p.s. I genuinely thank you as much as I can... Thanks  :D
Title: A few Questions..
Post by: priomsrb on October 31, 2010, 09:34:41 pm
@Disch

Lol. Haha. Yeah it's only for pong. But thanks for the explanation though. I might find it handy in the future.

@Father_Sloth

Hope everything is going well. Just some tips:

- If you get stuck on some logic or something, try using pen and paper. Don't worry if you can't think of a solution immediately. Problem solving takes time.

- If you get stuck between a few choices on how to do something (like how to detect scores), just try one way and see if it works. Making mistakes and trial and error are good ways to learn.

- Build up incrementally. Don't worry about spacebar and scores yet. First try to get a ball moving on the screen. Then add paddles that can move. Then add collisions, etc. This will make things easier and much less daunting.
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: priomsrb on October 31, 2010, 11:04:21 pm
Hehe nice. I prefer paper actually since my ideas stay there forever. Also I don't have to rub it clear every so often ;)

If a function isn't in scope then declare it at the top. For example:

Code: [Select]
void myFunction(); // This is the declaration

int main() {
    ...
    myFunction(); // We can call our function here now
    ...
}

void myFunction() {
     // Code for myFunction goes here
     ...
}



Quote
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.

I'm not sure what you mean by this. I'd make some variables for player and enemy score. Then if player scores then increment his score.

Btw I won't be able to reply as much now because my exams are starting. In fact my first one starts in 3 hours ;)
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Canadadry on October 31, 2010, 11:51:34 pm
You declare your function has "void play(void)" but you called a "void play(sf::RenderWindow)"
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Father_Sloth 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):

(http://i1105.photobucket.com/albums/h349/Father_Sloth/Screenshot2010-11-06at141444.png)

Here is when I try to use it:

(http://i1105.photobucket.com/albums/h349/Father_Sloth/Screenshot2010-11-06at141500.png)


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

Simon
Title: A few Questions..
Post by: darekg11 on November 06, 2010, 03:35:26 pm
Man, You should read book before programming, especially if You want to program games.
Title: A few Questions..
Post by: Canadadry on November 06, 2010, 03:45:19 pm
it's a bit rough but he's right. You really need to learn some basics. Like how to declare a function. Especially for this problem, you already ask and i already answered it.

I don't know what to tell you either learn C, you could start here (http://einstein.drexel.edu/courses/Comp_Phys/General/C_basics/#functions).
Title: A few Questions..
Post by: Father_Sloth 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
Title: A few Questions..
Post by: Groogy on November 06, 2010, 04:41:18 pm
They would... It's very simple.

You've for instance declared a prototype for a function that doesn't seem to exist and you are trying to pass an argument to it even though it doesn't take any arguments.

This is basic syntax. You should practice more on just writing C++ code before trying to wrestle with a library like SFML.
Title: A few Questions..
Post by: Canadadry on November 06, 2010, 05:47:29 pm
Quote from: "Father_Sloth"
I have read the Michael Dawson C++ through game programming and also a few websites on c++ functions and none of them answered it.


It's because it's too looking too high, your error is really really basic if you have read my 2 post you will have found your answer.

Quote from: "mooglwy"
You declare your function has "void play(void)" but you called a "void play(sf::RenderWindow)"


Isn't that clear enough ? What do you want more ? We can't program for you. You will have to learn C and C++ by yourself before.

I also strongly advise you read the link i gave you. That's my last post for this problem, you've got all the card you need. Think be yourself.  :wink: