I'm doing this by switching the "hero" to the box (or cursor as I call it) and storing the information about where the hero is in variables and replace the graphic with an appropriate slice. So far so good, I have this part working great.
Now I can use "suspend hero walls" and have the cursor able to wander anywhere, and I can even restrict camera movement with focus camera, but I'm looking for a way to make the cursor unable to move out of the screen.
I am able to go through the borders of the screen and make the last tiles impassable, but there are two problems I'm faced with.
1. I can't seem to make a loop without going through each row manually that will turn tiles to passable.
In python I would use a couple of "For n in range" lines with one nested in the other, but I'm kind of confused about how to achieve this here.
Code:
for (j,1,16) do (
for (k,1,8) do (
write pass block(top_left_x, top_left_y,0)
increment (top_left_y, 1)
)
increment(top_left_x,1)
)
for (k,1,8) do (
write pass block(top_left_x, top_left_y,0)
increment (top_left_y, 1)
)
increment(top_left_x,1)
)
this is my initial attempt which doesn't work, I'd like to know how to improve it and also what I'm doing wrong.
2. Changing all of the tiles back after I'm done seems like a challenging idea. I had a couple of ideas I'd like some feedback on.
- One involves using an if function that would check the value of each map tile. If it isn't one of a certain bunch of values then it would be changed back to being impassable.
- The other is that while I am not using layers (I'm still pretty new to OHRRPGCE and my game is very simple visually) I am wondering if it would be easier to store all impassable objects on a separate layer and change each tile that isn't of the default "blank" tile value to passable/impassable as needed.
What are your thoughts?



