Help Home

Tutorials

Weapon Scr. I
Weapon Scr. II
Missions

Reference

All Commands
General
Load/Add
Graphics
HUD
Sounds
Player
Terrain
Projectiles
Particles
Collision
Objects
AI
Nodes
Missions

Commands: collision

Legend

  • X - X is a number
  • 'X' - X is a string (a letter/word/text)
  • [X=0] - X is an optional parameter with value 0 when omitted (NEVER add [] to your script!)
  • hard sync - command is hard synced

collision(IMAGE, X, Y, [TERRAIN=1], [PLAYERS=1], [OBJECTS=1], [IGNORE PLAYER=-1], [IGNORE OBJECT=-1])

Parameters:
IMAGE - image ID for collision check
X - x coordinate
Y - y coordinate
[TERRAIN=1] - check col. with terrain
[PLAYERS=1] - check col. with players
[OBJECTS=1] - check col. with objects
[IGNORE PLAYER=-1] - ignore this player, 0 for current, -1 for none
[IGNORE OBJECT=-1] - ignore this object, -1 for none
Returns:
COLLISION - 1 if a collision occurred, else 0
Checks if IMAGE at the (X|Y) coordinate collides.
Use TERRAIN 0 if you do NOT want to check for collision with the terrain.
Use PLAYERS 0 if you do NOT want to check for collision with players.
Use OBJECTS 0 if you do NOT want to check for collision with objects.

Use IGNORE PLAYER to ignore the collision with a certain player. You can also use the value -1 to ignore no player or 0 to ignore the current player.

Use IGNORE OBJECT to ignore the collision with a certain object. Use the value -1 to ignore no object.

You can use the commands terraincollision, playercollision and objectcollision afterwards to get details about the collision.

Moreover Carnage Contest has some built in collision images. You can use the following values for IMAGE to use them:
col1x1
col2x2
col3x3
col4x4
col5x5
col10x10
col20x20
col30x30
colplayer

(the X x X col images are boxes with these sizes in pixels. the colplayer image is the collision image for the player)

firecollision(IMAGE, X, Y)

Parameters:
IMAGE - image ID for collision check
X - x coordinate
Y - y coordinate
Returns:
FIREOBJECT - ID of collided fire object if a collision occurred, else 0
Checks if IMAGE at the (X|Y) coordinate collides with fire.

The returned value is either the ID of a fire object or a 0 if no fire collides.

imagecollision(IMAGE1, X1, Y1, IMAGE2, X2, Y2)

Parameters:
IMAGE1 - image ID for collision check
X1 - x coordinate of IMAGE1
Y1 - y coordinate of IMAGE1
IMAGE2 - image ID for collision check
X2 - x coordinate of IMAGE2
Y2 - y coordinate of IMAGE2
Returns:
COLLISION - 1 if a collision occurred, else 0
Checks if IMAGE1 at (X1|Y1) collides with IMAGE2 at (X2|Y2). It returns 1 if a collision occurred, otherwise 0.

Carnage Contest has some built in collision images. You can use the following values for IMAGE1 and IMAGE2 to use them:
col1x1
col2x2
col3x3
col4x4
col5x5
col10x10
col20x20
col30x30
colplayer

(the X x X col images are boxes with these sizes in pixels. the colplayer image is the collision image for the player)

objectcollision()

Returns:
OBJECT - id of a object which collided, or 0
Returns the ID of an object which collided. It returns 0 if no object collided. This command has to be used after the collision command.

playercollision()

Returns:
PLAYER - id of a player who collided, or 0
Returns the ID of a player who collided. It returns 0 if no player collided. This command has to be used after the collision command.

terraincollision()

Returns:
COLLISION - 1 if a collision with terrain occured, else 0
Returns 1 if a collision with the terrain occured, else 0. This command has to be used after the collision command.