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

Author Topic: Sprite keeps moving to the top left corner of the window  (Read 1499 times)

0 Members and 2 Guests are viewing this topic.

Chocolatesheep

  • Newbie
  • *
  • Posts: 17
    • View Profile
Sprite keeps moving to the top left corner of the window
« on: January 08, 2012, 08:30:25 pm »
I used
Code: [Select]
Sprite.SetPosition(Event.MouseMove.X, Event.MouseMove.Y);
So basically the the sprite moves along with my mouse(because it's in a while loop). Anyway, every time i click something, like the space bar or the mouse button(anything at all) the sprite teleports to the top left corner of the window, and comes back to the mouse pointer after the button is released. How can I stop this, it's very annoying.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sprite keeps moving to the top left corner of the window
« Reply #1 on: January 08, 2012, 08:32:12 pm »
You don't use Event.MouseMove when you didn't catch a sf::Event::MouseMoved event, do you?
Laurent Gomila - SFML developer

Chocolatesheep

  • Newbie
  • *
  • Posts: 17
    • View Profile
Sprite keeps moving to the top left corner of the window
« Reply #2 on: January 09, 2012, 02:57:21 am »
I'm dumb :)

 

anything