CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / GizmoBlog / MMBasic Language / Screen and Graphics (VGA/composite) / SPRITE

SPRITE

SPRITE LOAD file

SPRITE ON n, x, y [, color]

SPRITE MOVE n, x, y [, color]

SPRITE COPY s1 TO s2

SPRITE OFF n [, n [, …]]

SPRITE OFF ALL

SPRITE PASTE n, x, y

SPRITE UNLOAD

Load and manipulate sprites on the screen. Sprites are 16×16 pixel objects that can be moved about on the screen without erasing or disturbing text or other underlying graphics. This command is mostly used in animated games.

‘n’ is the sprite number, ‘x’ and ‘y’ are the sprite’s coordinates on the screen.

SPRITE LOAD will load a sprite file into memory. This file defines the graphic images of one or more sprites.

SPRITE ON will display an individual sprite contained in the sprite file.

SPRITE MOVE will move the sprite to a new location and restore the background at the old location.

For both ON and MOVE ‘color’ can be optionally specified and this color will be used for the background. When using a solid background color this is faster and does not require special handling for overlapping sprites.

SPRITE COPY will copy the bitmap for sprite s1 into the bitmap for sprite s2. If the destination sprite (‘n2’) is currently on (ie, displayed) then this command will perform the equivalent of SPRITE OFF, COPY then ON again. This can be used for animation of multiple sprites that use the same bitmaps.

For example, sprites 1 to 4 can be the bitmap of a running man in various poses and sprites 5 to 10 can be blank. Sprites 1 to 4 can then be copied into sprites 5 to 10 as required by the animation and then displayed using SPRITE ON. This would result in six copies of the running man on the screen.

SPRITE OFF will remove the sprite from the screen and restore the background graphics that was obscured when the sprite was turned on.

A number of sprites may be quickly removed in sequence by specifying a comma separated list. ie, SPRITE OFF 4, 8, 2, 3. As a shortcut SPRITE OFF ALL will remove all active sprites.

SPRITE PASTE will simply copy the sprite bitmap to the video screen. There is no need to turn the sprite on or off and the background is not saved therefor the sprite bitmap will become part of the background.

SPRITE UNLOAD will disable the sprites, unload the file and reclaim the memory used.

The sprite file can contain many individual sprites which can be simultaneously displayed and independently manipulated at the same time. The number of sprites is limited only by the available memory.

Also see the function COLLISION() for collision detection.

VGA screen resolution is 480 horizontal by 432 vertical in modes 1-3, and 240×416 in mode 4. PAL composite is 304 by 216 and NTSC composite is 304 by 180.

See also:

BLIT

CIRCLE

CLR$

CLS

COLLISION

COLOR

LINE

LOCATE

MM.HPOS

MM.HRES

MM.VPOS

MM.VRES

MODE

PIXEL

POS

PRESET

PRINT

PRINT @

PSET

SCANLINE

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2025 · Generate Pro Theme on Genesis Framework · WordPress · Log in