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

Pages: [1]
1
General / Help making multiple objects
« on: June 29, 2013, 01:29:37 pm »
Hi, i'm new to SFML 2.0, and i would like to get some advice in making multiple shapes. I have tried to store them into an array using a struct type where i got my coords and alive bool
struct enemy
{
    float x;
    float y;
    bool alive = true;
    RectangleShape enemyShape;
};
........
enemy Ai[20];
    for(int i=1;i<=10;i++)
    {
        Ai[i].y = 200;
        Ai[i].x = i*50;
        Ai[i].enemyShape.setPosition(Ai[i].x,Ai[i].y);
        Ai[i].enemyShape.setFillColor(sf::Color(255, 100, 150, 255));
    }
.....
        for(int i=1;i<=10;i++)
          if(Ai[i].alive == true)
            window.draw(Ai[i].enemyShape);
 

I'm having problems as my screen doesn't output any of these shapes.  My screen is 800x600, none of the shapes go out of my screen.

Pages: [1]
anything