Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

DpakoH

Member Since 28 Dec 2006
Offline Last Active Yesterday, 12:22 AM
-----

Posts I've Made

In Topic: Jump point search(jps) algorithm is slow than classic AStar?

21 March 2013 - 09:14 AM

so, you did write some code to test JPS and find out is is slower than ASTAR or you just think it is slower?


In Topic: THE COLD WAR ERA

17 March 2013 - 02:20 AM

Congrats on the game, but can't you post some screenshots or even videos?


In Topic: Detect single mouseclick - move sprite

25 February 2013 - 08:47 AM

 

i think you are doing it wrong.

 

 

var currentMouseState = Mouse.GetState();
var lastMouseState = currentMouseState;

 

this is wrong, should be 

 

 

var lastMouseState = currentMouseState;
var currentMouseState = Mouse.GetState();
 
if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released){
...
}

I don't think that'll work. 

 

var lastMouseState = currentMouseState;
var currentMouseState = Mouse.GetState();

 

That's saying that you are assigning (and declaring) lastMouseState and assigning it currentMouseState. But.. that's not even declared yet. 2nd line is "var currentMouseState" and assigns that variable "Mouse.GetState();" which means.. you would be assigning a variable that isn't even declared yet to a new variable. So that would most likely throw an error.

currentMouseState is initialized when it is declared, as follows: 

protected MouseState lastMouseState;
protected MouseState currentMouseState = Mouse.GetState();

and the code i posted is placed in the Update method. furthermore this statement

if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)

is wrong, at least the logic is wrong. 


In Topic: StarLife - an indie sci-fi 4X in development

25 February 2013 - 07:17 AM

great job! i really liked your screenshots on your site! :)


In Topic: Detect single mouseclick - move sprite

25 February 2013 - 07:13 AM

i think you are doing it wrong.

 

var currentMouseState = Mouse.GetState();
var lastMouseState = currentMouseState;

 

this is wrong, should be 

 

var lastMouseState = currentMouseState;
var currentMouseState = Mouse.GetState();
 
if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released){
...
}

PARTNERS