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

Pages: [1]
1
General / Re: smooth timed animation
« on: December 13, 2018, 09:36:51 pm »
Ok Barnack could you provide me with an example of using the clock to help with me animation? Thank you.

2
General / smooth timed animation
« on: December 13, 2018, 08:05:07 pm »
Yes hi all fellow game devs. I have a problem with my the animation part of my code. What happens is the movement is choppy and the animation plays too fast. I know it is because i don't have a fps timer but I'm stuck. I've looked everywhere for help. so here I am. Please any help will do. 




while (window.isOpen()){


        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

        if((event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Up)){

            //pla.move(0,-2.f);

   rec.left=0;
   if(clock.getElapsedTime().asSeconds()>1.0f){
         if(rec.left==48)
            rec.left=0;
         else
            rec.left+=16;
      //   pla.setTextureRect(rec);

      clock.restart();
      }
pla.setTextureRect(rec);
//rec.left=0;

Pages: [1]
anything