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

Pages: [1]
1
Graphics / Re: Change movement direction?
« on: June 28, 2014, 02:14:27 pm »
Thank you very much!

 ;D

2
Graphics / Re: Change movement direction?
« on: June 24, 2014, 06:08:45 pm »
Hey guys!  :)

Thanks for all your expenditure! =)

I know that vectors are extremely important for game programming, so I think I´m going to deal with them. I hope I find a better way than this I used in my code example.

Making a little example a ball bouncing around would be really nice, but when there´s too much expenditure then of course you haven´t to do it for me.

Julian :D

3
Graphics / Re: Change movement direction?
« on: June 24, 2014, 05:44:40 pm »
Hi!  :)

This sounds logic, but unfortunately I don´t have any knowledge on vectors. In school we will have this topic  in about 1 year and on top of that I don´t really understand how SFML handles vectors.

Do you think it will help when I deal with vector mathematics? :)

Julian

4
Graphics / Change movement direction?
« on: June 24, 2014, 05:17:46 pm »
Hi! =)

I´m programming a little game where a ball flies through the window and when it hits the end of the window it shall change its direction. Here´s the code I´m using for this:

void Ball::update(float frametime)
{
        if (pSpriteB->getPosition().y >= 9)
        {
                pSpriteB->move(-400 * frametime, -400 * frametime);
        }
        else if (pSpriteB->getPosition().y <= 9)
        {
                pSpriteB->move(400 * frametime, 400 * frametime);
        }
}

But when the ball hits the window´s end, it just stops and vibrates a bit. What I thought was that the previous movement is still active and I have to end up this previous movement so that the new movement direction can be done without errors, but I didn´t find anything to end up a movement.

What shall I do? Why isn´t it moving correctly? Please help!  :D


Pages: [1]