? SB4 pixel art (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
What's going on?? See: Site Update March 2022

SB4 pixel art

  • #1 ✎ 12 Wubdubb94 Hi I’m trying to figure out how to make custom sprites without the sprite editor kind of how they made sprites on the Commodore 64 using lines of code Posted
  • #2 ✎ 256 niconii Power User Video Games I like to play video games! Hobbies Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Drawing I like to draw! Hobbies In SB4, graphics are stored on graphics pages (or GRPs for short), which are the different pages you can view in the graphics editor. You can also edit GRPs with code, like so: GTARGET page selects which GRP to edit. GPSET x,y,color sets a pixel on the current GRP. SPSET id,x,y,w,h creates a sprite with the given ID number using graphics from the GRP selected by SPPAGE. x, y, w, and h specify the region of the GRP that the sprite will use for its graphics. SPCHR id,x,y,w,h is like SPSET, but it changes the graphics region used by an existing sprite instead of trying to create a new sprite. SPPAGE id,page changes which GRP a sprite uses for its graphics. Posted
  • #3 ✎ 1134 snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements This depends a lot on what you're trying to do specifically. Do you just want to store your graphics data somewhere in your program because the sprite editor is hard to use (it is, honestly), do you want to generate sprites, or something else? niconii's list of functions is really important and there's a few things I should add:
    1. The default page for sprites and background characters is 4. You can also create a custom font based on the default one in page 5.
    2. If you draw over or erase the default graphics in the pages, either in the editor or in your own program, you don't lose them. They're saved in a read-only file in the #SYS folder and reloaded by default when the screen is cleared with ACLS. Don't worry about it.
    3. You can save and load graphics pages with SAVEG "filename",page and LOADG "filename",page
    As far as storing graphics data in your program goes, I would probably use DATA blocks and run some code at startup that draws all of the sprites into page 4.
    Posted
  • #4 ✎ 12 Wubdubb94 @snail_ how do I use data blocks and what code would I youse to draw a sprite? Posted