I am working on a game in which I cannot say what because of a agreement between me and the owner of the actual game as this is a port of that. So what is going on is the player cannot move into the top of the screen, but the code for collision is very long and has to be defined for every single "cell", (dunno what to call them) on the map. So for just the top, you have this very long code, I am scared of that slowing the game. I use a different homescreen movement routine that is easy to understand, link for explanation here if you can't figure it out: http://rcdev00.wikidot.com/doc:home-movement-routine (The only thing in there not explained is how the collision works)
Small Piece of the game:
If M=0002
Then
ClrHome
Output(1,1,"TEST MAP 2"
Pause
ClrHome
200->G
5->X
6->Y
1->S
While 1
Repeat I
getKey->I
Output(Y,X,"X"
If I=24
Then
ClrHome
X-1->X
End
If I=25
Then
ClrHome
Y-1->Y
End
If I=26
Then
ClrHome
X+1->X
End
If I=34
Then
ClrHome
Y+1->Y
End
If S=1
Then
Output(1,1,"TTTTTTTTTTTTTTTT"
Output(8,1,"TTTTTTTTTTTTTTTT"
End
If S=2
Then
Output(3,4,"III"
End
If Y=1 and S=1 //Collision Detection
Then
If X=1
Then
2->Y
End
If X=2
Then
2->Y
End
If X=3
Then
2->Y
End
If X=4
Then
2->Y
End
If X=5
Then
2->Y
End
If X=6
Then
2->Y
End
If X=7
Then
2->Y
End
If X=8
Then
2->Y
End
If X=9
Then
2->Y
End
If X=10
Then
2->Y
End
If X=11
Then
2->Y
End
If X=12
Then
2->Y
End
If X=13
Then
2->Y
End
If X=14
Then
2->Y
End
If X=15
Then
2->Y
End
If X=16
Then
2->Y
End
End
End
End
End