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

Pages: [1]
1
General / Re: if position with sfml
« on: November 26, 2021, 06:22:55 pm »
for example

if(player position <= object position)
{
  do anything.
}

2
General / if position with sfml
« on: November 26, 2021, 10:38:16 am »
I want to ask for help that I don't know how to use if for position in sfml.
For example, if I want something to go as long as it is given inside the if.

I have this code:

#include <SFML\Graphics.hpp>
#include<SFML\Audio.hpp>
#include<SFML\Network.hpp>

int main{
sf::RenderWindow window(sf::VideoMode(1080, 600), "sfml tutorial", sf::Style::Close | sf::Style::Resize);
sf::View Player1(sf::Vector2f(-32.f, 0.f), sf::Vector2f(512.f, 512.f));
sf::RectangleShape slot1(sf::Vector2f(64.f, 128.f));

slot1.setPosition(-264.f, 128.f);

while(window.isOpen())
        {
               
                sf::Event evnt;
               
               
                while(window.pollEvent(evnt))
                {
                        if(evnt.type == evnt.Closed)
                        {
                                window.close();
                        }
                }
window.draw(slot1);
window.display();
                }
               
       
        }
       
        return 0;
}
I want make one animation with this Rectangle, while something Dont true.

Sorry for my english.


Pages: [1]
anything