BUMP

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: BUMP
Abbreviation: B SHIFT+U
Type: Function
Token code: 206/$CE 3/$03
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC function BUMP in Commodore BASIC V7.0 or higher.

Type: Function
General Programming-Syntax: BUMP (N)

The BUMP function returns sprite collision information.

To determine which sprites have collided since the last check, use the BUMP function.

  • BUMP(1) records which sprites have collided with each other.
  • BUMP(2) records which sprites have collided with other objects on the screen, COLLISION need not be active to use BUMP.

The bit positions (0-7) in the BUMP value correspond to sprites 1 through 8 respectively. BUMP(n) is reset to zero after each call.

The value returned by BUMP is the result of two raised to the power of the bit position. For example if BUMP returned a value of 16, sprite 4 was involved in a collision since 2 raised to the fourth power equals 16.

Another sprite commands in BASIC 7.0 are RSPCOLOR, RSPPOS, RSPRITE, SPRCOLOR, SPRITE, SPRDEF and SPRSAV, also COLLISION, GSHAPE and SSHAPE.

Examples[edit | edit source]

Indicates that sprite 2 and 3 have collided.

PRINT BUMP(1)  

Result:

12


Indicates that sprite 5 has collided with an object on the screen

PRINT BUMP(2)  

Result:

32


BASIC V7.0 Commands

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