I have written some untested code that might do the trick :P
walls$ = "11 22 33 44 57"
'The walls are at the position 11, 22, 33, 44, and 57
portals$ = "12"
'there is a portal at position 1,2
mypos = 10 * moveX
mypos = mypos + moveY
newtile$ = "empty"
IF walls$ CONTAINS mypos THEN
newtile$ = "wall"
'(Or you could just skip this part and go right to the not moving code :P)
END IF
IF portals$ CONTAINS mypos THEN
newtile$ = "portal"
'(Same with the portal code)
END IF
As before, it goes with the V5 Code (It is grid code) :P
Now Silver can fix it up :P
Mist (I am on a PC right now :()