ID:173469
 
Ok in my new fighting game Shenkaku (hopefully be a hit for one of the first fighting games) How would I make a system to do a combo? like down left punch?
mob
var/moves = ""
proc
eraseMoves()
var/M = moves
spawn(#) //Replace # with the delay between keypresses for moves
if(M == moves)
moves = ""
else
if(length(moves) > #) //Replaces # with the maximum length for special moves
moves = copytext(moves, length(moves-10))


Whenever someone presses a key, add a key to moves. For example, if you press A, do moves += A. Then, use findtext() to search for any combos that could be made. For example, if findtext(moves, "ABC") is true, then the person just pressed A, then B, then C. If you find something, perform that move, then set moves to "". Otherwise, call eraseMoves().