The shoutbox is currently out of service. Join us on Discord instead.
You can help CodeWalrus stay online by donating here.

Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]

Started by DJ Omnimaga, May 16, 2016, 12:42:15 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aeTIos

Darn that looks so epic. Makes me want a CE just to try haha.
ceci n'est pas une signature

DJ Omnimaga


DJ Omnimaga

On a side note: Even though you now have your own font routine, you should warn users in the readme to not use Output() after setting sprites, because Output() will corrupt the sprite data. I assume it's the same for any display command that modifies the RAM in which the sprites are stored.


Also, can the text routine display both strings (eg "HELLO WORLD") and variable content (eg L1(21))?

grosged

Yes,  8bpp mode will make you use only the custom font/routine display, and Output/ClrHome/ClrDraw/Disp ...will have to be forgotten (otherwise it could corrupt)

And yes, we can display variable contents:

22/3:Asm(prgmPRINT
rand:Asm(prgmPRINT
L1(1:Asm(prgmPRINT
π:Asm(prgmPRINT
Ans:Asm(prgmPRINT


DJ Omnimaga

Ah ok, I'm fine with it personally, now that there is an easy way to use custom text. I would have made my own font routine in Basic using the lib but that would have been quite slow :P

Also nice to see we can use variables :)


Also, the fact we can zoom width and height separately means we could use stretched text to mimic Atari 2600 games :P


DJ Omnimaga

OMG it's out! O.O

I'll definitively give it a try in a few minutes. :) I can't wait to try the new features and update my game (and of course check if there are new bugs to report :P)

Also I see it's now open source. :) There is a problem with the zip file, though:

!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\palette.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\clscreen.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\sprite.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\print.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\backhome.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\settings.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\Palette_36colors.png
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\256_colors.png
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\Instructions.txt
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Demos...\DEMO.8Xp
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Demos...\SQUASH.8Xp
!   The system cannot find the path specified.


Renaming the Demo..., Sources... and Docs... folder to Demo, Sources and Docs fixed the problem.


EDIT: It seems you got the order of the default palette wrong. You put yellow first, but yellow should come between cyan and white. :P


Suggestion @grosged :

-Make BACKHOME so that if you use "+":Asm(prgmBACKHOME it only erases the sprite data without switching back to 16bpp.
-Maybe merge BACKHOME with SETTINGS to reduce the amount of sub-programs.

grosged

Okay, thank you for testing :)

I'm modifying the folders name ;)
I'm gonna change the order of colors (had a doubt!)
And merging SETTINGS/BACKHOME is a good idea :)

EDIT: when using SourceCoder, black color is coded 3, right ?
So, what color should be represented by 0 ?

Re-EDIT : I've just thought of an easier way to erase automatically  sprites data, that would happen when defining sprites :

Just when the routine meets "000,... as header ! ;)


DJ Omnimaga

From what I could gather, SourceCoder colors are the following:

0=Nothing
1=Blue (10 in pure BASIC and CE Textlib)
2=Red (11)
3=Black (12)
4=Magenta (13)
5=Green (14)
6=Orange (15)
7=Brown (16)
8=Navy Blue (17)
9=Cyan (18)
A=Yellow (19)
B=White (20)
C=Light Gray (21)
D=Medium Gray (22)
E=Gray (23)
F=Dark Gray (24)
G=Transparent (or Teal in CE Textlib if you use color code 25)

Basically, for some reasons 0 doesn't seem to have any color assigned to it. That's unless I am wrong, but that's what I noticed  when converting sprites.

And yeah maybe you could make sprites data overwrite the sprite behind when it meets the header, but wouldn't it cause empty gaps to be left behind if the former sprite was larger?


Also I am curious about if it would be easy to allow people to setup text settings and display the text in one single PRINT command? That would require storing the string into Str1 or  something, though, unless you used the "150,232,255,224,2,HELLO WORLD":Asm(prgmPRINT syntax (which would draw HELLO WORLD at 150,232 coordinates, with color 255 and background color 224 and 2x zoom. Or would that be much slower to process?


The other idea I had for text would be to assign one character or token as a line break. For example, If you draw text at 10,20, once the routine encounters the asterisk * character in the string, it would draw the rest at 10,28 instead, and 10,36 if another * is encountered and so on.

grosged

Sprites v3.2 updated (palette ok now, folders too)
I've been trying to improve again, this afternoon...but it seems I can't go further....have to pause or writing something else, another project  9_9

DJ Omnimaga

It's fine. Sprites is already excellent already. I can't wait to make elaborate games with it :3=

DJ Omnimaga

On a side note, I might update my tutorial in the first post into an English version of the readme. I wonder if it could be included with future zip files @grosged since there are probably a bunvh of people who would like to download this lib, but cannot speak French?


DJ Omnimaga

Cool thanks a lot. :D

You should upload to Cemetech and ticalc archives for more visibility. I hope this library becomes popular among BASIC programmers in the future. :)

I hope to have time next week to make a game with this library :3=

DJ Omnimaga

Hi @grosged , I have some bad news:

I found a fatal bug in version 3.2 of Sprites: Basically, Sprite #0 no longer works and if it is less than 7x3 pixels large at 4x zoom, then Sprite #1 will not work either. Instead, 4x4 green squares will show up.

This is my code:

Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{20,25,255,148,224,227,0,12,4,34,231
Asm(prgmPALETTE

"000,73,4100111010111211111111
Asm(prgmSPRITE
"001,75,410011101011121111111110111111001110
Asm(prgmSPRITE
"002,75,450000004555000444455544440004000000
Asm(prgmSPRITE
"003,75,400606006006006066466060060060060600
Asm(prgmSPRITE
"004,C5,7000099990000099988889999988877778888877700007777700000000000
Asm(prgmSPRITE
"005,88,40330330012212210112112103333333332323333323233333333333330330330
Asm(prgmSPRITE
"006,55,70000000000000000000000000
Asm(prgmSPRITE
"007,88,4A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE


With the code above, Sprite #0 is a green square but Sprite #1 and higher works fine. If I make Sprite #0 smaller, however, Sprite #1 will not work anymore.

Powered by EzPortal