Here it comes finally.
It took me several days to find out how raycasting render would work with existing blocks/functions and Arcade game platform together. After read many source codes to try to inject my codes in, the last supposition worked. That is take over tilemap’s renderable instance and all sprites created in current scene to prevent them from being drawn, and keep them in physical engine to make overlap things happen at meanwhile, and then register frameHandlers to draw tilemap and update&draw sprites.
Let me know pls, if there is a more proper/elegant way.
Also need suggestions to impove, really appreciate!
An extension for Makecode Arcade, render a tilemap into raycasting 2.5D view(a kind of less calculation consuming 3D perspective view mode), with directional animations of sprites,
based on mmoskal’s 3d map
- Basically, this render just draw a traditional tilemap game into “3D view”
- setTilemap(), walk around with arrow keys
- Do your game as usual
- sprites, suggest sprite.setScale(0.5) for each, set directional animations with provided animation block.
- work together with most of Arcade blocks and extensions, sprite, projectile, overlap,…
- except these drawing screen directly, sprite effects/saytext …
- Operate view pos and collision size with provided “myself sprite”, and view direction with “setViewAngle” block
- Switch view mode with block “setViewMode to tilemap(2D)/raycasting(3D)”
- Zoom in/out by set fov
- Performing: To compactible with existing blocks, many codes are added in, the perf goes down significantly, need tuning later.
- The Arcade phyical engine worked fine if sprite image is square. But if not, say a tall tree, collision will occured before hit the wall at y axis.
- Reason: The physical engine working in 2D mode, that consider sprite image as its size(x&y direction). But 3D render consider the image width as size for both x & y axises, height as sprite Z-axis size. This could be fix by override the physical engine, in future, if needed.
- Sprite sayText, particles, effects
- Override physic engine.
- Perf tuning, Fx8
- Pose depended animations, stand, walk, attack. Any one need?
- function/block for disable controller codes in this extension, so user can control “myself” in user code