2D screen not showing and problem with the bullet!

Hello! I’ve been working on my project for school and the 2D screen and the bullet is something I’ve been having a problem for weeks!

[EDIT] Bullet concern: Under the “Main” scene, the bullet shall shoot forward using the spacebar and make the worm disappear, and I am also wondering if there’s something I should do to make extra bullets disappear instead of them wandering around the environment.

Here’s the link to the editor: PlayCanvas | HTML5 Game Engine

Hi @lestortal,

Could you elaborate a bit on the issue you’re having with the bullet? It is difficult for others to assist with an issue if they don’t know what the intended behavior is.

As for your 2D screen, I noticed that the positions of your screen elements are extremely high, causing them to go off screen. I also noticed that in the Editor, they still appear to be within the preview window. The reason for this behavior is that the editor preview assumes that you’re working with a 2D screen at 1.0 scale. Launching the project will place the elements in their actual pixel positions, relative to the size of the display. Also, your 2D screen will always render in screen space, so it does not have to be a child of your player entity to remain still.

While your 2D screen is at 1.0 scale, your scene Root entity is at 0.184. 2D screens themselves do not respond to changes in scale as everything is rendered in screen space, however, the preview object in the editor does. You will either want to account for this when placing your UI elements by manually moving them with the launch window open, or better, resizing your root entity to be at a 1.0 scale and adjusting all of the child entities scales and colliders to fit in the desired area. Doing the latter option will make things less confusing as you won’t ALWAYS have to account for the scale of the root object.

I hope this is helpful.

2 Likes

Thank you so much for this detailed comment! Just updated the concern regarding the bullet and will also attach here the information about it…

Bullet concern: Under the “Main” scene, the bullet shall shoot forward using the spacebar and make the worm disappear, and I am also wondering if there’s something I should do to make extra bullets disappear instead of them wandering around the environment.

1 Like

Hi @lestortal ,

That’s definitely a fair concern to have. You won’t want to be expending resources on bullets that have already served their purpose, even if it isn’t too much. There are a few approaches you could take. One is to surround the outside your scene with come ‘catch-all’ colliders to catch any bullets that eventually hit it. Another might be to have your bullets destroy themselves after existing for a certain period of time, and of course you could also destroy the bullets whenever they come into contact with your existing colliders.

You can use any combination of the approaches listed to cut down on stray bullets taking up processing resources.

I hope this is helpful.

2 Likes

Thanks once again for this detailed guide!!