having trouble turning on previously saved sprites

Started by ruthven, February 06, 2009, 11:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ruthven

Hi everyone,

I'm pretty new to Commodore BASIC and having trouble with the fundamental of sprites.  It's really bugging me because I've done it (as far as I can tell) exactly like the examples in the manual with no success.  Either I've overlooked some preliminary step that gets the computer ready to handle sprites or my C128 is malfunctioning!

First of all I go into the sprite editor with SPRDEF, create a simple graphic for sprite #1 (using color white), save it into memory by hitting shift+enter, and then exit the editor by hitting enter.  I then save this sprite as the manual tells me by typing BSAVE"SPRITEDATA",B0,P3584 TO P4096.  Now if I try to turn on this sprite at this point, it works fine--presumably because I've just put it into memory with the editor.

But when I turn the computer off and on again, I load the sprite with BLOAD"SPRITEDATA",B0,P3584 and try to turn it on with SPRITE 1,1,2,0,0,0,0 but it doesn't appear.  However, when I go back to the sprite editor at this point and select sprite 1, it appears in the window (colored black this time)--so it did load, but couldn't be turned on initially in BASIC.  Now when I leave the editor again, I type the same exact thing (SPRITE 1,1,2,0,0,0,0) and it appears!  I had assumed that I was somehow forcing the sprite into memory by having it come up in the editor first, hence it only being able to be turned on after coming out of the editor.

But here's the weirdest thing: I tried cold booting the computer again and this time, entering the sprite editor FIRST, so that when I selected sprite #1, nothing came up as I had not yet loaded my sprite.  Now I exit the editor, type BLOAD"SPRITEDATA",B0,P3584 and then SPRITE 1,1,2,0,0,0,0--this time it appears!  I don't know what it is about this order of operations; it's like I need to get the computer ready to use sprite 1 by first setting it to "nothing" with the editor.  This sucks because who wants to make a program that requires users to first do this bizarre operation?  Any thoughts on this?

saehn

It's not "coming on" after you load it because you're not specifying the location. It's there, just off-screen. Type in this after loading your sprite:

movspr1,200,150

It's showing up after you enter SPRDEF because the editor is locating the sprite in the preview section. That's all explained here (albeit indirectly):

http://www.commodore.ca/manuals/128_system_guide/sect-06b.htm#6.3.7

You're having so many problems because the guide is just for reference, it doesn't really teach you how to program C128 BASIC. That's something you either hack through (with or without help) or you can use a book. Check out this link:

http://www.bombjack.org/commodore/books.htm#PROGRAMMING

ruthven

Thanks, that clears up a lot!--I figured it would be some simple thing I overlooked.  :)

Thanks also for that second link--what a great repository of information!  With all this info on hand, hopefully I can stop bugging you guys--at least with the simple fundamental stuff...  :)