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

Pages: [1]
1
SFML projects / Re: 'Tiled' Tile-map Loader
« on: July 22, 2013, 04:12:14 am »
I've decided to go with the last method you posted. I'm creating objects as placeholders for items. However, it would be nice to have a function to add an Object to the map. I know there is an addTile function, but it'd be much nicer to have the addObject function. Any chance that this would be a possibility in a future update?

2
SFML projects / Re: 'Tiled' Tile-map Loader
« on: July 16, 2013, 11:36:48 pm »
Okay great thanks.

I'm not very familiar to Tiled so sorry if these questions have obvious answers.

My goal is to be able to manipulate the loaded in Tiled Map. Be able to add new things (flowers, monsters) and destroy these things as well.

Is there a way to go about this? From what I can see I can delete Objects, but Objects don't have any images associated with them.

Let me know if you have any ideas on this, thanks!

3
General / Angle between two vectors
« on: July 16, 2013, 09:37:22 pm »
I have been trying out different methods all day to calculate the angle between 2 vectors. I've browsed countless forums and read way too many stackoverflow questions. No matter what method I implement I keep getting the same result.

The angle I'm getting is only good in the bottom right quadrant of the player, and is only exactly correct at 45 degrees.

I've tried the dot product way with acos, I've tried the atan2 method with delta X and delta Y. I just can't seem to get a working function.

The goal is to be able to aim a bullet from the player to the mouse.

Does anyone have a function that works to do this?

4
SFML projects / Re: 'Tiled' Tile-map Loader
« on: July 16, 2013, 04:21:41 pm »
I'm using window.mapPixelToCoords(sf::Mouse::getPosition(window)) to map world coordinates to map coordinates. Is this the best route to take?

5
Graphics / Re: VertexArray of points
« on: July 04, 2013, 12:50:28 am »
Ah sorry about that, pixelHeight is the same thing I just changed it to screenHeight for better readability in this post. I've added a cout statement there and the values for x,y, and size all make sense and from what I can see the array is being populated fine.

This code is encapsulated in a class function that I call from main.

I can't think of reason it just gives me a black screen since this code works fine on its own

6
Graphics / Re: VertexArray of points
« on: July 04, 2013, 12:44:13 am »
Yes I call clear(), then draw(), then display().

7
Graphics / VertexArray of points
« on: July 04, 2013, 12:28:10 am »
I am making a vertexArray of points to draw my map. Each point is a pixel on the screen.

    drawArray.setPrimitiveType(sf::Points);
    drawArray.resize((ScreenHeight * ScreenWidth));
    int size = 0;
    for(int x = 0; x < ScreenWidth; x++)
    {
        for(int y = 0; y < ScreenlHeight; y++)
        {
            if(MapVector[x][y].isPixel)
            {
                sf::Vector2f pixelPos(x,y);
                drawArray[size].color = sf::Color::Magenta;
                drawArray[size].position = pixelPos;
                size++;
            }
        }
    }
 


Then at the end of populating this vertexArray called "drawArray" I draw it to the screen just using window.draw(drawArray)

Any ideas on why this just gives me a black screen?

8
Graphics / Sprite masking with shader
« on: July 02, 2013, 03:20:02 am »
I have a tile map that I randomly generate using a vertex array. I have been wanting to add in destructible terrain, so I read http://en.sfml-dev.org/forums/index.php?topic=7427.15 which seemed promising. I've been messing around for a while trying to get a demo working, but can't seem to implement it correctly.

Could anyone give me the general flow of how to use RenderTexture and this Shader to change a map made from a vertexArray? Any hints in the right direction would be greatly appreciated.

Even a simple example without using a vertexArray would be helpful. Thank you.

Pages: [1]
anything