Collision

Collision

Methods


Blockly.JavaScript['collide_with_arrow_function'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['collide_with_world_bounds'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['is_body_touching'](block)

Parameters:
Name Type Description
block

Code Equivalent:
undefined

check_collision(direction, collide)


Enables/disables objects with physics enabled to collide with the world in the given direction.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
direction

direction to set the property for

collide Boolean

sets collision in the direction to true or false

Code Equivalent:
game.physics.arcade.checkCollision.direction = collide;

check_overlap_procedure_field(object1, object2, functionName)


Checks if two objects overlap, and calls the function if they are. No physics is applied.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object1

first object to check

object2

second object to check

functionName

function to call if the objects are overlapping

Code Equivalent:
game.physics.arcade.overlap(object1, object2, functionName, null, this);

collide(object1, object2)


Checks if two objects are colliding, and separates them if they are.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object1

first object to check

object2

second object to check

Code Equivalent:
game.physics.arcade.collide(object1, object2);

collide_boolean(object1, object2)


Checks if two objects are colliding, separates them if they are, and returns true/false.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object1

first object to check

object2

second object to check

Code Equivalent:
game.physics.arcade.collide(object1, object2)

collide_function_field(object1, object2, functionName)


Checks if two objects are colliding, separates them if they are, and calls the function.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object1

first object to check

object2

second object to check

functionName

function to call if the objects are colliding

Code Equivalent:
game.physics.arcade.collide(object1, object2, functionName);

collide_with_world_bounds(object, collide)


Enables/disables collision between an object and the bounds of the world.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to set collision for

collide Boolean

enables/disables the collision

Code Equivalent:
object.body.collideWorldBounds = collide;

collision_get_objects_at_location_function(group, x, y, functionName)


Returns a list of objects from the group that are at the x/y location, calling the given function on the ones that are there.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
group

group to check

x Number

x location to check

y Number

y location to check

functionName

function to call

Code Equivalent:
game.physics.arcade.getObjectsAtLocation(x, y, group, functionName);

get_objects_at_location(group, x, y)


Returns a list of objects from the group that are at the x/y location.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
group

group to check

x Number

x location to check

y Number

y location to check

Code Equivalent:
game.physics.arcade.getObjectsAtLocation(x, y, group)

get_objects_under_pointer(pointer, group)


Returns a list of objects from the given group that are currently underneath the mouse pointer.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
pointer

mouse pointer to check

group

group to check

Code Equivalent:
game.physics.arcade.getObjectsUnderPointer(pointer, group)

is_body_touching(object, direction)


Returns true if something is touching the object in the specified direction.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to check

direction

direction to check

Code Equivalent:
object.body.touching.direction

overlap_boolean(object1, object2)


Returns true/false if two objects are overlapping.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object1

first object to check

object2

second object to check

Code Equivalent:
game.physics.arcade.overlap(object1, object2)

physics_intersects(lhs, rhs)


Returns a Boolean if the two objects are intersecting. Checks for intersection of the object's bodies.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
lhs

object to check

rhs

object to check

Code Equivalent:
game.physics.arcade.intersects(lhs, rhs)