The best way to do this via scripting is to add/ subtract one from the 0x8004/ 0x8005 variables depending on which way the player is facing. Here's a quick and dirty script that will get the job done:
This coordinate manipulation can also be used in other circumstances (with minor alterations) for things such as JPAN's 0x7E special or changing a tile relative to the player's position with setmaptile.
Code:
#dynamic 0x800000
#org @start
special 0x8F // loads coordinates into 0x8004/ 0x8005
special2 0x8000 0x11F // Places the direction the player is facing into 0x8000. I this far more reliable than other methods of checking facing
compare 0x8000 0x1
if 0x1 call @FacingDown
compare 0x8000 0x2
if 0x1 call @FacingUp
compare 0x8000 0x3
if 0x1 call @FacingLeft
compare 0x8000 0x4
if 0x1 call @FacingRight // Checks which way the player is facing and branches/ returns depending on the answer
special 0x7F // Places the tile's behaviour bytes into 0x8004/ 0x8005
buffernumber 0x0 0x8004
buffernumber 0x1 0x8005
msgbox @talk 0x6 // Prints the values of 0x8004/ 0x8005 for testing purposes
release
end
#org @FacingUp
subvar 0x8005 0x1
return
#org @FacingDown
addvar 0x8005 0x1
return
#org @FacingLeft
subvar 0x8004 0x1
return
#org @FacingRight
addvar 0x8004 0x1
return
#org @talk
= [buffer1], [buffer2]
This coordinate manipulation can also be used in other circumstances (with minor alterations) for things such as JPAN's 0x7E special or changing a tile relative to the player's position with setmaptile.