RSPRITE
BASIC keyword | |
Keyword: | RSPRITE |
Abbreviation: | R SHIFT+U |
Type: | Function |
Token code: | $ce $06 (206 6) |
Handling routine in BASIC ROM: |
|
List of all BASIC keywords |
Remark: This article describes the BASIC function RSPRITE in Commodore BASIC V7.0 or higher.
Type: Function General Programming-Syntax: RSPRITE(<sprite>,<n>)
The function RSPRITE is used to query the attributes assigned to a sprite.
The function has the following parameters:
- <sprite>: Number, of the sprite whose attributes are queried. The parameter must be in the value range from 1 to 8, otherwise the error message ?ILLEGAL QUANTITY ERROR is output.
- <n>: Specifies the attribute to be queried. The parameter may take the following values:
- 0: determines whether the sprite is active. Return values 0 stands for an inactive, 1 for an active sprite.
- 1: returns the colour of the sprite. The following colours correspond to the return value:
Value | Nname | Color | Value | Name | Color | |
---|---|---|---|---|---|---|
1 | Black | 9 | Orange | |||
2 | White | 10 | Brown | |||
3 | Red | 11 | Lightred | |||
4 | Cyan | 12 | Darkgrey / Grey 1 |
|||
5 | Violet / Purple |
13 | Grey 2 | |||
6 | Green | 14 | Lightgreen | |||
7 | Blue | 15 | Lightblue | |||
8 | Yellow | 16 | Lightgrey / Grey 3 |
- 2: determines the sprite priority. If the return value is 0, the sprite covers the screen foreground, if 1, it is covered by the foreground.
- 3: determines whether the sprite is stretched horizontally. With return value 0 the sprite is displayed normally, with 1 it is stretched horizontally.
- 4: determines whether the sprite is stretched vertically. If the return value is 0, the sprite is displayed normally, if 1, it is stretched vertically.
- 5: determines the colour mode. If the return value is 0, the sprite is single colour, if 1, it is multi colour.
- Other values for <n> cause the error message ?ILLEGAL QUANTITY ERROR.
A string as a parameter causes a ?TYPE MISMATCH ERROR. If parameters are missing or more than 2 are specified, an ?SYNTAX ERROR is issued.
The attributes can be set with the SPRITE statement.
Other sprite commands in BASIC 7.0 are MOVSPR, RSPCOLOR, RSPPOS, SPRCOLOR, SPRDEF and SPRSAV, also BUMP, COLLISION, GSHAPE and SSHAPE.
Examples[edit | edit source]
PRINT RSPRITE(1,0)
Prints 1 on the screen if the first sprite is on, 0 otherwise.
SPRITE 1,,('RSPRITE(1,1) AND 15) + 1
Sets the colour of the sprite to the next value in the colour table.
ABS | AND | APPEND | ASC | ATN | AUTO | BACKUP | BANK | BEGIN | BEND | BLOAD | BOOT | BOX | BSAVE | BUMP | CATALOG | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLLISION | COLOR | CONCAT | CONT | COPY | COS | DATA | DCLEAR | DCLOSE | DEC | DEF FN | DELETE | DIM | DIRECTORY | DLOAD | DO | DOPEN | DRAW | DS | DS$ | DSAVE | DVERIFY | EL | ELSE | END | ENVELOPE | ER | ERR$ | EXIT | EXP | FAST | FETCH | FILTER | FN | FOR | FRE | GET | GET# | GETKEY | GO64 | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | LOOP | MID$ | MONITOR | MOVSPR | NEW | NEXT | NOT | (OFF) | ON | OPEN | OR | PAINT | PEEK | PEN | (PI) | PLAY | POINTER | POKE | POS | POT | PRINT | PRINT USING | PRINT# | PUDEF | (QUIT) | RCLR | RDOT | READ | RECORD | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RND | RREG | RSPCOLOR | RSPPOS | RSPRITE | RUN | RWINDOW | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SLEEP | SLOW | SOUND | SPC( | SPRCOLOR | SPRDEF | SPRITE | SPRSAV | SQR | SSHAPE | ST | STASH | STEP | STOP | STR$ | SWAP | SYS | TAB( | TAN | TEMPO | THEN | TI | TI$ | TO | TRAP | TROFF | TRON | USR | VAL | VERIFY | VOL | WAIT | WHILE | WINDOW | WIDTH | XOR