Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

[JS Request] Hold to Turn

Would it be possible to make a script snippet where while holding a button (let's say whatever is set into variable 1 for now, and for compatibility with other scripts that allow you to use other keys like a key remapper), trying to move would mean you turn instead?

Basically, if variable 1 is set to the code for C or X or J or whatever, holding that button while pressing the arrow keys means your character turns on the spot instead of moving in that direction.

Thanks!
 

eivl

Local Hero
Xy$
0.00
Yes, you can do this with my keyboard plugin ;)
[doublepost=1450743075,1450742462][/doublepost]psudo code : if variable1 === 1
if keyTriggered(123) && keyTriggered(left)
turn char left
else if keyTriggered(123) && keyTriggered(right)
turn char right
if keyTriggered(123) && keyTriggered(up)
turn char up
else if keyTriggered(123) && keyTriggered(down)
turn char down
 
Top