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

Pages: [1]
1
General / Collision detection with an image.
« on: April 01, 2015, 06:13:29 pm »
I have a "spike" object which I want to implement into my game, which has:
  • A particular image, which looks something like this:
  • A position
  • And a rotation
The position and rotation can change dynamically.

I can get the thing to display, but I don't know how to do collision detection. I was thinking of either creating some sort of shape around the object upon initialization and somehow collision detect with that, or use pixel perfect collision.

However I don't know which one is better, or if there is another solution, and in any case I dont know how to achieve those things. I have only dealth with rectangles and circles when it comes to collision detection in the past.

Can someone give me a hand?

2
General / Save to Image not working?
« on: March 22, 2015, 01:07:56 am »
I have written the following code:


    string imageName = "levelImage";   
    sf::RenderTexture r;
    for(vector<GameObject*>::const_iterator i = gameObjects.begin(); i != gameObjects.end(); ++i) {
        (*i)->render(r);
    }
    r.getTexture().copyToImage().saveToFile(imageName);

Which should create an image of all my gameObjects. However, I am getting the error message: "failed to save image: "levelImage.png"" I am almost certain the problem is not within the for loop btw.

3
General / Drawing onto PNG instead of onto window using SFML
« on: March 21, 2015, 10:51:30 pm »
I am creating a platformer game using SFML, and my "Level Size" is a lot larger than my window size. So I am using sf::View to move around the view while I move.

What I do every frame is:
  • I draw everything onto the window
  • Set the view to be part of the window
  • Run window.display()
  • Run window.clear()
What I want to do now, however, is to draw each element onto an image (.png) file. A couple details:
  • This image should be the same size as my "Level Size"
  • I don't want it zoomed in anyway - it should not be affected by my current window or view
  • Finally there are transparent parts of the image, because I have not drawn them onto my canvas. I do not want these black in my image, but rather transparent
How can I achieve this? Ideally I would like to run a function like this: exportPNG(string filename, level).
Thanks a lot!

4
General / SFML 2.2 Error involving glew (and maybe opengl)
« on: March 13, 2015, 12:03:03 am »
I recently upgraded to SFML 2.2, and after this my code stop running.
I get these error messages now, and I am assuming it is related to glew (and maybe opengl)
(click to show/hide)
Nothing else has changed since I updated

5
General / Repeating a texture when using a tileset
« on: March 03, 2015, 11:15:38 pm »
For my basic "obstacle" object, I have sprites which have a width and height which is larger than those of the textures they are using. In order fix this, I use texture.setRepeated(true). However I want to use a tileset such as this one when I have multiple textures, using the sprite.setTextureRect() function in order to select the right texture. At this point, I can no longer have a repeating texture. How can I fix this issue, such that I can having a repeating texture for a sprite, whilst using a tileset and the setTextureRect() function SFML provides?

Pages: [1]
anything