Hello everyone,
I know the title isn’t an ideal description but I have no idea how to put it any clearer in a short manor. So let me explain in a bit more detail what my issue is. I can’t seem to wrap my head around a decent solution.
For clarification, some rules/restriction for what I’m trying to achieve.
- I have an airplane that always needs to fly forward. Think, an endless runner where you always go forward.
- Airplane should be able to go up and down.
- Airplane should be able to go left and right.
Problem
I want the airplane to be controllable by keyboard. When pressing A, I want the airplane to rotate left and then move to the left. When pressing D, the airplane should rotate right and move to the right. When pressing none, the airplane should return to original rotation (so, no rotation).
So far so good, I made a timeline, on pressing A it turns, on release it returns to 0 rotation. I made a second timeline for D, splendid, it works. But here my problem becomes apparent, if the Timeline is not yet finished from A, and I press D, it cancels the first timeline so it rotates to 0 immediately and then starts the new timeline.
I do understand the problem, since the timeline starts at 0. But how do I fix my issue here?
Maybe timeline isn’t the way to go for me or maybe I should be using 1 timeline instead of 2 separate ones? Anyway, I hope you ladies and gentleman can help me get my thoughts on this back on track.