Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML view  (Read 1031 times)

0 Members and 1 Guest are viewing this topic.

GameMasterShift

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
SFML view
« on: December 16, 2014, 06:33:32 pm »
Alright so i am using the SFML view to have the screen centered on top of the players sprite the Yellow is the y coordinate and the Blue is the X  coordinate , now the thing is everything i press the corresponding key such has the up arrow the screen will always move to far in that direction and i have adjusted the numbers to where it moves slower or fast but it dose not help , so is there a way to keep the SFML view always centered with the player sprite , and by view i am talking about the 2d view option http://www.sfml-dev.org/tutorials/2.0/graphics-view.php
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
   {
      Yellow = -200;
      Blue = 0;
   }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
   {
      Yellow = 200;
      Blue = 0;
   }
   if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
   {
      Yellow = 0;
      Blue = -3.33333;
   }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
   {
      Yellow = 0;
      Blue = 3.33333;
   }
« Last Edit: December 16, 2014, 08:48:23 pm by GameMasterShift »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
AW: SFML view
« Reply #1 on: December 16, 2014, 07:05:22 pm »
This post makes only sense to you.
What has the code to do with what you said in your text? What is Yellow and Blue? Where is the view? What exactly doesn't work? Etc.

Read this: http://en.sfml-dev.org/forums/index.php?topic=5559.0
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: SFML view
« Reply #2 on: December 16, 2014, 09:11:12 pm »
Blue is being altered a lot less than yellow so expect horizontal translation to be much less than vertical translation.
If it's still moving too quickly, the number is still too high. However, you should consider multiplying it with delta time.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything