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

Pages: [1]
1
Seems like i will need to research sf::View. Thanks for a quick response, i will try to figure it out.

2
General / Setting up a particular position for an object in Fullscreen mode
« on: December 19, 2017, 05:39:54 am »
I have some experience with SFML, but now i decided to make a fullscreen game. After some headache with finding a proper resolution for each PC, i stumbled upon a problem with a specific task. Let's imagine i need to place an object to x,y = 1000,1300. What do i do if the player's monitor does not have this position?(resolution is smaller). Is there any way to put objects to particular locations, as in
VideoMode(800,600)
i would use
setPosition(700,300)
, or will i have to use math to calculate specific locations in percentages of the screen? For example, some web developers might put a header for the 20% of the page, so it would work on all computers.

Thanks in advance.

3
General / Re: TDS Shooter Enemy Programming issues
« on: December 16, 2017, 02:39:17 am »
Thanks very much, i was starting to believe that i will never get a good fat answer :)

4
General / Re: TDS Shooter Enemy Programming issues
« on: December 15, 2017, 11:00:34 pm »
But they will still form a row of stupid shooting targets, wont they?

5
General / TDS Shooter Enemy Programming issues
« on: December 15, 2017, 06:28:09 am »
Hi. I've got an idea of creating a mini-shooter with a top-down perspective.

Everything went smoothly till i came to the enemy programming. I wanted the enemies to move towards the player, and i knew in theory how i am to do it. I used this piece of code in order to determine the direction at which the enemy will chase the player.

float m_angle = atan2(target.getPosition().y - enemy.getPosition().y, target.getPosition().x - enemy.getPosition().x);
        sf::Vector2f direction(std::cos(m_angle), std::sin(m_angle));

        enemy.move(direction * 190.f * deltatime);
 

I placed it into the enemy::update function- same function where the window.draw(enemy); was. Although it worked, and the enemy was chasing the player around the map, it has shown different results when i had several enemies. I made a scene where 7 enemies were supposed to chase the player. And they did, in fact. However, while running towards him, the enemies all took the same position and were like in each other. So instead of 7 circles chasing my player, i saw 1 circle that included all those 7( screenshots provided ).

As it can be seen at screenshot 1, in the beginning, all seven circles are separate. However, after a short chase, they come to the same position and start moving synchronically. How do i make it look like a normal chase, without my circles coming into one-another(keep distance)?

Thanks in advance.

Pages: [1]
anything