Hi I’m making a game that’s kinda of like pacman. So how would I script something that would keep the player in constant motion like pacman? Thanks!
1 Answer
1If you look at a standard move script (any of them) there’s a line where it reads the up/down arrow keys, something like var mvSpd = Input.GetAxis("Vertical");. That number is between -1 to 1. If they are leaning on the up arrow, mvSpd is 1; 0 if they aren’t holding either arrow; and -1 if they are holding down arrow.
A cheap way to lock yourself into full speed ahead is to replace that line with var mvSpd = 1;. Now it’s like the code asks you “hey, how fast does the guy want to move,” you pretend to read the arrow keys, but you always lie and say “cruising at max, baby.”