SFML community forums
Help => Graphics => Topic started by: russjr08 on November 08, 2014, 07:40:30 pm
-
Hello! I appear to have gotten stuck here... I have a player class with a sprite member, and it won't seem to change it's position.
Entity.h / Player.h -> http://pastebin.com/yQhDDPTi
Player.cpp -> http://pastebin.com/rmsy8Gxk
I'm calling my sprite's setPosition, and am passing an instance of sf::Vector2f to it.. Nothing happens. I've even tried calling setPosition(pos.x, pos.y) manually and it doesn't seem to work either. When I debug my render method, I see that my internal position is indeed correct, however looking into the entity's sprite variable, I see 'sf::Transformable', with a position member, and it has 0, 0 as the coordinates.. (http://prntscr.com/54c290) If I manually change these, the next render call overrides it with 0, 0 again...
Back in my game class, I can draw a CircleShape and manipulate it's position just fine..
I'm so stumped, I've worked with SFML before and it's always been fantastic for me! I'm sure there's something I overlooked, but I can't find it, and I've compared it with a previous game I've made...
I appreciate any help that you guys can give me :)
Edit: So apparently I can modify the sprite's position when I made it a pointer instead of a regular object... I have *no* clue why that works. But it works, so I guess I'm happy.
-
When you update you use _pos, but I see nothing that updates that.
-
Currently, the only time it's being set is in the Player's constructor.