Well, i was trying to make my sprite move to the left, however, Not only does it move to the left, it leaves a copy of the sprite at its former place.
How do i just let it move to the left WITHOUT leaving a copy of the sprite at its former place?
Here is my code:
#define SFML_STATIC
#include<iostream>
#include<SFML\System.hpp>
#include<SFML\Graphics.hpp>
using namespace std;
using namespace sf;
int main()
{
Image Image;
if (!Image.LoadFromFile("ToadR.png"))
return 1;
VideoMode Vmode(800,600,32);
RenderWindow Window(Vmode, "I am Awesome.");
Sprite Sprite;
Sprite.SetImage(Image);
float x = 400.0;
float y = 300.0;
Sprite.SetPosition(x, y);
Event Event;
while(Window.IsOpened())
{
Window.Draw(Sprite);
Window.Display();
while(Window.GetEvent(Event))
{
if(Event.Type == Event.Closed)
{
Window.Close();
}
else if((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Left))
{
Sprite.Move(-10.0, 0);
}
}
}
return 0;
}
I'm stumped. I hope I could get help. Thanks!