ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
hit.c File Reference
#include "../../ugbc.h"

Go to the source code of this file.

Functions

Variablehit_to (Environment *_environment, int _sprite)
 Emit ASM code for = HIT([int]x).
Variablehit_to_vars (Environment *_environment, char *_sprite)
 Emit ASM code for = HIT([expression]).

Function Documentation

◆ hit_to()

Variable * hit_to ( Environment * _environment,
int _sprite )

Emit ASM code for = HIT([int]x).

This function can be used to issue code aimed at verifying if a sprite has had a collision with a tile. The result (0 = no collision, 0xff = collision occurred) is returned in the output variable. This function is used when a direct integer is used.

Parameters
_environmentCurrent calling environment
_spriteInteger with the bitmask of the sprites
Returns
Variable* Temporary variable with the result of hit (0 = no hit, 1 = hit occurred)

Definition at line 57 of file hit.c.

◆ hit_to_vars()

Variable * hit_to_vars ( Environment * _environment,
char * _sprite )

Emit ASM code for = HIT([expression]).

This function can be used to issue code aimed at verifying if a sprite has had a hit with another sprite. The result (0 = no collision, 0xff = collision occurred) is returned in the output variable. This function is used when an expression is used.

Parameters
_environmentCurrent calling environment
_spriteExpression with the bitmask of the sprites
Returns
Variable* Temporary variable with the result of hit (0 = no hit, 1 = hit occurred)

Definition at line 77 of file hit.c.