Well here is a complete suprise release. Sometimes when you have alot of free time (like now) and have some old unfinished projects laying around then sometimes you suddenly finish it.
The engine surely uses a very slow method (matrix based worlds) but I already figured a map compression technique that should ease the pain of the massive size of matrices (not implented in source below). Second, this engine was mostly intended to be used by the beginners in Basic who just want to create a game and not having to go through the process of creating collision detection, movement etc. So here it is! SkyBox2D V1.0!
prgmSKYBOX2D
ClrHome
1->L
"_NP[-]+I=*->Str0
prgmSBLEVELS
For(A,1,16
For(B,1,8
Output(B,A,sub(Str0,[A](B,A),1
End
End
2->X:2->Y
Lbl SB
0->K
While not(sum({24,25,26,34}=K
getKey->K
End
X->C:Y->D
X+(K=26)-(K=24->X
Y+(K=34)-(K=25->Y
If sum({4,5,6,7,8,9}=[A](Y,X // every number in this list is a tile number that is collidable. The next and previous level tiles are non-collidable tiles and are thus left out of this list
Then
C->X:D->Y
End
Output(Y,X,"M
Output(Y-(K=34)+(K=25),X-(K=26)+(K=24),sub(Str0,([A](Y-(K=34)+(K=25),X-(K=26)+(K=24))),1
If [A](Y,X) = 2 or [A](Y,X)=3
Then
L+([A](Y,X)=2)-([A](Y,X)=3)
prgmSBLEVELS
For(A,1,16
For(B,1,8
Output(B,A,sub(Str0,[A](B,A),1
End
End
Goto SB
This code manages five things.
1. It draws the Map that is in [A].
2. It moves and displays the main character (the letter M in this example)
3. It does collision detection
4. It handles going to the next or previous level depending on the tile you step on (tile #2= next level, tile #3 = previous level)
5. It leaves no traces of moving the main characters around. It just copies the previous tile you were on to its original location.
Levels are set up as follows. Create a prgm called SBLEVELS (or name it otherwise in the source above) and insert the matrices. All matrices are 8x16 in size. Every element in the matrix represents a tile at that location. So [A](1,1) = 1 means that the tile pointed to by number 1 is drawn at position 1,1 on the homescreen.
L increments by one if you step on a next level tile and decrements by one if you step on a previous level tile, Therefor this could be level code:
If L=1
Then
If not(LDATA(L
Then
1->LDATA(L
Pause "You are in level 1 atm and I wont say it again!"
End
[[....
.....
...
....
]]->A
End
If L=2
Then
If not(LDATA(L
Then
1->LDATA(L
Pause "You are in level 2 atm. This message is only displayed once"
End
[[....
.....
...
....
]]->A
End
IMPORTANT this post is incomplete but I am running out of time and on the other hand couldn't keep my excitement about this engine. I promise to provide additional (required information) as soon as possible.