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

Pages: [1]
1
General / Re: Permanently changing a variable with sf::Mouse click
« on: April 14, 2020, 12:22:02 am »
Oh sorry, I put the i variable before the game loop:

//edited example

int main()
{
      //window, and the game loop here

      int I = 0; // variable I'm going to change

        if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
        {
            i += 1; // how i'm going to change the variable
        }

      //I is printed to the console to check the value
}
 
this is what I meant to show

2
General / Permanently changing a variable with sf::Mouse click
« on: April 13, 2020, 09:31:45 pm »
I've been trying to figure out how to solve this problem for a while and I still can't figure out how to fix it.

I've been looking for a way to permanently change the variable using the sf::Mouse click function:
//example

int main()
{
      int I = 0; // variable I'm going to change
     
      //window, and the game loop here

      if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
        {
            i += 1; // how i'm going to change the variable
        }

      //I is printed to the console to check the value
}
 

so the problem here is when I click my mouse, i is added by one and now is equal to one, here's the thing. Once I stop clicking i turns right back into 0. Is there something i missed over that could have been useful to fix this problem? Anything could help.

3
General / Re: Error when using the exe
« on: March 27, 2020, 03:15:51 pm »
Thanks, it works.

Thank you so much.

4
General / Error when using the exe
« on: March 27, 2020, 02:13:07 am »
I've finished developing my program, now I have to get a working exe and then release it,

But I have encountered a problem, once I copy and paste the SFML dll files like instructed for the exe to work, now i run the exe it shows an error:

"The code execution cannot proceed because libgcc_s_sjlj-1.dll was not found.
Reinstalling the program may fix this problem"


Once looking through the project files I couldn't find the specified "libgcc_s_sjlj-1.dll" the exe needs,
is there a solution to this problem, please alert me if I'm missing, or not getting something it would be a real help.

Thank you.

5
General / Re: How to create a point and click mechanism
« on: February 22, 2020, 11:21:32 pm »
Dear Tigre Pablito,

Is there any way you can make the code more simplified and more math savvy to lessen complications in the future. It would be a huge help.

Sincerely Stuff

6
General / Re: How to create a point and click mechanism
« on: January 26, 2020, 07:48:35 pm »
what I meant by:


a code that makes the player keep moving to the direction of the mouse
after the click


is when after you click to the direction where you want the player it goes there and at the same time, you don't have to hold the mouse just for the player to follow it. What I'm saying is it's like an RTS point and click


It would be a joy for anyone to try to help.

Sincerely Stuff.

7
General / Re: How to create a point and click mechanism
« on: January 21, 2020, 01:46:08 am »
Big thanks for helping me.

it works!

The only thing I need last is a code that makes the player keep moving to the direction of the mouse
after the click, is it possible?

Sincerely stuff. 

8
General / Re: How to create a point and click mechanism
« on: January 17, 2020, 11:25:50 pm »
thank you for helping, but the line of code,
window.convertPixelToCoords
does not compile stating that the window (the main window) doesn't go with the .convertPixelToCoords line.

9
General / How to create a point and click mechanism
« on: January 17, 2020, 04:08:14 am »
I have been trying to make an online civil war RTS and then i came into a problem.
For about a week I've been trying to find a way to make a mechanism that makes the player follow the mouse when clicked. I've tried using 'for' loops and that was a mess, i even tried using one of the solutions from a another post back in 2013, i got an error.

here was the code i used,

 
sf::Vector2f totalMovement(sf::Mouse::getPosition(window).x) - battalion.getPosition().x, sf::Mouse::GetPosition(window).y - battalion.getPosition().y;

battalion.move(totalMovement * (1.f/30.f));

it would be a huge thanks if you could fix this code, or provide me new ones.
I've been using sfml for 3 weeks now so don't expect me to know everything yet.

Sincerely Stuff.

(i have the codeblocks version of sfml) 

Pages: [1]
anything