Jump to content

Photo

sprite help - clarifying how the command works


13 replies to this topic

#1 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • 451 posts
  • Location:SW Missouri

Posted Fri Aug 4, 2017 7:31 PM

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, Fri Aug 4, 2017 7:32 PM.


#2 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 2,426 posts
  • Location:Portland, Oregon USA

Posted Fri Aug 4, 2017 7:37 PM

Call motion

Sent from my LG-H830 using Tapatalk

#3 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • Topic Starter
  • 451 posts
  • Location:SW Missouri

Posted Fri Aug 4, 2017 7:43 PM

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'?



#4 RXB OFFLINE  

RXB

    River Patroller

  • 2,684 posts
  • Location:Vancouver, Washington, USA

Posted Fri Aug 4, 2017 9:22 PM

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, Fri Aug 4, 2017 9:23 PM.


#5 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,716 posts
  • Location:BUR

Posted Sat Aug 5, 2017 4:08 AM

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

#6 mizapf OFFLINE  

mizapf

    River Patroller

  • 2,474 posts
  • Location:Germany

Posted Sat Aug 5, 2017 5:07 AM

Could it help to inhibit sprite motion with the flag byte (83C2) until all motions are set?



#7 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • Topic Starter
  • 451 posts
  • Location:SW Missouri

Posted Sat Aug 5, 2017 6:35 AM

thanks all :) i have what i think i need now.



#8 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,716 posts
  • Location:BUR

Posted Sat Aug 5, 2017 3:22 PM

Could it help to inhibit sprite motion with the flag byte (83C2) until all motions are set?


It might, though then you are requiring 32k so CALL LOAD is available. Not a huge limit in this day and age. ;)

#9 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • Topic Starter
  • 451 posts
  • Location:SW Missouri

Posted Sat Aug 5, 2017 4:30 PM

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 ;)



#10 RXB OFFLINE  

RXB

    River Patroller

  • 2,684 posts
  • Location:Vancouver, Washington, USA

Posted Sat Aug 5, 2017 10:36 PM

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, Sat Aug 5, 2017 10:36 PM.


#11 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,716 posts
  • Location:BUR

Posted Sun Aug 6, 2017 12:29 AM

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

#12 RXB OFFLINE  

RXB

    River Patroller

  • 2,684 posts
  • Location:Vancouver, Washington, USA

Posted Sun Aug 6, 2017 12:45 AM

Other combinations do not work for Quit in RXB I turned off the CRU access to get that number from keys.

 

(And if you find one that does work tell me and I will fix it.)



#13 apersson850 OFFLINE  

apersson850

    Moonsweeper

  • 374 posts

Posted Sun Aug 6, 2017 5:49 AM

But isn't the thing asked here about how to move a graphic block that's not defined as a sprite, or several sprites, but just as normal graphics? That's completely different.



#14 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • Topic Starter
  • 451 posts
  • Location:SW Missouri

Posted Sun Aug 6, 2017 6:33 AM

it is.. but in a roundabout way i figured out what i needed for my program- not withstanding me quitting my program by miskeying, lol






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users