[comp.sys.cbm] C128 sprite/string conversion with SPRSAV...help!

mrios@ihlpb.ATT.COM (Rios) (01/18/89)

(line eater eater bo beater banana bana fo feater...)

The situation is as follows: I have designed a sprite using the SPRDEF command
on the C128, and have converted it to a string using the SPRDEF command.  I know
how long this string is and all, but I can't seem to find a way to put this
string in the form

	10 sp$="<definition string>"

within a program.  I can print it out directly, but it is loaded with special
characters.  Has anyone found or come up with a way to do something like this?
The end result should be a visible string which, when converted to a sprite with
the SPRDEF command, turns out to be the original sprite defined.


-- 
	Michael Rios		attih!ihlpb!mrios	AT&T Secret Police

20231192189121297114420851912920825201522219494725185114479132125914208523125

fred@cbmvax.UUCP (Fred Bowen) (01/20/89)

In article <9425@ihlpb.ATT.COM> mrios@ihlpb.ATT.COM (Rios) writes:
>... I have designed a sprite using the SPRDEF command on the C128, and have
>converted it to a string using the SPRDEF command.  I know how long this
>string is and all, but I can't seem to find a way to put this string in the
>form	10 sp$="<definition string>"	within a program.  I can print it out
>directly, but it is loaded with special characters.  Has anyone found or come
>up with a way to do something like this?  The end result should be a visible
>string which, when converted to a sprite with the SPRDEF command, turns out
>to be the original sprite defined.

I be confused.  You can design a sprite with SPRDEF, copy it to a string with
SPRSAV 1,A$, and copy it to another sprite with SPRSAV A$,n where 'n' is the
sprite number to receive the data.  You can also copy the sprite string data
to the screen directly (GSHAPE A$,x,y) or to another string (B$=A$).  You can
copy a sprite to another sprite with SPRSAV 1,2 or by using the C option when
in SPRDEF mode.  Quite versatile.

PRINTing a string containing sprite data will yeild all kings of garbage,
since the string contains a binary bipmap of the sprite shape.  To see it
properly, you would have to do something like PRINT"<67 insert chrs>"A$.

If your intention is to design a sprite & incorporate the data into a program
by assigning the data to a string variable (probably is what you want, now
that I think about it), you cannot do it that way.  Any null character in a
string literal would terminate the statement's evaluation (a reverse-field @
is a null character).  Instead, write the string to a disk file & load it in
at run time, or write a little thing that would convert each of the 67 chars
in A$ above to numbers (or PEEK the data directly from the sprite buffer) and
put them into a DATA statement.  At run time, your program would have to READ
the info with something like  FOR I=1TO67: READ X: A$=A$+CHR$(X): NEXT.
--
-- 
Fred Bowen			uucp:	{uunet|rutgers|pyramid}!cbmvax!fred
				arpa:	cbmvax!fred@uunet.uu.net
				tele:	215 431-9100

Commodore Electronics, Ltd.,  1200 Wilson Drive,  West Chester,  PA,  19380