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.


Topics - bumblecorn

Pages: [1]
1
General / [SOLVED]Can't record my game
« on: March 07, 2013, 06:04:56 pm »
I've tried 3 different screen recorders and none can record the game, so I am assuming that's not the problem. I can either only see the console window and the actual SFML window is invisible (even though you can see my mouse cursor moving around, the only indication of me playing the game) or I can see like the first frame of the game and then it's frozen. Why can't screen recorders pick up the SFML windows?

Here's my window if that's the issue:

sf::RenderWindow window;
window.create(sf::VideoMode::getDesktopMode(), "game", sf::Style::None);
window.setVerticalSyncEnabled(true);

I also tried setting the style to Fullscreen - nothing.

2
General / [SOLVED]Collision detection between objects stored in a vector
« on: February 24, 2013, 04:49:43 pm »
Feels like kind of a silly question, but here goes. I know how to do collision detection between rectangles and other basic shapes simply created from the sf::RectangleShape class. You define a FloatRect for each object and that's pretty much it i.e.:

int collisionEnemy (sf::RectangleShape &bullet, sf::RectangleShape &enemy)
{
    sf::FloatRect bulletRect = bullet.getGlobalBounds();
    sf::FloatRect enemyRect = enemy.getGlobalBounds();
    return bulletRect.intersects(enemyRect);
}

Unfortunately I have no clue how to do this for objects stored in vectors, I have a vector for my bullets and a vector for my enemies (with currently only one enemy stored in it).

I don't even know where to begin.

3
General / [SOLVED]Assigning a direction to bullets from a vector
« on: February 08, 2013, 07:29:32 pm »
I have multiple bullets spawning from a vector, as long as a button is pressed, but there's a little problem with the direction. The already fired bullets also change movement when the direction is changed.
Pseudo code, I don't have the project on me right now:

vector<ProjectileClass> bullets;

//this is in my main loop-------------
if (button is pressed)
                {
                        bullets.push_back(projectile); //projectile is the object created from the ProjectileClass
                        shooting();
                }

//the "shooting" function------------
int shooting()
{
//here I'm getting the direction
        movementX = getJoystickX
        movementY = getJoystickY
               
        return 0;
}

//this function is called later in the main loop to draw and move the bullets
int ShootMove()
{
        for (int i = 0; i < bullets.size(); ++i)
        {
                window.draw(bullets[i]);
                bullets[i].move(movementX/2, movementY/2);
        }
        return 0;
}


Now what I want to achieve is to have a constant stream of bullets fired into the direction the player object is pointing at. But as you can see, while the button is pressed the movementX/Y variables are updated on each loop, influencing the already fired bullets. Is there a way I can store the movement for each object spawned from the vector?


4
Graphics / Background image problems
« on: February 06, 2013, 07:08:11 pm »
I have an asteroids type game with a massive image for a background (6000x4000).  I have increased the area of the level by using two sf::Views, so you can move "outside" the screen area and it will track you until you reach the edge of the second View, hence the massive image.

Anyway, the problem is that there is some tear in the image when it's being updated, like a "ripple" going up the screen whenever the image is moving. This problem is only present when using the frame limiter function:

window.setFramerateLimit(60);

Without limiting the frame-rate there is no image tearing. Is this something I have to deal with, or is it an easy fix?

5
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

6
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]