lennaert Pixel perfick thank you guys for help,it means alot.Im sure there are people that will hit the same walls im hitting so your help is always a great thing.
One thing i would love to know how to do is implement JUMP in this 8 direction behaviour.Do you know how to make this happen?
Sure, in my example, below the every tick, you could add any type of condition with a variable or on key press ... or, use your imagination.
examples:
A variable indicating speed could determine, if the "walk" animations should be done, or "run" if a certain speed is set.
Pressing a certain key could indicate that the walk animation should not be used, but another, jump for instance.
Another approach,is simply have 8 animations named animation0 to animation7. (instead of walk0 to walk7)
And use
jump up - animation0
jump right - animation1
walk right - animation2
right down - animation3
duck - animation4
left down - animation5
walk left - animation6
jump left - animation7
For jump ofc, you would need to implement some mchanic to get a jump going.