MakeCode Games!

A fan-made community library of MakeCode Arcade games. Visit MakeCode Arcade to make a game!

← Back to extensions

Raycasting 3D Render

Transforms your 2D tilemaps and sprites into a first-person 3D/2.5D raycasted world with jumping, heights, camera controls, and multi-directional animations.

is sprites overlaps in Z dimension

Problem it solves

A flying bat and a low fireball collide in 2D top-down coordinates, but the bat is flying high above the fireball and should not take damage.

What this block does

Checks if two sprites overlap in vertical height (the Z-axis). Works best inside regular sprite overlap events to make collisions 3D-aware.

The block

Block ID: rcRender_isSpritesOverlapZ

is sprites $sprite1=variables_get(mySprite) and $sprite2=variables_get(mySprite2) overlaps in Z dimension block

Parameters

NameTypeDefaultMeaning
sprite1SpritemySpriteFirst sprite to check.
sprite2SpritemySprite2Second sprite to check.

Returns

boolean — true if the sprites overlap along the vertical Z dimension.

Example

sprites.onOverlap(SpriteKind.Enemy, SpriteKind.Projectile, function (enemy, proj) {
    if (Render.isSpritesOverlapZ(enemy, proj)) {
        proj.destroy()
        enemy.destroy()
    }
})

Add the extension

Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.