Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: matthias1992 on July 21, 2010, 06:20:14 pm

Title: [Basic] SkyBox2D Homescreen Engine
Post by: matthias1992 on July 21, 2010, 06:20:14 pm
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!

Code: [Select]
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:
Code: [Select]
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.
Title: Re: [Basic] SkyBox2D Homescreen Engine
Post by: calcdude84se on July 21, 2010, 06:42:29 pm
Sounds cool! I myself will never use it, but this could be very helpful.
Can't wait for more details! :D
Title: Re: [Basic] SkyBox2D Homescreen Engine
Post by: DJ Omnimaga on July 21, 2010, 07:39:12 pm
mhmm I am curious what it is. I don't feel like typing the entire code in my calc (the format is not SourceCoder) or in an emu atm x.x. I can't wait to see more details about this project.
Title: Re: [Basic] SkyBox2D Homescreen Engine
Post by: matthias1992 on July 22, 2010, 08:54:36 am
Yea, as I said it is more intended for people who are yet not confident enough in BASIC to do all this...
I Will eventually, if I have provided all the information, post the .8xp file. I just have tons of projects running in parallel...

Any updates will be added to the first post.
Title: Re: [Basic] SkyBox2D Homescreen Engine
Post by: calcdude84se on July 22, 2010, 09:05:54 am
Cool. I'll give it a try if you'll give us some documentation :)
Title: Re: [Basic] SkyBox2D Homescreen Engine
Post by: DJ Omnimaga on July 29, 2010, 01:19:46 am
Cool, I can't wait to see how it is ^^