Jump to content
Plastik

All about sprites/tiles

Recommended Posts

Made this thread as to not hi-jack the magellan thread anymore as Opry99er suggested. I want to learn as much as possible about using sprites and tiles on the Ti. I'm slowly getting the hang of extended basic and I find the magellan program to be a god send. I create the sprites in magellan then try to turn them into code.

Currently I'm trying to figure out how to repeat a sprite or tile horizontally. I have an example below I made, I have the bottom floor sprites repeating and would like to now try it in code.

 

 

mario.png

 

Share this post


Link to post
Share on other sites

Nice. Unfortunately, with the way colors are handled in XB, your "ground" is impossible. Those tiles consist of 3 colors and, in XB, colors may only be set as foreground and background. You could use SPRITEs, but the TI has the 4 SPRITE per line limit.

 

A scaled down version can be done, with fewer colors, fairly easily.

 

I can make some suggestions, if you are okay with compromising. :)

Share this post


Link to post
Share on other sites

Nice. Unfortunately, with the way colors are handled in XB, your "ground" is impossible. Those tiles consist of 3 colors and, in XB, colors may only be set as foreground and background. You could use SPRITEs, but the TI has the 4 SPRITE per line limit.

 

A scaled down version can be done, with fewer colors, fairly easily.

 

I can make some suggestions, if you are okay with compromising. :)

 

Well like the dog from before, I can dumb it down to be compatible with the Ti's limitations. Side question with the F18a does the Ti still have the 4 sprite limit? Teach me oh great one :-D

Share this post


Link to post
Share on other sites

I am FAAAR from a great one. :) I know only basic BASIC stuff.

 

The F18 can turn off the limitation, by the way.

Share this post


Link to post
Share on other sites

Here's a little example of how to use HCHAR, VCHAR, and SPRITE.

 

100 CALL CLEAR
110 CALL CHAR(96,"1028449292FE2010")
120 CALL HCHAR(1,1,96,32)
130 CALL VCHAR(1,1,96,24)
140 CALL HCHAR(24,1,96,32)
150 CALL VCHAR(1,32,96,24)
160 CALL SPRITE(#1,96,9,10,10,4,1)
170 GOTO 170
I redefine ONE character. I use tile placement and a SPRITE here. You can see how to repeat characters in this code.
HCHAR and VCHAR have the same format. (row,column,character pattern,repetition)

Share this post


Link to post
Share on other sites

Here's how we set the colors... Add the following lines to the above example.

 

104 CALL SCREEN(16)
105 CALL COLOR(9,2,7)
This sets the screen to white and character set 9 to black foreground and red background.
Each character set is made up of 8 ASCII codes... The set that contains character 96 happens to be set #9.

Share this post


Link to post
Share on other sites

When using tile graphics, you can get quite elaborate if you are clever and use your sets well. We have 14 available sets in XB, so you can imagine how cool you can get with your tile graphics.

 

You can also overlay SPRITEs on top of tiles for even more color combinations. In your dog example, you can do your base graphic in tiles and overlay SPRITEs to give you another color (5 instead of 4)

Share this post


Link to post
Share on other sites

SPRITE colors are independent of tile colors, so you can have set 9 as black on dark red and use character 96 to define a SPRITE with a different color (I used light red for my SPRITE)...

 

Again, these are primarily limitations of Graphics Mode 1. Once you get into bitmap, the possibilities are remarkable (as seen in Rasmus's games)

Share this post


Link to post
Share on other sites

When using tile graphics, you can get quite elaborate if you are clever and use your sets well. We have 14 available sets in XB, so you can imagine how cool you can get with your tile graphics.

 

You can also overlay SPRITEs on top of tiles for even more color combinations. In your dog example, you can do your base graphic in tiles and overlay SPRITEs to give you another color (5 instead of 4)

 

Ah yes I was gonna ask about overlaying sprites and tiles for more combos now I have an answer. Thanks for the example code I was finally able to get my ground, well on the ground.

 

 

ground.png

100 CALL CLEAR
110 CALL SCREEN(15)
120 CALL CHAR(138,"FFFFFFF795945208")
130 CALL CHAR(139,"0000000000000000")
140 CALL COLOR(14,13,11)
150 CALL HCHAR(23,1,138,32)
160 CALL HCHAR(24,1,139,32)
170 GOTO 170

Share this post


Link to post
Share on other sites

SPRITE colors are independent of tile colors, so you can have set 9 as black on dark red and use character 96 to define a SPRITE with a different color (I used light red for my SPRITE)...

 

Again, these are primarily limitations of Graphics Mode 1. Once you get into bitmap, the possibilities are remarkable (as seen in Rasmus's games)

 

I'm definitely gonna practice more in graphics mode 1 then move on, but what are the advantages of bitmap mode? Is that what they classified as High res mode on the Ti?

Share this post


Link to post
Share on other sites

A fine start, friend. :)

 

You are becoming an XB coder and don't even know it. ;)

 

Look forward to watching this progress and if you have any questions, feel free to ask. There are some brilliant minds here who really know their stuff.

 

I will do my best to help too. :)

Share this post


Link to post
Share on other sites

 

I'm definitely gonna practice more in graphics mode 1 then move on, but what are the advantages of bitmap mode? Is that what they classified as High res mode on the Ti?

Yes. You can control every pixel on the screen and do crazy things that should not be spoken of...

 

XB cannot natively access bitmap mode however... It can be done via assembly.

Share this post


Link to post
Share on other sites

Using the TIM card or a 9938 VDP chip with XB on the TI99/4A a XB program call XHI allowed bit map mode from XB.

 

Of course how this worked was the extra 162K of VDP memory.

 

This has always been the big problem with the TI is the total lack of VDP memory to do much of anything idealistically.

 

Everything we do has to be done to save every single byte of space.

 

Edited by RXB

Share this post


Link to post
Share on other sites

Yes. You can control every pixel on the screen and do crazy things that should not be spoken of...

 

XB cannot natively access bitmap mode however... It can be done via assembly.

 

Does XB256 Allow bitmap mode? Thanks again for all the help. I'm really enjoying the challenge when coming up with sprites.

 

 

groundstep.png

  • Like 1

Share this post


Link to post
Share on other sites

Yes. You can control every pixel on the screen and do crazy things that should not be spoken of...

 

XB cannot natively access bitmap mode however... It can be done via assembly.

 

...and fbForth.

 

...lee

  • Like 2

Share this post


Link to post
Share on other sites

I don't think XB256 gives you bitmap mode in XB, but The Missing Link does. :)

Share this post


Link to post
Share on other sites

I don't think XB256 gives you bitmap mode in XB, but The Missing Link does. :)

Tursi is right - The Missing Link allows you to use the bitmap mode in XB. There are a few other programs that give a limited version of bitmap, but none that I know of is as thorough as TML.

XB256 opens up the graphics mode and removes many of the limitations built into XB. You can use 256 unique characters (XB offers 112). The 112 characters normally used for XB can be used as sprite patterns (28 16x16 sprites) or used for a second screen which could be a help screen or something else. XB256 is supported by the compiler so you can write and debug a program in XB, then compile it for a huge speed increase.

Share this post


Link to post
Share on other sites

So many resources so little time, see you guys in a year when I'm done reading everything :lol:

Share this post


Link to post
Share on other sites

Slightly off topic -

 

Super Mario TI would be awesome :P

What? Super Marios Bros wasn't enough for you? ;)

 

Edited by Tursi

Share this post


Link to post
Share on other sites

Plastik, I just want to say that I like the graphics you create. Shame the Mario stuff isn't technically possible on the real hardware, but even the simplified stuff is really well done. Kudos.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...