Tag Info

New answers tagged


My suggestion may sound obvious, but why don't you try the following. 1) Save in a counter the time left when a player finishes the current level. Let's call it "time_left". 2) Set a loop that runs, for instance, every millisecond. At each iteration of that loop, you decrease X from "time_left". 3) At the same time, at each iteration you increase X*Y your ...


Perhaps something like the following might work for you or at least give you new ideas to handle your problem: float delay = 0; bool trigger = false; public Update() { if(keyState.IsKeyDown(Keys.Space)) { if(canJump) //this line is specific to the OP code { //this line is specific to the OP code vAccel = jumpSpeed ...


I would use something like TaskScheduler, you can probably find dozen of implementations. If you insist on implementing it yourself here is rough sketch: class PriorityQueue<T> where T: IComparable { private List<T> _list; void Enqueue(T item) { _list.Add(item); } T Peek() { return _list.Min();} T Pop() { var tmp = Peek(); ...


A problem is that wait blocks. I suspect what you actually want to do is when the key is pressed store the total time in a variable and then decrement it every tick by your delta-t and check if it's less than or equal to zero.

Top 50 recent answers are included