
-----------------------------------
C4mMC1
Fri May 01, 2009 12:41 pm

Cooldowns and linking to keys?
-----------------------------------
What is it you are trying to achieve?

I trying to make an arena fighting game in turing and am having some trouble.

What is the problem you are having?

I want to have cooldowns on all the attacks and link the second players controls to WASD but I dont know how to do that.

Describe what you have tried to solve this problem

I have tried to use delay for cooldowns but all it does is slow down the game and I cant figure out the code to link the controls.

Any help would be appreciated. Thanks.

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using


-----------------------------------
corriep
Fri May 01, 2009 3:00 pm

RE:Cooldowns and linking to keys?
-----------------------------------
Can we see what you have so far?

-----------------------------------
Euphoracle
Fri May 01, 2009 3:09 pm

RE:Cooldowns and linking to keys?
-----------------------------------
You'd have to store the Time.Sec (or the millisec variant) for each attack, and check each iteration if it has expired.  You can do that using something like this:

const cooldown := 5
var last := 0
var diff := 0
var x, y, b := 0

loop
    locate (1, 1)
    diff := last - Time.Sec
    if (diff 