Hey everyone! I’m currently working on a small pulp game and wanted to have one room where the controls are rotated by 90° (up is actually left, left is actually down, etc.).
I’ve managed to write code where I can make the individual components of this work. As in, I can override a single D-Pad direction and it works (albeit with the player eventually clipping into black/wall tiles, but that’s another issue altogether, I assume). An example of this would be (player script):
on update do
if event.dy==-1 then // player just moved up, but is moving left
upX = event.x
upY = event.y
upX -= 1
upY += 1
goto upX,upY
end
end
However, as soon as I put the code together to have it apply to more than one direction, it stops working and the player character is frozen in place. This is what my code looks like (again, player script):
on update do
if event.dy==-1 then // player just moved up, but is moving left
upX = event.x
upY = event.y
upX -= 1
upY += 1
goto upX,upY
elseif event.dy==1 then // player just moved down, but is moving right
downX = event.x
downY = event.y
downX += 1
downY -= 1
goto downX,downY
elseif event.dx==1 then // player just moved right, but is moving up
rightX = event.x
rightY = event.y
rightX -= 1
rightY -= 1
goto rightX,rightY
elseif event.dx==-1 then // player just moved left, but is moving down
leftX = event.x
leftY = event.y
leftX += 1
leftY += 1
goto leftX,leftY
end
end
I’ve also tried having each direction override be separate (with “if” and “end” rather than the “elseif” variants), but that didn’t make a difference.
Neither did separately emitting “left”/”right”/… based on the dx/dy events and then calling on them with “on left do”/”on right do”/… and having the adjusted movement sections in there (inspired by this thread).
Anyone got any ideas on how I could make this work?