Sorry to make another thread concerning these (since there are already some helpful threads out there), but I am stupid and just don't understand how to do this (and didn't want to steal someone else's thread). And I'd rather not just "go use this sprite generator" because I like to understand what I'm doing when I do it.

Let's start with text sprites - I tell the calculator to place the letter B at (1,1) (after having windows set to 0-94/0-62), then tell it to put another at (1,2), and make a "block" about 5 rows deep. Then I go to move down 1 row (so I can have the sprite be taller than 5 pixels), and it clears everything out. Why? Are there specific parts of characters that I can/cannot ever use? What is the easiest, non-generator, BASIC method to create sprites?
That is because Text() clears whatever is underneath it. You will have to OR the sprites together by storing each step of creating the sprite into a Pic variable, then display the text, the RclPic the picture variable.

Edited for stupidity
Ok.....now how do I do that? Confused
So lets say you want to layer the letter A on top of the letter B

Code:

Text(0,0,"A
StorePic 1
Text(0,0,"B
RecallPic 1


You can adjust the coordinates of Text() to fit your needs.
Then how do I get the sprite to recall anywere on the screen (or be reusable)?
That is how you make a text sprite.

To reuse it, just chan the coordinates of the Text command.
I think that this topic in particular will help you; it's when Sonlen wanted to make text sprites. Please feel free to of course post questions either in this or that thread:

http://www.cemetech.net/forum/viewtopic.php?t=4884

Also, this might help some things:

http://www.cemetech.net/forum/viewtopic.php?t=4904
Let's say that you wanted to have your character be an A mixed with a B, and you just want to move randomly around the screen. To do this, try:
Code:
0->A
0->B
Repeat 0
Repeat K
getKey->K
End
A+(K=26)-(K=24->A
B+(K=34)-(K=25->B
ClrDraw
Text(B,A,"A
StorePic 1
Text(B,A,"B
RecallPic 1
End


PreEdit: I think I was ninja'd, let's see...
Yup, ninja'd indeed, although your simple code is an excellent place to start. I hope all this information will bring Beta7 to some more specific questions about where to start. Smile
Okay, so after looking at Sonlen's topic (thanks Kerm for linking there - the first time I read it it didn't make any sense, but when you linked to it it just clicked Very Happy ), I came up with the following code (okay, so I mostly just used what Kerm and others posted there.....) :


Code:
:ClrDraw
:"XYXJXoθBθoI=I=I→Str0
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,2,3,2,3,2,0,3,2,3,2,3,2,3,2,0,1][1,0,2,3,2,3,2,3,2,3,2,3,2,0,2,0,3,1][1,2,3,2,3,2,3,2,3,0,2,3,0,3,2,3,0,1][1,2,3,2,3,2,0,3,2,3,2,3,0,3,0,2,3,1][1,2,3,2,3,2,3,2,3,2,2,3,3,2,3,2,3,1][1,2,3,2,3,3,2,2,3,2,3,2,3,2,3,2,2,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]→[B]
:dim([B]→{L1}
:For(A,1,{L1}(1
:For(B,1,{L1}(2
:[B](A,B
:If Ans:Then
:For(X,1,5
:Text(5(A-1),5(B-1)+X-1,sub(Str0,X+(5Ans-4)-1,1
:End
:Text(5(A-1),5(B-1)+5,"   (3 spaces)
:End:End:End
:Return


I was having problems with the lower rows of sprites erasing the ones above them, so I made the following changes:


Code:
:Text(6(A-1),5(B-1)+X-1,sub(Str0,X+(5Ans-4)-1,1


I also tried using 7(A-1), but stuff in the upper rows is still getting erased. I'm fairly certain the problem stems from this line. Does it?

Please only give me a "hint" as to what's wrong - I want to try and figure it out myself. I just don't know where to go from here. Sad


Beta7 wrote:
Okay, so after looking at Sonlen's topic (thanks Kerm for linking there - the first time I read it it didn't make any sense, but when you linked to it it just clicked Very Happy ), I came up with the following code (okay, so I mostly just used what Kerm and others posted there.....) :


Code:
:ClrDraw
:"XYXJXoθBθoI=I=I→Str0
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,2,3,2,3,2,0,3,2,3,2,3,2,3,2,0,1][1,0,2,3,2,3,2,3,2,3,2,3,2,0,2,0,3,1][1,2,3,2,3,2,3,2,3,0,2,3,0,3,2,3,0,1][1,2,3,2,3,2,0,3,2,3,2,3,0,3,0,2,3,1][1,2,3,2,3,2,3,2,3,2,2,3,3,2,3,2,3,1][1,2,3,2,3,3,2,2,3,2,3,2,3,2,3,2,2,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]→[B]
:dim([B]→{L1}
:For(A,1,{L1}(1
:For(B,1,{L1}(2
:[B](A,B
:If Ans:Then
:For(X,1,5
:Text(5(A-1),5(B-1)+X-1,sub(Str0,X+(5Ans-4)-1,1
:End
:Text(5(A-1),5(B-1)+5,"   (3 spaces)
:End:End:End
:Return


I was having problems with the lower rows of sprites erasing the ones above them, so I made the following changes:


Code:
:Text(6(A-1),5(B-1)+X-1,sub(Str0,X+(5Ans-4)-1,1


I also tried using 7(A-1), but stuff in the upper rows is still getting erased. I'm fairly certain the problem stems from this line. Does it?

Please only give me a "hint" as to what's wrong - I want to try and figure it out myself. I just don't know where to go from here. Sad




There is no real way to hint to the fix, but this is a simple fix I am sure you will remember and not forget.

This slight edit should fix it. Very Happy


Code:
:ClrDraw
:"XYXJXoθBθoI=I=I→Str0
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,2,3,2,3,2,0,3,2,3,2,3,2,3,2,0,1][1,0,2,3,2,3,2,3,2,3,2,3,2,0,2,0,3,1][1,2,3,2,3,2,3,2,3,0,2,3,0,3,2,3,0,1][1,2,3,2,3,2,0,3,2,3,2,3,0,3,0,2,3,1][1,2,3,2,3,2,3,2,3,2,2,3,3,2,3,2,3,1][1,2,3,2,3,3,2,2,3,2,3,2,3,2,3,2,2,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]→[B]
:dim([B]→{L1}
:For(A,{L1}(1),1,{-}1
:For(B,1,{L1}(2
:[B](A,B
:If Ans:Then
:For(X,1,5
:Text(5(A-1),5(B-1)+X-1,sub(Str0,X+(5Ans-4)-1,1
:End
:Text(5(A-1),5(B-1)+5,"   (3 spaces)
:End:End:End
:Return


Change this line :For(A,1,{L1}(1
To this line :For(A,{L1}(1),1,{-}1

Which I did in the code above. Very Happy
Quote:
. . . Change this line :For(A,{L1}(1),1,{-}1
To this line :For(A,1,{L1}(1 . . .


I believe that was backwards. It should be from the second line, to the first line. You had the code correct, just didn't word it correctly afterwards.

Edit: The reason this happens is because TI is weird and decides to make the letters have a blank 1 pixel space above each letter. To overcome this, you have to start at the bottom and work your way up.
_player1537 wrote:
Quote:
. . . Change this line :For(A,{L1}(1),1,{-}1
To this line :For(A,1,{L1}(1 . . .


I believe that was backwards. It should be from the second line, to the first line. You had the code correct, just didn't word it correctly afterwards.


Edit: I made a typo error, solved now. Very Happy
Okay, that's working now (though it's placing X's after the wall at the end of each line, and has several random pixels that are on that should be in the middle of a space).

How do I use the second column from a character? I know I can just tell the Text() command to output 2 to the right each time instead of 1, but is there away to do it without making everything be created 2 to the right ('cause that would mess up all the spaces)?
In other words, you want to make some characters two pixels over, and some one pixel over? You could state that in the code, if you wanted every "X" to get shifted two pixels but every "J" to get one pixel. If you want it on a per-character basis within the textsprite string, you'll have to double the length of the string by prepending (or appending) the number of pixels to shift with each character.
I want to be able to use the second column all alone, but I don't think that's possible. Sad

Didn't think about putting in code to make 1 or 2 select characters be 2 pixels deep instead of just one. I'll go see if I can get that to work.


*Edit* I'd also like to know how to get 5x5 sprites to work for a tilemap when "X Offset to sprite in PIC, must be ALIGNED" forces me to place tiles in 8-pixel increments.
Beta7 wrote:
I want to be able to use the second column all alone, but I don't think that's possible. Sad

Didn't think about putting in code to make 1 or 2 select characters be 2 pixels deep instead of just one. I'll go see if I can get that to work.

*Edit* I'd also like to know how to get 5x5 sprites to work for a tilemap when "X Offset to sprite in PIC, must be ALIGNED" forces me to place tiles in 8-pixel increments.
If you want to use the second column alone, you're probably better off sprinkling some Pxl-Change()s into your text sprite mix. When you place your sprites aligned on 8-pixel boundaries, they can still be 5x5. The XOR process means that white + black = black and black + white = black, so as long as those last three columns of each sprite are empty, when you render the sprites you put them on X multiples of 5 and Y multiples of 5, everything will work properly. If you need an example, I'd be happy to provide it.
I did that with the viewing window in Window Maze. 15x15 is not a valid sprite size, so I overlapped sprites, then turned on the center pixel.
@All you people wondering why I didn't use a 16x16 sprite: Axe doesn't support them as far as I know. Sad
c.sprinkle wrote:
I did that with the viewing window in Window Maze. 15x15 is not a valid sprite size, so I overlapped sprites, then turned on the center pixel.
@All you people wondering why I didn't use a 16x16 sprite: Axe doesn't support them as far as I know. Sad
I really seriously doubt that that's true. If it is, then that's a pretty glaring omission in Aze.
Kerm, I'd love to see an example (still sort of lost on how to and/or/xor stuff onto the screen).

Also, I'm inputting the following into "real(2)" and it won't post anything on the graphscreen (when I have anythin but a solid row of the same sprite):

real(2,0,0,0,12,4,0,8,0,3,2,0,8,0)

My sprites are in pic2, and there are 4 8x8 sprites next to each other starting at 0/0.
  
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