Player 1 simply presses up, down, left, right to move around nicely.
Player 2 on the other hand is coded to be controlled by A, S, D, W. I used this script I found on the wiki to do so:
Code:
#Move NPC 0 (Player 2)
variable (npc cursor)
npc cursor := 0 # first NPC with ID 0
if (npc is walking (npc cursor) == false) then (
# Only move the NPC after they've finished the previous movement,
# also use elseif to prevent moving in two directions at once.
if (key is pressed (key:A)) then (walk npc (npc cursor, left, 1))
else if (key is pressed (key:D)) then (walk npc (npc cursor, right, 1))
else if (key is pressed (key:W)) then (walk npc (npc cursor, up, 1))
else if (key is pressed (key:S)) then (walk npc (npc cursor, down, 1))
)
#Move NPC 0 (Player 2)
variable (npc cursor)
npc cursor := 0 # first NPC with ID 0
if (npc is walking (npc cursor) == false) then (
# Only move the NPC after they've finished the previous movement,
# also use elseif to prevent moving in two directions at once.
if (key is pressed (key:A)) then (walk npc (npc cursor, left, 1))
else if (key is pressed (key:D)) then (walk npc (npc cursor, right, 1))
else if (key is pressed (key:W)) then (walk npc (npc cursor, up, 1))
else if (key is pressed (key:S)) then (walk npc (npc cursor, down, 1))
)
Unfortunately this code does not 100% mimic the regular hero control scheme. I notice while moving the NPC in a new direction they will take 1 step, wait a few ticks, then continue walking in that direction. This repeats every time I change direction with the NPC. Is this a problem with the code snippet or is something else in my game perhaps interfering?
EDIT: Also I have more questions regarding why player input while game goes from title to map screen (or through doors) can cause unexpected errors in game, but I figure I'll solve this first and see if it makes a difference.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases



