heey, now i know how to create standard 8x8 tiles, and i use it much, how now i must draw a fully background map, with the 20*15 tiles. but how can i do this? when i do it with tokenIDE, i only get a very long hexadecimal string, but how can i convert it to a map?

and btw, how can i 'scroll' in a background if the background is much bigger then the screen?
PT_ wrote:
heey, now i know how to create standard 8x8 tiles, and i use it much, how now i must draw a fully background map, with the 20*15 tiles. but how can i do this? when i do it with tokenIDE, i only get a very long hexadecimal string, but how can i convert it to a map?

and btw, how can i 'scroll' in a background if the background is much bigger then the screen?

To answer your first question, the xLibC real( commands use that hex data for drawing your backround. http://dcs.cemetech.net/index.php/XLIBC_Tutorial
If you scroll down a bit until you see:

Code:
:real(3,0,0,0,20,9,0,0,19,14,1
:real(3,0,0,0,20,9,0,0,19,14,0

This draws the backround using various variables. I don't know a whole lot about this, so someone who knows a lot about xLibC can tell you about backround drawing
If you're talking about parallax, I don't think the CSE has the capability for that, but if you're talking about scrolling the screen over to another part of a level, that is certainly possible.
yes oke, but that example uses another prgmTESTMAP where String9 is set and i cant see that program Smile
PT_ wrote:
yes oke, but that example uses another prgmTESTMAP where String9 is set and i cant see that program Smile


Just as long as Str9 is set in that program when you call the update function, you should be fine. Basics variables are usually global.
PT_ wrote:
yes oke, but that example uses another prgmTESTMAP where String9 is set and i cant see that program Smile

I believe Str9 is that hexadecimal string you got from Tokens. Feel free to correct me if I'm wrong.
hmm is possible, i dont know
would that mean that i first create some 8x8 tiles, then put it in together in a tilemap, copy that hexadecimal string to String9 in a program, and then i am ready?

thanks
Yes you create some tiles, then you use those to create a map. The xLIBC tilemap function will read map data from a string (any string, it doesnt have to be 9).

However, you will need to load your graphics data (your 8x8 tiles) into memory before using the tilemap command.

A small example:


Code:
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002020000000000000000000000000000000000000000000000000000000000000000000000000000020200000000000000000000000000000000000000000000000000000000000000000000000000020202020000000000000000000000000000000000000000000000000000000000000000000000020101010102000000000000000000000000000000000000000000000000000000000000000000020101000001010200000000000000000000000000000000020200000000000000000000000000000101000000000101000000000000000000000000000000000101000000000000000000000000000001000000000000010000000000000000020200000000000001010000000002020200000000000000010200000000020100000000020000000101020000000200010100020000010101000000020200000101020000020101000000020200000201010102000202000101000202000101010200000202000000010100000101000000000202000202020202020202020202020202020202020202020202020202020202020202020202020202020201010101010101010101010101010101010101010101010101010101010101010101010101010101->Str8
real(0,1,1,0
"TILES
real(5,0,0
real(3,0,0,0,40,8,0,0,19,14,1
real(3,0,0,0,40,8,0,0,19,14,0
Pause
real(0,1,0,1


There are 3 8x8 tiles in an appvar called "TILES" which is loaded into memory with the real(5,0,0 command. The mapdata is stored to Str8 at the beginning of the program as seen. real(3... draws the map to both sides of GRAM.
this is what i mean:

but cuzz the image is 320 pixel width, i must 'scroll'
Make your image half the size and you should be fine. Scrolling on the CSE is not a good idea, as there are many things that must be taken into account for the movement. Perhaps a scrolling feature will soon be created, however. Sorry about that! Sad
is it not a possibility to redraw every frame? because this is something like the flappy bird
Sure, it's a possibility to redraw every frame, but the speed might be a lot slower than desired.
*bump*
oke, now i have some trouble.
i downloaded some tiles (in a normal way) to the calculator and downloaded your program tr1p1ea
but if i run that program, i got totally other tiles, than i expected...
is this possible that other apps/programs user such tiles too or...???
MateoConLechuga wrote:
Make your image half the size and you should be fine. Scrolling on the CSE is not a good idea, as there are many things that must be taken into account for the movement. Perhaps a scrolling feature will soon be created, however. Sorry about that! Sad
This is inaccurate. As PT_ correctly deduced, programs like DJ_O's Tunnel and Flappy Bird Color use the LCD's X-offset feature to eliminate the need to re-draw the entire screen on every frame. Flappy Bird simply rotates the screen 16 pixels, then re-draws the rightmost 16x120 pixels to overwrite the part of the screen that was rotated from the left edge onto the right. In PT_'s case, he could scroll his football (soccer Wink ) field left and right using this offset.

PT_: You should (1) create a tile .8xv using Tokens (2) load it onto your calculator (3) use ManagePic to load it.
Sorry about the inaccuracy! Sad I was assuming he required directly smooth scrolling, as scrolling on a soccer field might be somewhat jumpy moving that amount. I am actually not aware of this feature in the hybrid basic libs. Thanks for correcting me! Smile
MateoConLechuga wrote:
Sorry about the inaccuracy! Sad I was assuming he required directly smooth scrolling, as scrolling on a soccer field might be somewhat jumpy moving that amount. I am actually not aware of this feature in the hybrid basic libs. Thanks for correcting me! Smile
You can scroll smoothly too; it just would be a bit slow. Smile Actually, I'm pretty sure you can even draw the soccer field across the entire GRAM (320px wide, 120px tall) and scroll it smoothly without any redrawing. That sounds worth an experiment and/or checking with tr1p1ea.
That is true, because both sides of GRAM would be 160 pixels wide, so you could probably do it relatively easily. Smile Thanks! Smile
Yes its possible to scroll across a map smoothly, and can be done reasonably quickly when automated ... with user input+sprites and stuff it could get slow in BASIC:


Code:
"010101010101010101010101010101010101010101010101010101010101010101010101010101010100000000000000000000000000000000000001010000000000000000000000000000000000000101000000000000000000000000000000000000010100000000000000000000000000000000000001010101010101010100000000000000000000000101000000000000000000000001010101010101010100000000000001000000000000000000000001010000000000000000000000010000000000000101000000000000010000000000000000000000010100000000000000000000000100000000000001010100000000000100000000000000000000000101000000000000000000000001000000000001010101000000000001000000000000000000000001010000000000000000000000010000000000010101010000000000010000000000000000000000010100000000000000000000000100000000000101010000000000000100000000000000000000000101000000000000000000000001000000000000010100000000000001000000000000000000000001010000000000000000000000010000000000000101010101010101010000000000000000000000010100000000000000000000000101010101010101010000000000000000000000000000000000000101000000000000000000000000000000000000010100000000000000000000000000000000000001010000000000000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101→Str8
real(0,1,1,0
real(8,1,0
"TILES
real(5,0,0
real(3,0,0,0,40,8,0,0,19,14,1
real(3,0,20,0,40,8,0,0,19,14,1
0→A
Repeat A≥160
real(8,2,A
A+1→A
End
Pause
real(0,1,0,1




It's a very basic 40x15 tilemap with only 2 tiles. What the code does is draw the appropriate half on each side of GRAM, then it goes through a loop increasing the GRAM offset from 0 to 160 and updates the screen accordingly.

Drawing a sprite using this method could get tricky due to sprite clipping against the static xLIB GRAM window - some trickery is required.
Would you also need to offset the sprite's location due to the z-shifting? Or does it already account for that as well? I imagine that it would since you are just changing the display output, so technically it should work...
Yes you would need to keep track of such things in order to make it work. There are some games that do already do this i believe.

I converted your image so you can see what it looks like:

and what i have said in another post: how can i draw only 1 or 2 tiles of the tilemap, at the place where the sprite was?
but tanx!@!!!!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement