gurkenlabs / litiengine

LITIENGINE 🕹 The pure 2D java game engine.
https://litiengine.com/
MIT License
718 stars 94 forks source link

Modifying props at runtime doesn't seem to work properly #798

Closed dominusac12 closed 6 months ago

dominusac12 commented 7 months ago

Describe the bug I've created multiple props in the LitiUtil the render type is none and collision is false. Now I want to change the render type while playing the game. So is used the following code:

  for (Prop prop: Game.world().environment().getProps()){
            prop.setRenderWithLayer(false);
            prop.setRenderType(RenderType.NORMAL);
        }

This didn't worked so I tried debugging it. The props will be queried right, so I think the foreach-Loop is right. A bit clueless I tried to change other things of the props. When I tried changing the collision this also doesn't work, but changing the x-Position worked. I also tried using the for loop at different location like right after Loading the environment, Game.world().onLoaded, in the renderer. But this didn't changed problem.

Maybe I'm doing something wrong but at the moment I don't know what.

Expected behavior Rendertype and collision can be changed at runtime

Your System:

github-actions[bot] commented 7 months ago

Thank you for your reporting your first LITIENGINE issue! We are looking forward to your further contributions.

nightm4re94 commented 6 months ago

Setting RenderTypes at runtime indeed did not change which collection of renderables an entity was stored in, despite the entity's RenderType attribute changing successfully. I've made sure that the environment is now handling this properly.