SFML community forums

Help => General => Topic started by: Greentoast on May 16, 2015, 10:24:39 pm

Title: Why wont my circle move?
Post by: Greentoast on May 16, 2015, 10:24:39 pm
So the title is pretty self explanatory my circle shape wont move when I click 'D' I don't understand what I did wrong so some explanations would be great and would be really appreciated !

http://pastebin.com/x3yxVNfQ
Title: Re: Why wont my circle move?
Post by: shadowmouse on May 16, 2015, 10:28:02 pm
You appear to be redefining the circle shapes every loop, and this therefore resets it. You should declare the shapes before your game loop and then move within the game loop. This way they aren't reset every loop.
EDIT: You also draw the shapes before moving them so therefore they won't move at all as they are then reset back to their original position before being drawn again.
Title: Re: Why wont my circle move?
Post by: Greentoast on May 16, 2015, 11:03:17 pm
That worked to a degree but now it multiplies it seems to be making new copies of the circle each time it moves.
http://pastebin.com/LMKeadUF
Title: Re: Why wont my circle move?
Post by: shadowmouse on May 16, 2015, 11:04:37 pm
You missed out window.clear(). You should put it in front of the window.draw().
Title: Re: Why wont my circle move?
Post by: Greentoast on May 16, 2015, 11:06:43 pm
Alright thanks,
Now I have a pretty slick moving circle. Now for the first update to the the critically acclaimed game 'Circle'.
WASD controls :)
But seriously thanks for helping  8).