Can't figure out what's wrong here (variables)

Monkey Forums/Monkey Programming/Can't figure out what's wrong here (variables)

mteo77(Posted 2013) [#1]
Hello.
I have a generic class with different methods for movements along x and y coordinates.
Then i have a specific class that extend the base one:this class choose movements based on a variable.
Once i assign a movement it seems i can't change the variable so it can start another movement once the old one is finished (i think the problem is here..how can i tell when it's actually finished?)
These are the 3 generic methods for movement:


Here is the update that should swap between movements:

I suspect the error is in the last method...but i can't figure out how to tell the method to change movement...


muddy_shoes(Posted 2013) [#2]
Without complete code it's a guessing game. Have you checked if posx ever equals t? t is defaulting to an Int. Is posx a Float by any chance?


mteo77(Posted 2013) [#3]
I found it out...i forgot to set all the variables float!


mteo77(Posted 2013) [#4]
Basically i was comparing and int to a float.silly me.
I guess its time to start programming using strict!


mteo77(Posted 2013) [#5]
Thanks for pointing me to it (sorry for spamming the reply! just realised i haven't said thank you).


mteo77(Posted 2013) [#6]
I actually learnt something decent out of it (apart from coding in strict!): i can return a value when the condition inside the method is true so i can play with different status changes (if it make any sense).