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

Pages: [1]
1
Graphics / Re: Rotation rectangle around object
« on: April 26, 2022, 06:26:51 pm »
Thx for the link :), Ye i tried to calculate it and just solve it with trig math without success.

 I also tried to use transform and rotate the transform around the center and then apply the transform to the player in order to not have to change and rechange the origin of the player all the time.


EDIT:
Solved the rotation part thanks to your link :)

2
Graphics / Rotation rectangle around object
« on: April 26, 2022, 02:25:15 pm »
Hey guys, im trying to make a game where you can controll a player around a object.

Key press A: Rotates counter clockwise.
Key press D: Rotates clockwise.
Key press W: Moves player away from centerobject, (opposite direction).
Key press S: Moves player towards centerobject.

Im having trouble getting the moment for W and S to work as i want it to...

For rotation i did :
    globe.setOrigin(125.00f, 125.00f);
    globe.setPosition(window.getSize().x /2.00f, window.getSize().y / 2.00f);
    globe.setTexture(&globe_texture);
   
    player.setOrigin(globe.getOrigin().x, globe.getOrigin().y);      // Player get the same central as the globe.
    player.setPosition(globe.getPosition().x, globe.getPosition().y);

For A and D:
        if (Keyboard::isKeyPressed(Keyboard::Key::A))
            {
                counter = 0;
                player.rotate(-0.5f);    // Counter Clockwise.
            }
        if (Keyboard::isKeyPressed(Keyboard::Key:: D))
            {
                counter = 0;
                player.rotate(0.5f);    // Clockwise.
            }

Thx! :)





Pages: [1]