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

Pages: [1]
1
General / Re: How would you do pendulum movement?
« on: April 21, 2020, 05:58:40 pm »
i asked on stack overflow and they told me to figure it out for myself ):

2
General / How would you do pendulum movement?
« on: March 23, 2020, 08:32:47 pm »
Trying to make the player swing on a pendulum with the mouse on a right-click being the pivot, so far managed to find the distance between the player and the mouse, the angle, and from that the pendulum period and frequency. How do I use these to calculate velocity?

3
oh, cheers

4
I mean this => https://github.com/SFML/SFML/wiki/Source:-Simple-Collision-Detection-for-SFML-2
I have no idea how github works.
Tried going to code - download zip and that just downloaded sfml.
Tried to clone it on github desktop, and it came up with 'Clone succeeded, but checkout failed'. Then told me to put in a command but I have no idea where to put in a command.

5
System / Re: How to restart the clock when it gets to a value
« on: March 08, 2020, 02:22:55 pm »
On a key press?

6
System / How to restart the clock when it gets to a value
« on: March 07, 2020, 10:09:02 pm »
I'm multiplying the movement in my game by the time since the last time movement was applied, which causes problems when you don't do anything for a while. Doing this:
if (loopclock.getElapsedTime().asSeconds() > 1){loopclock.restart();}
doesn't work for some reason, another solution to my movement system would also be appreciated.

7
General / Re: All sprites disappear when i scale up any sprites.
« on: March 07, 2020, 09:08:38 pm »
why am i this stupid

8
General / All sprites disappear when i scale up any sprites. [solved]
« on: March 07, 2020, 08:56:01 pm »
    Sprite player;
    player.setTexture(blue);
    player.setColor(Color(0, 255, 0));

    Sprite sprite1;
    sprite1.setTexture(blue);
    sprite1.setPosition(Vector2f(0, 700));


Works fine, but this:

    Sprite player;
    player.setTexture(blue);
    player.setColor(Color(0, 255, 0));

    Sprite sprite1;
    sprite1.setTexture(blue);
    sprite1.setPosition(Vector2f(0, 700));
    sprite1.setScale(10.f, 0.f);


causes sprite1 to not be drawn, or registered in my collision system, similar issue happens when I try and add a third sprite.

9
General / Re: Movement system does not work.
« on: February 15, 2020, 04:59:42 pm »
Oh right. I've fixed that, still does not work, however?

10
General / Movement system does not work.
« on: February 15, 2020, 04:17:16 pm »
Made a basic movement system from scratch using a switch rather than if statements, sprite is drawn but does not move.
   
 while (window.isOpen())
    {
        Event event;
        while (window.pollEvent(event))
        {
            // Checks the event
            switch (event.type){

                  // if you press close, close the window
                  case event.Closed: {
                          window.close();
                          break;}
                  case event.KeyPressed: {
                           switch (event.key.code){

                                   case Keyboard::A:{
                                        playerleft = true;
                                        break;}
                                   case Keyboard::D:{
                                        playerright = true;
                                        break;}

                                   default:
                                         break;    }
                                         }
                  case event.KeyReleased: {
                           switch (event.key.code){

                                   case Keyboard::A:{
                                        playerleft = false;
                                        break;}
                                   case Keyboard::D:{
                                        playerright = false;
                                        break;}
                                   default:
                                        break;   }
                  default:
                       break;

                                         }

                            } // closes the check event switch
       } // closes the event check loop




       Clock clock;
       float alphaTime = clock.restart().asSeconds();

       if (playerleft == true){
        xvel = -1;
       }
       if (playerright == true){
        xvel = 1;
       }
       if (xvel > 0){
        xvel =- 1*alphaTime;
       }
       if (xvel < 0){
        xvel =+ 1*alphaTime;
       }
       player.move(Vector2f(0.f+xvel,0.f+yvel));



        window.clear();
        window.draw(player);
        window.display();


    } // closes the window open loop
New to c++/sfml so sorry if this is a stupid question.

Pages: [1]