Перейти к основному контенту

Поиск

How do I make my free runner character move 1 space left or right on press of L1 and R1?

  • Aecert

    I made Santa dash remixable! If you scope into santa and go into his microchip you'll be able to see exactly how I do it.



    What I did was have a variable called target x. Let's say it starts out as 0. If r1 is pressed, target x is increased by 1. If l1 is pressed, target x is decreased by 1.

    Next, get some advanced movers. Make one mover go in the negative x direction, and 1 in the positive x.

    Get a tag and some splitters. Put the tags transform in a splitter. Then put that translation in the second splitter. Now grab the first value out of the second splitter (this is the x position of your character)

    You now have the x position of your character, and the target x position, i.e. the position you want your character to be in.

    Now you need 4 calculators. The first two are to turn your target x position into a range. So instead of 0, we want it to be -0.1 to 0.1

  • Aecert

    Part 2, I accidently hit post

    Do do this, make one calc subtract .1 from target x and the other calc add .1.

    The other two calcs will check whether the characters position is less then or greater than the target range, and if so, activate the advanced movers accordingly.

    Make one check if the characters x pos is less than the target x - 0.1, and if so move in the positive x direction.

    Make the other check if the characters x pos is greater than the target x + 0.1, and if so move in the negative x direction.


    This is how I did it. I am looking at my logic as I type this btw. I hope this helps!

Войдите в службу, чтобы оставить комментарий.