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.

get Sprite attribute

Problem it solves

You need to check how high an enemy is in the air before triggering a ground-slam attack.

What this block does

Reads the current vertical 3D attribute (ZOffset, ZPosition, ZVelocity, or ZAcceleration) of a sprite.

The block

Block ID: rcRender_getSpriteAttribute

get Sprite %spr=variables_get(mySprite) %attribute block

Parameters

NameTypeDefaultMeaning
sprSpritemySpriteThe sprite to inspect.
attrRCSpriteAttributeThe 3D attribute to retrieve.

Returns

number — The value of the requested vertical attribute in pixels or pixels per second.

Example

let mySprite = sprites.create(img`.`, SpriteKind.Player)
let zPos = Render.getSpriteAttribute(mySprite, RCSpriteAttribute.ZPosition)

Add the extension

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