Jump to content
IGNORED

sprite help - clarifying how the command works


digdugnate

Recommended Posts

Apologies in advance if this has been answered before, but I can't quite get my hands around how the CALL SPRITE command works.

 

I have a 4x4 block of characters defined (so 4 strings per 'line', 4 lines tall) and would like to move the entire thing as a sprite (like diagonally across the screen).

 

here's my pseudocode:

 

* Define character sets

 

A$="hex" through P$="hex"

 

* Color character sets (with example colors)

 

CALL COLOR(9,7,12)

CALL COLOR(10,7,12)

 

* Display character sets (with examples)

 

CALL VCHAR(12,16,96) :: CALL CHAR(96, A$)

CALL VCHAR(12,17,97) :: CALL CHAR(97, B$)

 

(and so on until 4 rows across and 4 rows down are defined)

 

So... according to the XB manual i want to do something similar to CALL SPRITE(#1, 96, 5, 124), but instead where it takes my entire 16 block 'graphic' and moves it across the screen, but I can't quite figure out *how* to make it work.

 

Thanks in advance!

Edited by digdugnate
Link to comment
Share on other sites

ok- i've got my book out.

 

CALL SPRITE(#1,33,5,96,124) - would define it

 

FOR XVEL=-16 TO 16 STEP 2

FOR YVEL=-16 TO 16 STEP 2 - sets values for motion of sprite

 

DISPLAY AT (12,11):XVEL;YVEL - displays current values of motion of sprite

 

CALL MOTION(#1, XVEL, YVEL) - sets sprite in motion

 

NEXT XVEL - completes the loops

NEXT YVEL

 

--

 

so the next question i have is that if i've defined characters like 96 - 110 how to i get them all to move 'at once'?

Link to comment
Share on other sites

Hmmm CALL MOTION automatically moves SPRITES.

100 CALL CLEAR :: CALL MAGNIFY(2) :: CALL SCREEN(15)
110 FOR S=1 TO 28
120 CALL SPRITE(#S,64+S,INT(RND*16)+1,20+S,50+S,INT(A(RND*1))*INT(RND*32),INT(A(RND*1))*INT(RND*32))
130 CALL MOTION(#S,INT(RND*99),INT(RND*99))
140 NEXT S
150 GOTO 150

You seem to think you have to move the sprites yourself, you can do that using CALL LOCATE(#sprite,row,col) so see XB manual.

 

By the way Sprite row is 1 to 192 and sprite column is 1 to 256

Edited by RXB
  • Like 2
Link to comment
Share on other sites

The XB sprite commands allow you to repeat the parameters for a little more speed (ie: CALL MOTION(#1,10,10,#2,10,10,#3,10,10) works to move sprites 1-3). The problem is that the interpreter is still too slow. You can usually get away with moving two sprites together if you only set the motion once, but more often than not more than that, or any updates, will just cause them to drift apart. Of course, you could try accounting for the motion lag with the initial position, it would probably work most of the time (ie: offset by a pixel or so based on the gaps you observe ;) ).

  • Like 2
Link to comment
Share on other sites

that shouldn't be a super big deal- i have a PEB with the 32k :)

 

I was disheartened, somewhat, because i was halfway through my program and i pressed fn-= instead of shift for the 'plus' sign.

 

I went and took care of laundry instead ;)

RXB starts out with the QUIT KEY DISABLED, in order to use the Quit Key in RXB you have to use:

 

CALL QUITON

Turns on quit key.

 

and

 

CALL QUITOFF

Turns quit key off.

Edited by RXB
  • Like 1
Link to comment
Share on other sites

that shouldn't be a super big deal- i have a PEB with the 32k :)

 

I was disheartened, somewhat, because i was halfway through my program and i pressed fn-= instead of shift for the 'plus' sign.

 

I went and took care of laundry instead ;)

I did worse once, and learned about ghost keys the hard way.

 

After several hours of coding and fighting bugs, with it not working, I slapped the keyboard in frustration. It retaliated by resetting. I tested afterwards, and yes, there are combinations of many keys that get misread as FCTN-=.

 

Don't slap your TI. ;)

  • Like 3
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...