This thread is a continuation from this thread.
I did finally get the up down left right movement to look correct. But these games also allowed a player to use diagonals which also moved smoothly. Does anyone know how diagonals would work here? Thanks!
The way you do it is dependent on frame rate, which isn’t going to work well.
Typically, the Pawn you control, has a Movement Component (which is some component you build/add to the main Pawn actor). That Movement Component will take Control Input. Inside Step in the Movement Component, the component will take the control input, clamp each axis to -1 … 1, and then multiply by the “right vector” and “up vector” of the Pawn, and multiply by delta-time, and multiply by max velocity, and then move the Pawn by that amount.
The input decoding will then do “add input vector” to the movement component, for each axis, which means that the movement component can aggregate many different movement inputs.
Yeah, this is my first run of the Ship scroller template. I hope to find the cleanest most efficient code for this type of game.
I do want to try it this way, but I had already started last night and I did end up getting it to work which I will be posting shortly, but as you say, that event tick method will be reliant on frame rate and thus not as stable down the road. If you could whip up a diagram for this method I would appreciate it and I will give you the answer for this post.
Ok guys I was able to get it working. And as the video shows it looks decent as any Shipscroller I have ever seen. Seems the trick was the ordering of things. The diagonals have to go first!
First set the speed of the Shipscroller (remember to put this also in your camera actor to match speed)
Up Left
Up Right
Down Left
Down Right
First set of four branches and four add actor world offsets for the diagonals.
Left and Right
Up and Down
Second set of four branches and four add actor world offsets for Left, Right, Up, Down, and final pic of this diagram / set.
Which one?