Hello everybody!
I'm a bit new to this whole game programming, and pretty new to xna/c# aswell.
I've been doing some hobby-programming with c#, but nothing large.
I know some java, and have made a couple plugins for minecraft/bukkit, so hopefully i will grasp the c# language quicker.
I want to make a point-and-click game in 2D.
I will be doing my pixelart myself, and it will be extreamly basic
So here's my problem:
I want the spreite to move along the X axis on the screen when i click once with the mouse.
If i click again, it will move to the new position.
But i can't get it to detect a single click.
I can make the sprite move when i hold down the mouse-button.
i found this one way with google's help, but i don't understand how that should work:
It doesn't anyway.
var currentMouseState = Mouse.GetState();
var lastMouseState = currentMouseState;
...
if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
{
Console.WriteLine("should move");
Position += direction * 5;
}
i am ofcourse missing a bunch of code, but the console still don't output "should move".