Have a different sprite and when A(or whatever button you want it to be) is pressed have its X/Y copy the player's X/Y and then move it in a different direction away from the player.
You can use BGGET.
ID=BGGET(LAYER,X,Y,SYSTEM FLAG)
System flag is for coordinates
0 is for BG coordinates(character units, like text)
1 is for screen coordinates(pixel units)
You just need to keep the characters old X/Y so you can keep him out of the platforms. hope this helps :)
I tried it, but I can only move forward and back(I don't have a cpp) so maybe add a way for people who don't have one to move in the other directions? Could add touch screen buttons for the other directions, and add a mini map. Great so far though :)
Like this
SPSET 0,2
X=100:Y=100 X is for left and right, Y is for up and down.
@LOOP
IF BUTTON()==1 THEN Y=Y-2
IF BUTTON()==2 THEN Y=Y+2
IF BUTTON()==4 THEN X=X-2
IF BUTTON()==8 THEN X=X+2
SPOFS 0,X,Y this sets the X/Y/Z of the sprite
GOTO @LOOP
Hope this helps :)
Like this
SPSET 0,3
X=100:Y=100
@LOOP
IF BUTTON()==1 THEN Y=Y-2
IF BUTTON()==2 THEN Y=Y+2
IF BUTTON()==4 THEN X=X-2
IF BUTTON()==8 THEN X=X+2
SPOFS 0,X,Y
GOTO @LOOP
Hope this helps :)
Here you go :) In code it would look like this
@loop
ID=BGGET(0,X,Y,1)
IF ID==2 THEN X=OLD_X:Y=OLD_Y
SPOFS 0,X,Y
OLD_X=X:OLD_Y=Y
GOTO @LOOP
Change the number in the if statement to what BG tile you want it to work with :)
Its for X/Y of the background tile. 0 for coordinates as the BG coordinates(in character units) Or 1 for screen coordinates as screen coordinates(in pixel units)