# 2D

**URL:** https://forum.castle-engine.io/c/2d/18.md

[Latest](https://forum.castle-engine.io/latest.md) · [Categories](https://forum.castle-engine.io/categories.md)

---

## [About the 2D category](https://forum.castle-engine.io/t/about-the-2d-category/615)

<div class="topic-metadata">

**Author:** [@michalis](https://forum.castle-engine.io/u/michalis)\
**Replies:** 0

</div>

Topics specifically about 2D game development.

---

## [Getting Object from Tiled map](https://forum.castle-engine.io/t/getting-object-from-tiled-map/2153)

<div class="topic-metadata">

**Author:** [@NiunioMartinez](https://forum.castle-engine.io/u/NiunioMartinez)\
**Replies:** 4\
**Last updated:** [May 31, 2026, 1:50am UTC](https://forum.castle-engine.io/t/getting-object-from-tiled-map/2153 "2026-05-31T01:50:17Z")

</div>

I’m trying to get information from objects in a Tiled map but I can’t find how. TCastleTiledMapData exposes only the tiles data through TCastleTiledapData.TileRenderData () (which isn’t documented, by the way) but the e…

---

## [Tiled layers depth](https://forum.castle-engine.io/t/tiled-layers-depth/2154)

<div class="topic-metadata">

**Author:** [@NiunioMartinez](https://forum.castle-engine.io/u/NiunioMartinez)\
**Replies:** 1\
**Last updated:** [May 17, 2026, 4:26pm UTC](https://forum.castle-engine.io/t/tiled-layers-depth/2154 "2026-05-17T16:26:17Z")

</div>

I wonder how can I set the depth of the layers in a Tiled map. A simple example, a map with two layers: background and foreground, and I want my sprites to be above background but below foreground. Is it possible, or …

---

## [Small tool to import Unity sprites 2D](https://forum.castle-engine.io/t/small-tool-to-import-unity-sprites-2d/2049)

<div class="topic-metadata">

**Author:** [@BlueIcaro](https://forum.castle-engine.io/u/BlueIcaro)\
**Replies:** 2\
**Last updated:** [November 16, 2025, 3:44pm UTC](https://forum.castle-engine.io/t/small-tool-to-import-unity-sprites-2d/2049 "2025-11-16T15:44:57Z")

</div>

Hello, I wrote this small tool to read meta files from Unity and the png file, and extract all sprites in Png format. So You add easy to your CGE Meta files, have information about the sprites that are in the atlas fi…

---

## [\[solved\] "EFreeTypeLibraryNotFound" ERROR when "Compile and Run" the platformer demo for Web](https://forum.castle-engine.io/t/solved-efreetypelibrarynotfound-error-when-compile-and-run-the-platformer-demo-for-web/1990)

<div class="topic-metadata">

**Author:** [@EnigmaInc1488](https://forum.castle-engine.io/u/EnigmaInc1488)\
**Replies:** 3\
**Last updated:** [August 10, 2025, 3:24am UTC](https://forum.castle-engine.io/t/solved-efreetypelibrarynotfound-error-when-compile-and-run-the-platformer-demo-for-web/1990 "2025-08-10T03:24:46Z")

</div>

I have loaded the platformer demo and when I try to save it for Web I got this error: Compiling project “platformer” for target “web” in mode “debug”. Exception “EFreeTypeLibraryNotFound”: Cannot load FreeType library…

---

## [How to use TCastleSpriteSheet in TCastleUserInterface](https://forum.castle-engine.io/t/how-to-use-tcastlespritesheet-in-tcastleuserinterface/1980)

<div class="topic-metadata">

**Author:** [@pascalboy](https://forum.castle-engine.io/u/pascalboy)\
**Replies:** 2\
**Last updated:** [August 2, 2025, 3:35pm UTC](https://forum.castle-engine.io/t/how-to-use-tcastlespritesheet-in-tcastleuserinterface/1980 "2025-08-02T15:35:44Z")

</div>

type TPlayerHud = class(TCastleUserInterface) private FSpriteSheet: TCastleSpriteSheet; FCurrentAnimation: TCastleSpriteSheetAnimation; FCurrentFrameIndex: Integer; FTimeAccumulator: Single; FAtla…

---

## [Get pixel color from TCastleImageControl](https://forum.castle-engine.io/t/get-pixel-color-from-tcastleimagecontrol/1873)

<div class="topic-metadata">

**Author:** [@Didi](https://forum.castle-engine.io/u/Didi)\
**Replies:** 4\
**Last updated:** [April 23, 2025, 12:55pm UTC](https://forum.castle-engine.io/t/get-pixel-color-from-tcastleimagecontrol/1873 "2025-04-23T12:55:05Z")

</div>

Hi, I want to read the color of one pixel from a TCastleImageControl. I found in the class TCastleImage this: Assuming the above definition, RawPixelsˆ\[z, y, x\] is color of pixel at position z, x, y I can’t find an ex…

---

## [How to assign button event](https://forum.castle-engine.io/t/how-to-assign-button-event/1133)

<div class="topic-metadata">

**Author:** [@Tone](https://forum.castle-engine.io/u/Tone)\
**Replies:** 3\
**Last updated:** [January 12, 2025, 10:37pm UTC](https://forum.castle-engine.io/t/how-to-assign-button-event/1133 "2025-01-12T22:37:23Z")

</div>

in documentation nothing is said about the buttons and how to assign the button1 events without the CGE editor There is something written on this site about buttons, but nothing is clear: How to add this to TCastleWind…

---

## [AplyImpulse in 2D](https://forum.castle-engine.io/t/aplyimpulse-in-2d/1431)

<div class="topic-metadata">

**Author:** [@BlueIcaro](https://forum.castle-engine.io/u/BlueIcaro)\
**Replies:** 2\
**Last updated:** [November 13, 2024, 7:54am UTC](https://forum.castle-engine.io/t/aplyimpulse-in-2d/1431 "2024-11-13T07:54:00Z")

</div>

Hello, I making a small test to understand applyimpulse. I created a new blank project. I add a Viewport for 2D. I added Behaviours to the plane1. I In my code I wrote: published { Components designed using C…

---

## [How to move a scene TCastleScene with the ridigbody without AddForce](https://forum.castle-engine.io/t/how-to-move-a-scene-tcastlescene-with-the-ridigbody-without-addforce/1298)

<div class="topic-metadata">

**Author:** [@M.A.Kurvers](https://forum.castle-engine.io/u/M.A.Kurvers)\
**Replies:** 23\
**Last updated:** [November 8, 2024, 11:18pm UTC](https://forum.castle-engine.io/t/how-to-move-a-scene-tcastlescene-with-the-ridigbody-without-addforce/1298 "2024-11-08T23:18:49Z")

</div>

Hello, I can move a squared 2D box and I have a rectangled 2D box in the center. I can collide the square with the rectangle, because I use the Rigidbody with an AddForce. The problem is that if I don’t press the arrow …

---

## [Object Tracking](https://forum.castle-engine.io/t/object-tracking/1392)

<div class="topic-metadata">

**Author:** [@Pizzacud](https://forum.castle-engine.io/u/Pizzacud)\
**Replies:** 4\
**Last updated:** [October 24, 2024, 2:38pm UTC](https://forum.castle-engine.io/t/object-tracking/1392 "2024-10-24T14:38:34Z")

</div>

(I’m using the mobile app) I have a sprite that spawns enemies away from it, which face towards the spawner, but I can’t figure out how to make the enemies move towards the spawner. There’s literally code for moving towa…

---

## [In 2d view castlebox isn't white](https://forum.castle-engine.io/t/in-2d-view-castlebox-isnt-white/1348)

<div class="topic-metadata">

**Author:** [@BlueIcaro](https://forum.castle-engine.io/u/BlueIcaro)\
**Replies:** 3\
**Last updated:** [September 16, 2024, 5:28pm UTC](https://forum.castle-engine.io/t/in-2d-view-castlebox-isnt-white/1348 "2024-09-16T17:28:51Z")

</div>

Hello, I make a small example with tcastlebox, I put color to FFFFFF, but the image isn’t white, take a look What am i doing wrong? Thanks /BlueIcaro

---

## [Running Plattformer Example on Mac](https://forum.castle-engine.io/t/running-plattformer-example-on-mac/1254)

<div class="topic-metadata">

**Author:** [@Mojomajor](https://forum.castle-engine.io/u/Mojomajor)\
**Replies:** 2\
**Last updated:** [August 16, 2024, 4:00pm UTC](https://forum.castle-engine.io/t/running-plattformer-example-on-mac/1254 "2024-08-16T16:00:55Z")

</div>

I managed to build the platform example, but on my mac it looks like I only see on quarter of the screen, due to the DPI of the system. What’s the magic setting to scale the screen so I can actually use it?

---

## [How to judge TCastleScene touch events](https://forum.castle-engine.io/t/how-to-judge-tcastlescene-touch-events/1265)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 1\
**Last updated:** [July 9, 2024, 6:08pm UTC](https://forum.castle-engine.io/t/how-to-judge-tcastlescene-touch-events/1265 "2024-07-09T18:08:03Z")

</div>

Add multiple TCastleScenes to TCastleViewport, click to trigger how to determine which TCastleScene in TCastleViewport. Is there any function to determine? I need to do some event processing for specific TCastleScenes

---

## [Can TCastleScene be set with the top left corner as the origin coordinate?](https://forum.castle-engine.io/t/can-tcastlescene-be-set-with-the-top-left-corner-as-the-origin-coordinate/1272)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 3\
**Last updated:** [July 21, 2024, 12:50pm UTC](https://forum.castle-engine.io/t/can-tcastlescene-be-set-with-the-top-left-corner-as-the-origin-coordinate/1272 "2024-07-21T12:50:19Z")

</div>

Can TCastleScene be set with the top left corner as the origin coordinate? I used to use the 2D engine with the top left corner as 0,0 for all logic, but now TCastleScene sets Vector3 (0,0,0) in the middle of the screen.…

---

## [Image black edge blending](https://forum.castle-engine.io/t/image-black-edge-blending/1245)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 11\
**Last updated:** [June 30, 2024, 6:00am UTC](https://forum.castle-engine.io/t/image-black-edge-blending/1245 "2024-06-30T06:00:53Z")

</div>

I tested multiple blends of TCastleScene, but it didn’t work. Can you explain the special effects and mix the black borders? Is there any way to do this I have had a large amount of this material in my previous proje…

---

## [How to obtain the size of texture in TCastleScene](https://forum.castle-engine.io/t/how-to-obtain-the-size-of-texture-in-tcastlescene/1251)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 1\
**Last updated:** [June 28, 2024, 6:19pm UTC](https://forum.castle-engine.io/t/how-to-obtain-the-size-of-texture-in-tcastlescene/1251 "2024-06-28T18:19:38Z")

</div>

How to obtain the height and width of textures in TCastleScene

---

## [Chinese display issue](https://forum.castle-engine.io/t/chinese-display-issue/1203)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 10\
**Last updated:** [May 25, 2024, 5:06am UTC](https://forum.castle-engine.io/t/chinese-display-issue/1203 "2024-05-25T05:06:33Z")

</div>

Add the corresponding Chinese font library file according to the document CastleSettings.ml, and after testing, all Chinese characters will be displayed?? This symbol

---

## [2D tile map resource format issue](https://forum.castle-engine.io/t/2d-tile-map-resource-format-issue/1206)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 5:02am UTC](https://forum.castle-engine.io/t/2d-tile-map-resource-format-issue/1206 "2024-05-25T05:02:06Z")

</div>

As my project is a custom map, all map resource tiles are packaged in Cocos2d plist. I want to obtain the corresponding image texture through the key and then use TDrawableImage for rendering. After testing, TDrawable…

---

## [Bitmap cannot be displayed](https://forum.castle-engine.io/t/bitmap-cannot-be-displayed/1204)

<div class="topic-metadata">

**Author:** [@a493203176](https://forum.castle-engine.io/u/a493203176)\
**Replies:** 2\
**Last updated:** [May 23, 2024, 8:08am UTC](https://forum.castle-engine.io/t/bitmap-cannot-be-displayed/1204 "2024-05-23T08:08:02Z")

</div>

I tested that the official font\_draw-over\_image displayed normally, and then I tried to replace my game resource image for testing. However, when configuring the relevant information, it still couldn’t be displayed A…

---

## [Moving an object parallel with current animation frame](https://forum.castle-engine.io/t/moving-an-object-parallel-with-current-animation-frame/1096)

<div class="topic-metadata">

**Author:** [@LittleRAT](https://forum.castle-engine.io/u/LittleRAT)\
**Replies:** 4\
**Last updated:** [February 22, 2024, 4:39pm UTC](https://forum.castle-engine.io/t/moving-an-object-parallel-with-current-animation-frame/1096 "2024-02-22T16:39:54Z")

</div>

So I have a Player which is a TCastleScene that contains my Player.castle-sprite-sheet. I have an Idle animation and another Idle animation when holding a weapon except both the weapon and character are moving so for exa…

---

## [TCastleTiledMap assign TBoxCollider to individual layers](https://forum.castle-engine.io/t/tcastletiledmap-assign-tboxcollider-to-individual-layers/1091)

<div class="topic-metadata">

**Author:** [@LittleRAT](https://forum.castle-engine.io/u/LittleRAT)\
**Replies:** 1\
**Last updated:** [February 19, 2024, 9:26pm UTC](https://forum.castle-engine.io/t/tcastletiledmap-assign-tboxcollider-to-individual-layers/1091 "2024-02-19T21:26:06Z")

</div>

So I’ve made a basic level within tiled. Imported into TCastleTileMap & all works great except the collider box is based on all layers, how do I separate so each layer has it’s own TCastleBoxCollider?. Example when disa…

---

## [Build (or combine) and tint sprites (or change its colours)](https://forum.castle-engine.io/t/build-or-combine-and-tint-sprites-or-change-its-colours/751)

<div class="topic-metadata">

**Author:** [@NiunioMartinez](https://forum.castle-engine.io/u/NiunioMartinez)\
**Replies:** 17\
**Last updated:** [December 16, 2023, 2:20pm UTC](https://forum.castle-engine.io/t/build-or-combine-and-tint-sprites-or-change-its-colours/751 "2023-12-16T14:20:40Z")

</div>

I’ve finally learned how to use sprites (2D game objects, you know). Now I’m wondering how to do two different effects or techniques for a game idea I have. Is there a way to “build” a sprite? I mean, I have a sprite…

---

## [How to judge the mouse on TDrawableImage](https://forum.castle-engine.io/t/how-to-judge-the-mouse-on-tdrawableimage/739)

<div class="topic-metadata">

**Author:** [@soastao](https://forum.castle-engine.io/u/soastao)\
**Replies:** 13\
**Last updated:** [December 5, 2023, 8:27am UTC](https://forum.castle-engine.io/t/how-to-judge-the-mouse-on-tdrawableimage/739 "2023-12-05T08:27:14Z")

</div>

I use TDrawableImage to draw by myself, Everything is good at present I met a problem, How to judge the mouse on TDrawableImage 1、examples/viewport\_and\_scenes/detect\_scene\_hit/ This example not use TDrawableImage to…

---

## [Drawing TBitmap](https://forum.castle-engine.io/t/drawing-tbitmap/992)

<div class="topic-metadata">

**Author:** [@bugan11](https://forum.castle-engine.io/u/bugan11)\
**Replies:** 2\
**Last updated:** [November 28, 2023, 2:43pm UTC](https://forum.castle-engine.io/t/drawing-tbitmap/992 "2023-11-28T14:43:09Z")

</div>

Hello, is there any way to draw TBitmap type from Delphi in CGE? I know there is TDrawableImage which takes TCastleImage, where currently I am doing conversion, but manually pixel by pixel and thats quite slow. I cant lo…

---

## [CGE 2D game development road](https://forum.castle-engine.io/t/cge-2d-game-development-road/725)

<div class="topic-metadata">

**Author:** [@soastao](https://forum.castle-engine.io/u/soastao)\
**Replies:** 7\
**Last updated:** [January 27, 2023, 10:46pm UTC](https://forum.castle-engine.io/t/cge-2d-game-development-road/725 "2023-01-27T22:46:10Z")

</div>

1、Choose a development engine I found that CGE had 2D rendering performance problems a long time ago，I did not report this problem at the time, and transferred to the test of other engines. I tried almost all pascal eng…

---

## [Pixel art rendering incorrectly](https://forum.castle-engine.io/t/pixel-art-rendering-incorrectly/927)

<div class="topic-metadata">

**Author:** [@Makoren](https://forum.castle-engine.io/u/Makoren)\
**Replies:** 6\
**Last updated:** [October 11, 2023, 2:19pm UTC](https://forum.castle-engine.io/t/pixel-art-rendering-incorrectly/927 "2023-10-11T14:19:08Z")

</div>

I’m trying to get pixel art to render correctly, but there’s subpixel distortion. From what I understand about scaling pixel art, I should be doing integer scaling so that pixels on screen don’t try to get elongated or c…

---

## [How to make 2D map beauty, but not such complex](https://forum.castle-engine.io/t/how-to-make-2d-map-beauty-but-not-such-complex/754)

<div class="topic-metadata">

**Author:** [@Noscow](https://forum.castle-engine.io/u/Noscow)\
**Replies:** 7\
**Last updated:** [March 31, 2023, 6:51am UTC](https://forum.castle-engine.io/t/how-to-make-2d-map-beauty-but-not-such-complex/754 "2023-03-31T06:51:02Z")

</div>

Good day! I think about 2D tile map again, but now i want to make it more beautiful and realistic. For this I must to draw tiles for all terrains and tiles for connect of this different terrains. If I will have many ty…

---

## [How to pass texture to GLSL?](https://forum.castle-engine.io/t/how-to-pass-texture-to-glsl/744)

<div class="topic-metadata">

**Author:** [@saaf](https://forum.castle-engine.io/u/saaf)\
**Replies:** 12\
**Last updated:** [February 20, 2023, 11:50am UTC](https://forum.castle-engine.io/t/how-to-pass-texture-to-glsl/744 "2023-02-20T11:50:30Z")

</div>

I’m trying to implement 2D lighting with GLSL. A light source includes position, radius, color, and texture. I need to pass all light source information on the screen to GLSL. I checked the CGE example, but I didn’t find…

---

## [My CGE exploration](https://forum.castle-engine.io/t/my-cge-exploration/742)

<div class="topic-metadata">

**Author:** [@soastao](https://forum.castle-engine.io/u/soastao)\
**Replies:** 3\
**Last updated:** [February 12, 2023, 9:38am UTC](https://forum.castle-engine.io/t/my-cge-exploration/742 "2023-02-12T09:38:22Z")

</div>

Recently I try to convert to CGE， CGE is the best game engine in pascal I also found some problems and reported 1、FPS low problem Has been resolved，The official response is extremely fast, too efficient 2、TiledMap o…

[Next page](https://forum.castle-engine.io/c/2d/18.md?page=1)
