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

Pages: [1]
1
General / trying to get movement and collision working smoothly
« on: February 26, 2015, 05:34:07 am »
for the last while I have been trying to get my program to slide along walls. so if there is a vertical wall and I am pressing up and right to slide up(which I can get for one direction but when there is a horizontal wall and I am pressing up and right I go right through not slide to the right.
        sf::Vector2f tempLocation(player.getPosition().x, player.getPosition().y);
        player.update(elapsedTime);
        sf::Vector2f movedLocation(player.getPosition().x, player.getPosition().y);
       
        for(unsigned int i = 0; i < colMap.size(); i++)
        {
                for(unsigned int j = 0; j < colMap[i].size(); j++)
                {
                        if (colMap[i][j] == 1)
                        {
                                float Bottom, Top, Left, Right;
                                Bottom = i * tileSize + tileSize;
                                Top = i * tileSize;
                                Right = j * tileSize + tileSize;
                                Left = j * tileSize;
                                float pBottom, pTop, pRight, pLeft;
                                pBottom = player.getPosition().y + (player.getRadius() * 2);
                                pTop = player.getPosition().y;
                                pLeft = player.getPosition().x;
                                pRight = player.getPosition().x + (player.getRadius() * 2);

                                if(pLeft < Right && pRight > Left &&
                                        pTop < Bottom && pBottom > Top)
                                {      
                                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) ||
                                                sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                                        {
                                                player.setPosition(tempLocation.x, movedLocation.y);                   
                                        }
                                 }
                         }
                  }
           }
 

is there a easy way to get the other direction to detect and allow me to slide left or right, cause as it stands now I will slide up or down

the player.update()
void Player::update(const sf::Time& elapsedTime)
{
        // Move the player
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && !sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                circle.move(-moveSpeed * elapsedTime.asSeconds(), 0);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right) && !sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
                circle.move(moveSpeed * elapsedTime.asSeconds(), 0);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && !sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
                circle.move(0, -moveSpeed * elapsedTime.asSeconds());
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && !sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
                circle.move(0, moveSpeed * elapsedTime.asSeconds());
}

is there a easy way to get the other direction

2
General discussions / practice some SFML
« on: February 02, 2015, 01:33:54 am »
Looking for 1 to 3 people to try do casual small games. 1) to learn better C++ programming and 2) its fun with some people. I usually have a few hours a day and for next little bit will be after like 6:30 pm pacific standard time for the next few weeks. It would be like to maybe talk about a small concept then each design one and then compare and go from there. I would like to work with SFML. I am still learning my self so don't expect someone who knows it all. I just want to practice and get some knowledge. I have made a simple text based game before, was single player, but there was monsters that would move around and attack u, they would drop loot, u could pick it up change weapons armor etc(but text based) I am tying to see if still have a copy of it. It was all 1 .cpp file but now im trying to move into multiple files so if your around that point and just want to spend some time as a group please msg me and I can msg back with a Skype or u can leae me with a way to contact. thanks and hope to hear from u. speaking English should be first although I know a good bit of Spanish too.

 

Please reply or msg me if interested.

 

ps: if your still fairly new we can learn together, if your fairly experienced maybe you can teach some good habits.

3
Graphics / Re: Im doing the setup of SFML
« on: January 24, 2015, 07:37:11 pm »
thanks for the interest to help me, I found something similar and it had to do with my graphics drivers were not update. they should mention on there main install page with the code to make sure your graphics drivers are up todate.

4
Graphics / Im doing the setup of SFML[SOLVED]
« on: January 24, 2015, 12:06:12 am »
I Just did the setup of SFML and trying to run the code they give at the end of the setup 2.2 for visual studio. I have gone through and linked everything as it states tried running said I was missing the sfml-graphics-d-2.dll so I grabbed all the .dll files and moved them to my project folder, got past that part and asked for 2 more .dll's I went and got them and put them in my project folder but now when I try to run the program i get

"An unhandled exception of type 'System.AccessViolationException' occurred in sfml pratice.exe

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

i have figured that the problem is coming from the line: window.draw(shape); because if i comment it out the program works fine.

i can not seem to find anything about this on SFML. anyone else had this same problem?

btw the other 2 files it asked for were msvcp110d.dll and msvcr110d.dll

Pages: [1]
anything