A little tool for some people who might struggle with simple sprites in basic. Do tell me what you think.
que es el punto?

is this just a demo showing people how to draw home sprites at arbitrary positions?
Ohhh, I see, it lets you move a textsprite around the homescreen. Look good to me, mind posting up some code so we can see how flexible it is or is not for the end-user?
sure, I can do that
qazz42 wrote:
sure, I can do that
Excellent. Also, is this a finished project that you're going to release, or do you plan to do further work on it before you declare it finished?

Code:
::DCS
:"102828107C101028
:1→A
:6→B
:7→C
:8→D
:Repeat K=45
:ClrHome
:Output(B,A,"O
:Output(C,A,"-
:Output(D,A,"^
:getKey→K
:If K=26
:A+1→A
:If K=24
:A-1→A
:If A>16
:1→A
:If A<1
:16→A
:If K=25
:Then
:B-1→B
:C-1→C
:D-1→D
:End
:If K=34
:Then
:B+1→B
:C+1→C
:D+1→D
:End
:If B<1
:Then
:6→B
:7→C
:8→D
:End
:If D>8
:Then
:1→B
:2→C
:3→D
:End
:End
:ClrHome
:DelVar ADelVar KDelVar BDelVar CDelVar D



and perhaps I might work on it a bit more, perhaps so that the sprite is on the graphscreen
I think if you wanted to make this more dynamic, you should let the programmer specify the sprite as a string, the width and height of the sprite, and then do all your clipping/wrapping dynamically based on that. Just my two cents, though; it might be somewhat above either your skill level or your motivation at this point. Smile
hmm, tell the truth, I could allow the user specify the sprite
qazz42 wrote:
hmm, tell the truth, I could allow the user specify the sprite
Aye, but if you do, will you force a 3x1 sprite, or allow arbitrarily-sized sprites?
3x1
this is kinda simple, but it could come in handy for some new basic programmers Smile
qazz42 wrote:
3x1
Ah, might you consider a future modification to make it more versatile for variable-sized sprites?
KermMartian wrote:
qazz42 wrote:
3x1
Ah, might you consider a future modification to make it more versatile for variable-sized sprites?

i agree Smile
shouldn't be difficult at all...
Not too difficult; I think that the hardest part would just be making sure you didn't get yourself confused over which variables were being used to store the sprite, its width, and its height.
KermMartian wrote:
Not too difficult; I think that the hardest part would just be making sure you didn't get yourself confused over which variables were being used to store the sprite, its width, and its height.

yeah, i always make myself a list on paper for which variable is which so i dont have to go back and change stuff later (sometimes its really a pain haha)
WhiteValkery wrote:
KermMartian wrote:
Not too difficult; I think that the hardest part would just be making sure you didn't get yourself confused over which variables were being used to store the sprite, its width, and its height.

yeah, i always make myself a list on paper for which variable is which so i dont have to go back and change stuff later (sometimes its really a pain haha)
In many of my past projects, I haven't really bothered to do that, but for a variety of reasons, I think I would do so if I make any new, big BASIC projects. For one thing, I've seen how helpful it is to have tons of documentation on a project (cf. all my pages of notes to myself on http://dcs.cemetech.net ), and for another, seasoned coders that I greatly respect like tifreak8x have recommended it as something very constructive for their work.
Hmm, I would have to see what I can do
qazz42 wrote:
Hmm, I would have to see what I can do
You would have to change:

1) At what coordinate it thought the sprite had reached the bottom of the screen, based on knowing the height of the sprite (H) and the bottom of the screen (Cool. If the Y-coordinate of the top-left of the sprite is Y, then the bottom character of the sprite is at row (H+Y-1). Therefore, consider the sprite at or past the bottom if (H+Y-1)>8 or (H+Y)>=7.

2) Similarly, to figure out that the sprite is at or past the right side of the screen, check if (W+X-1)>16 or (W+X)>=15

3) Finally, to draw the sprite, you'll have to loop from (X) to (X+W-1) and (Y) to (Y+H-1), pulling out the appropriate character (or better yet, row of characters!) using the sub() command.
of course, if you use some spaces in your sprite, that might work too (just saying)
qazz42 wrote:
of course, if you use some spaces in your sprite, that might work too (just saying)
I'm not sure exactly what you mean. Are you saying, for example, ABC[13 spaces]DEF[13 spaces]GHI for a 3x3 square?
  
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