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

Pages: [1]
1
Graphics / Re: Mouse sensivity
« on: July 16, 2020, 10:33:25 pm »
Anyone?

2
Graphics / Mouse sensivity
« on: July 10, 2020, 10:22:09 pm »
Hello guys,

I would like to know if there is anyway to configure the mouse sensivity with the SFML libraries.

Let's say for example that I have a high sensivity when using my laptop for any other stuff, but I would like to reduce it (making it configurable in the game) while inside the game window. Is there any way for doing this?

I was looking for this in the forum and in the documentation and I was not able to find anything. I might be using the incorrect keywords...sorry if it is the case :(

3
Graphics / Re: Enemies path following
« on: July 10, 2020, 10:19:04 pm »
Hello guys,

Thank you for your replies. I have managed to solve it with a bit of help from another user, so the problem is gone.

I will check your code anyways, fallah. It will help me in the future for sure! Thank you once again :)

4
Graphics / Re: Enemies path following
« on: July 09, 2020, 11:21:23 am »
Anyone, please? :(

5
Graphics / Re: Enemies path following
« on: July 05, 2020, 04:56:08 pm »
Well, I think I found one of the problems but I am not sure what the solution can be.

When using the piece of code I posted before, I found that there is a problem when reaching the destination point due to the speed value. Currently to move a space ship fluently, I need to set the speed to 200...which means that in these formulas:

         m_pos_v.x += vx * float(m_moveSpeed_ui16) * time;
         m_pos_v.y += vy * float(m_moveSpeed_ui16) * time;

The new position might exceed  the "2.0f" tolerance so the space ship cannot find the destination point and it gets stuck because the minimum movement that can be done per frame (assuming 60fps) 200 * 1 / 60 = 3.33px. Is there any way this behavior can be avoided?

6
Graphics / Enemies path following
« on: July 04, 2020, 11:34:03 am »
Hello guys,

I am recently working with SFML libraries and I am trying to do a Space Shooter game from scratch. After some time working on it I get something that works fine but I am facing one issue and I do not know exactly how to proceed, so I hope your wisdom can lead me to a good solution. I will try to explain it the best I can:

Enemies following a path: currently in my game, I have enemies that can follow linear paths doing the following:

      float vx = m_wayPoints_v[m_wayPointsIndex_ui8].x - m_pos_v.x;
      float vy = m_wayPoints_v[m_wayPointsIndex_ui8].y - m_pos_v.y;

      float len = sqrt(vx * vx + vy * vy);
      //cout << len << endl;
      if (len < 2.0f)
      {
         // Close enough, entity has arrived
         //cout << "Has arrived" << endl;
         m_wayPointsIndex_ui8++;
         if (m_wayPointsIndex_ui8 >= m_wayPoints_v.size())
         {
            m_wayPointsIndex_ui8 = 0;
         }
      }
      else
      {
         vx /= len;
         vy /= len;

         m_pos_v.x += vx * float(m_moveSpeed_ui16) * time;
         m_pos_v.y += vy * float(m_moveSpeed_ui16) * time;
      }
*m_wayPoints_v is a vector<Vector2f> that basically holds the 2d points to be followed.

Related to this small piece of code, I have to say that is sometimes given me problems because getting closer to the next point becomes difficult as the higher the speed of the enemies is.

Is there any other way to be more accurate on path following independtly of the enemy speed? And also related to path following, if I would like to do an introduction of the enemies before each wave movement pattern starts (doing circles, spirals, ellipses or whatever before reaching the final point), for example:

For example, in the picture below:

The black line is the path I want a spaceship to follow before starting the IA pattern (move from left to right and from right to left) which is the red circle.

Is it done hardcoding all and each of the movements or is there any other better solution?

I hope I made myself clear on this...in case I did not, please let me know and I will give more details. Thank you very much in advance!

Pages: [1]
anything