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

Author Topic: Why wont my circle move?  (Read 1144 times)

0 Members and 1 Guest are viewing this topic.

Greentoast

  • Newbie
  • *
  • Posts: 9
    • View Profile
Why wont my circle move?
« 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

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Why wont my circle move?
« Reply #1 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.
« Last Edit: May 16, 2015, 10:33:30 pm by shadowmouse »

Greentoast

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Why wont my circle move?
« Reply #2 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

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Why wont my circle move?
« Reply #3 on: May 16, 2015, 11:04:37 pm »
You missed out window.clear(). You should put it in front of the window.draw().

Greentoast

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Why wont my circle move?
« Reply #4 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).

 

anything