Hi! I have this kind of problem: I implement the global variable " currentTime = k * dt;" . Then i use this variable in function and don't know why currentTime=0 in each step. I checked the value of k*dt and currnetTime in each step. How is it possible that in each step I have different values of k*dt and currnetTime?
A very common beginners mistake, is to assume that an assignment is analogous to writing an equation, i.e. making a relationship between variables. An equation, at least in the mathematical sense, describes a numerical balance, where either side of the equation is affected by the other.
An assignment, however, is not an equation. You initialize (assign) 'currentTime' the value of k*dt once on line 23 when it is declared, and then never change it again.