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

Pages: 1 [2]
16
Window / Rotating object using analog stick on a game-pad.
« on: January 24, 2013, 05:04:59 pm »
I'm trying to make an Asteroids type game where you use the left stick to move around and the right stick to rotate and shoot in different directions.
I've got the left stick sorted out, but I can't figure out how to code the right stick for rotation. I want the object to be faced the same direction as the analog stick is pushed i.e. if I'm pushing the stick straight down, the rotation of the object would be set to 180 etc. The coordinates returned by the stick consist of two values, the X and Y axes, but rotation works in degrees which is one parameter, so I can't really use "setRotation" or "rotate"

I've created a very simple alternative that basically just uses the horizontal axis on the stick to add to the rotation:

if (rightStickX > 20)
{
        player.rotate(rightStickX / 99);

}

if (rightStickX < - 20)
{
        player.rotate(rightStickX / 99);

}

Can anyone set me on the right track here, or is this too complicated for a beginner? Or maybe I'm over-thinking this and it's really simple to do?

P.S. I'm using SFML 2.0 -RC

17
Window / Re: Right analog stick is not working. [SFML 2.0]
« on: January 23, 2013, 10:27:36 pm »
Oh I see, I'm trying to return values from another game-pad, that's not even there. And the other axis (Z, U, V, etc.) are for the other stick and the triggers? Well this was a waste of forum space, I do apologise. And thank you for setting me on the right track, I'm still a beginner in both C++ and SFML.

18
Window / Right analog stick is not working. [SFML 2.0]
« on: January 23, 2013, 10:14:56 pm »
I'm trying to make an Asteroids type game where you use the left stick to move around and the right stick to rotate and shoot in different directions.
I'm using a wired Xbox 360 game-pad, left analog stick works fine, returns 1 for all the axis, but the right one may as well not even be there. When it's pushed down it still works as a button, but it's as if it has no axis.

sf::Joystick::hasAxis(0, sf::Joystick::X);
//returns 1

sf::Joystick::hasAxis(1, sf::Joystick::X);
//returns 0

Am I missing something? Or is it a problem with SFML 2.0 itself?

Pages: 1 [2]
anything