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 - paul.mihaita

Pages: [1] 2
1
SFML projects / Re: sfml space invaders type of game
« on: November 14, 2014, 04:32:50 am »
yes, an menu and a 'tutorial' level are the next thing to do

2
SFML projects / Re: Space shooting Game
« on: November 13, 2014, 07:03:31 pm »
i've said that stl containers are much more easy to use but i just said how i did it:D and i used that kind of list because i wanted to understand the mechanic behind, and is an great learning exercise

3
SFML projects / Re: Space shooting Game
« on: November 13, 2014, 03:57:33 am »
You could also use linked lists for both asteroids and bullets, same as stl containers.You add an element to the list every time you want to (have an new bullet or an new asteroid)

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
    {
        while(acumulator > interval) //i test so that you cannot shoot many bullets per second
        {
            sf::Vector2f f=this->getPozitie();//get the position of the player
            f.x+=this->dimensiune.x-3;//place the 'bullet position' in front of the player, f is an empty variable
            f.y+=this->dimensiune.y/2-3;
            this->Arma.fuel(f);//this command adds one bullet to the list
            acumulator5-=intervall;
        }
    }

and this is the code for adding an new element
p=new glont;//the type of struct of the list
        p->sprite.setTexture(texture);//texture
        p->pozitie=poz;//position
        p->sprite.setPosition(p->pozitie);//set the position also to the sprite
        q->next=p;//setting the last bullet reference to this one

and the code for the struct
struct glont{
    sf::Sprite sprite;
    sf::Vector2f pozitie;
    glont *next=NULL;
};

i used lists, but stl containers are much more easy and 'bug preventive' to use

4
SFML projects / Re: sfml space invaders type of game
« on: November 12, 2014, 06:38:26 pm »
for the background i have just 2 identical sprites and the black bar occurs because i update all the elements by time and there are differences (like 0.001 seconds) between the update of each image

5
SFML projects / Re: sfml space invaders type of game
« on: November 11, 2014, 09:57:08 am »
that line appears because of the lag, but i will fix it soon :d

6
SFML projects / Re: sfml space invaders type of game
« on: November 11, 2014, 04:30:05 am »
game over is when your score goes below 0, but i will change de mechanics :D i fixed the left+right and up+down arrows bug , thx:D i will do the player-ship colision soon

7
SFML projects / Re: sfml space invaders type of game
« on: November 10, 2014, 09:02:10 pm »
thx for advices :)

8
SFML projects / Re: sfml space invaders type of game
« on: November 10, 2014, 08:00:16 pm »
no opinions?

9
SFML projects / sfml space invaders type of game
« on: November 10, 2014, 04:09:48 pm »
What do you think?:D it's a game in progress.
You move by arrows, shoot by space.Sometimes bonuses apear on the screen, if you run into them you shoot faster.
Start by pressing 's'

https://www.dropbox.com/s/ei22332b9gyp2kr/pacpacjoc.rar?dl=0

some screenshots:

http://i.imgur.com/YgrgXYY.png?1  game design
http://i.imgur.com/UAFmkLg.png?1 yeah , that is an bullet :D
http://i.imgur.com/bHflEuB.png?1  bonus with timer

in order to win, you have to score around 700 points, and you loose if you go below 0;for each monster that exit the screen you loose 30;

10
Graphics / Re: i guess it's about textures (loading circle problem)
« on: November 07, 2014, 09:12:05 pm »
so i have to learn GLSL?

11
Graphics / Re: i guess it's about textures (loading circle problem)
« on: November 07, 2014, 08:52:58 pm »
and how i can do that shader? i'm new into this kind of program, i've heard about but never did it

12
Graphics / i guess it's about textures (loading circle problem)
« on: November 07, 2014, 07:53:07 pm »
Hey guys. I am making an Space invaders type of game, and i want to make some power-ups.I want to make an animation for that, like an loading circle so that user can know how much time left he has to take the power-up.I know how to do that by sprites(5-6 sprites with 1/5-1/6 of circle and just display the images after a time) but i want to do it smoothly, and by that i mean to calculate the % of circle to fill based on the time i want.I guess it can be done with texture updating...but i don't know

13
Graphics / Re: Sprite setScale problem
« on: March 19, 2013, 03:44:38 pm »
Problem solved

14
Graphics / Sprite setScale problem
« on: March 19, 2013, 02:16:14 pm »
Quote
sf::Event event;
    sf::Texture texture_patrat;
    sf::Texture texture_background;
    texture_patrat.loadFromFile("Patrat.png");
    texture_background.loadFromFile("Background.png");
    sf::Sprite patrat;
    sf::Sprite background;
    patrat.setTexture(texture_patrat);
    background.setTexture(texture_background);
    sf::VideoMode screen=sf::VideoMode::getDesktopMode();
    sf::RenderWindow window(sf::VideoMode(800,600), "SFML window",sf::Style::Fullscreen);
    window.setFramerateLimit(30);
    sf::Vector2f dimensiuni;
    float newsizea,newsizeb;
    newsizea=screen.width/1680;
    newsizeb=screen.height/1050;
    sf::Vector2f x,y;
    x=patrat.getScale();
    y=background.getScale();
    background.setScale(x.x*newsizea,x.y*newsizeb);
    patrat.setScale(y.x*newsizea,y.y*newsizeb);
    dimensiuni=patrat.getPosition();
    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::KeyPressed)
            {
                if(event.key.code==sf::Keyboard::Escape)
                {
                    window.close();
                }
                if(event.key.code==sf::Keyboard::Up&&dimensiuni.y-20>=0)
                {
                    dimensiuni.y-=20;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Up&&dimensiuni.y-20<0)
                {
                    dimensiuni.y=0;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Down&&dimensiuni.y+20<=screen.height-200)
                {
                    dimensiuni.y+=20;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Down&&dimensiuni.y+20>screen.height-200)
                {
                    dimensiuni.y=screen.height-200;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Right&&dimensiuni.x+20<=screen.width-200)
                {
                    dimensiuni.x+=20;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Right&&dimensiuni.x+20>screen.width-200)
                {
                    dimensiuni.x=screen.width-200;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Left&&dimensiuni.x-20>=0)
                {
                    dimensiuni.x-=20;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
                if(event.key.code==sf::Keyboard::Left&&dimensiuni.x-20<0)
                {
                    dimensiuni.x=0;
                    patrat.setPosition(dimensiuni.x,dimensiuni.y);
                }
            }
        }
        window.draw(background);
        window.draw(patrat);
        window.display();
    }
    return 0;
}

My problem is that if i use sprite.setScale(0.5,0.5) it works but if i use sprite.setScale(newsezia,newsizeb) it doesn't work.I don't know why the setScale doesn't work if i use variables but with numbers it works.

15
Graphics / Re: Error, window.draw
« on: March 14, 2013, 05:26:25 pm »
Sorry...I know c++ but i didn't noticed that while:|...Sry again for my post

Pages: [1] 2
anything