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

Pages: [1]
1
General / Re: Collision issue
« on: November 02, 2013, 01:25:14 pm »
Thanks and i found that peice of code on an example of a pong implementation in SFML.

2
General / Collision issue
« on: November 02, 2013, 10:31:36 am »
My collision isnt working. It doesnt register unless im moving and even then it doesn't register 6 times out of 10.

Code: [Select]
bool player::isCollidingSide(gameBall& gameball)
{

if(right > gameball.left|| left < gameball.right ||
            top > gameball.bottom || bottom < gameball.top)
        {
            return false;
        }
        return true;
}

the update function code
Code: [Select]
void game::update(float &deltatime)
{
sf::Vector2f movement(0.f, 0.f);

if (mIsMovingUp)
movement.y -= 0.01f;

if (mIsMovingDown)
movement.y += 0.01f;

player.rect.move(movement*playerspeed);
float factor=ballspeed*deltatime;
balll.ballShape.move(xvel*ballspeed, yvel*ballspeed);


if(player.isCollidingSide(balll))
{
xvel = -xvel;
std::cout<<"Collision x";
}


}


bonus question:  What does this function do?
Code: [Select]
void Ball::accelerate(Paddle PLAYER)
{
    currentSpeed.y = (ballObject.getGlobalBounds().top
                        + ballObject.getGlobalBounds().height / 2
                            - PLAYER.getRect().top
                                - PLAYER.getRect().height / 2) / 100;
}

3
Graphics / Events not responding
« on: October 12, 2013, 10:33:09 am »
Whenever i press a button that has an action assigned to it my window freezes.

source code for the game.cpp class:
                                 http://pastebin.com/bAPH8HaQ

Thank you.

Pages: [1]
anything