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.

Topics - OrientatedCookie

Pages: [1]
Graphics / How to use bounding boxes and points?
« on: May 01, 2015, 11:54:19 pm »
I don't understand the syntax, please correct me. I want to check if a sprite contains a point. and YeS I have read the forums and looked on the wiki.

sf::RectangleShape sprite1box = sprite1.getGlobalBounds();
sf::Vector2f point = (-50, -20);
if (sprite1box.contains(point))


Graphics / How to 'get distance' between two entities?
« on: May 01, 2015, 05:50:19 pm »
Hello, can anyone give me some advice or point me in the right direction on how to get the distance between two sprites? What I want is to get the difference between two sprite's global position. I looked through the documentation and forums, but had no luck. I tried to do this but honestly have little idea:
sf::RectangleShape spritebox = sprite.getGlobalbounds();
sf::RectangleShape sprite2box = sprite2.getGlobalBounds();

if (spritebox < sprite2box)


Window / Detect if number has been pressed?
« on: April 24, 2015, 05:19:12 pm »
How do I check if a letter is pressed down? I try to do it with if
but it says it expected an identifier. How can I do this?

Window / sf::Keyboard question
« on: April 23, 2015, 10:13:09 pm »
I am making an app that need keyboard input, and I need it so when you press a key it 'permantley' makes a sprite appear, not just while the key is pressed. Not sure how to do this. And yes I have read the tutorials and looked for other questions like this, but it says sf::keyboard has only one function which isKeyPressed. Here is the bit of code
if (sf::Keyboard:IsKeyPressed(sf::Keyboard::S))
//need the sprite to draw here if the key has been pressed once

Graphics / Sprite movement help
« on: April 17, 2015, 03:53:44 pm »
I'm currently making a classic ping pong game, but I don't know what the code/syntax is for if a sprite contacts another sprite, if you know what I mean. I thought I could make an if statement that checks if the ball is touching the rectangle or something like that, and then make it go towards somewhere.  Can anyone help me with this, or what other way could I do it?  :D

Audio / sf::sound won't play .ogg file
« on: April 17, 2015, 11:47:15 am »
I am trying to play an .ogg file in SFML, I have all the DLLs and the libraries etc, but for some reason nothing plays when I start the code.  I have read the tutorials and have looked around a bit to see if I could fix it myself, but had no avail. I think it might have something to do with the buffer in the wrong place, but not sure. Furthermore the window freezes when opened, don't know what is wrong. Any ideas?

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>

int main()
        sf::Window window(sf::VideoMode(800, 600), "My window");

        sf::SoundBuffer buffer;
        sf::Sound sound;

        while (window.isOpen())


Pages: [1]