Screen going black when manipulating game objects

Hello!
I am doing the tutorial war games. I can’t get my tilemap to be centered on screen. All Z values are at zero (except player) but the screen is black when I build. Can you please tell how it’s done?

Can you confirm that your main collection looks like this:

What is the position of the go?

Do you have any errors in the console?

Also check that the tilemap layer has z set to 0

My square is not as glamorous as yours, but it’s positioned like that:


Tilemap layer has z at zero.

Can you please share a zip of the project with me (bjorn.ritzl@king.com)

1 Like

game.project.zip (712 Bytes)

You only shared game.project. I’d like to take a look at the entire project please.

War battles tutorial.zip (2.4 MB)
here :):nerd_face:

Edit:
I changed the title since the problem is now recurrent in several of my projects.

Hi again!

I tried to make another tutorial game (crash course), everything is ok when I create a new go for background and insert a sprite. When I the background sprite the screen turns black when I build the game. I know it worked before, since I see a corner of the image when I just added it as a sprite to the go, but if I move it I get a black screen.

I tried to change the render to -10 and 10 in the init function since that tutorial places the background at -10 in Z position but it did not solve the issue .

function init(self)
	msg.post(".", "acquire_input_focus")
	msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })
end

I looked at over posts that mentioned black screen and I still can’t figure it out. All my files have different names, and I have no error in the console. The screen is black whether i build, rebuild or build in html :dog::wine_glass:. Please help!

Crash.zip (4.5 MB)

In the war battles tutorial project, you have some weird rotation on your “map” object. Reset its rotation to 0, 0, 0 and you will be good to go. You should also probably reset its scale to 1, 1, 1.

In the “crash” project, your script never runs, because you never added the script to an object in your collection! The Z position of your “background_go” is at -10, so with the default projection from -1 to 1, it never renders.

2 Likes

Thank you Ross, you’re a star!
How does the projection is made? I did not touch those variables. Did it happen when I moved my map around?
In the crash project, the script is here from the start (when I made the project). To which object am I supposed to add it?
Thanks!
/:dog::wine_glass:

Probably you tried to drag the map around while the rotation widget (the one with the circles) was selected, rather than the translation widget (the one with the arrows).

At this point in the project it doesn’t matter where you put the script. Any object in your main collection will work. If you are following a tutorial, it will probably tell you where it should go.

2 Likes

How do you change the default render ? And does it makes a difference if it’s minus one or minus ten? It’s still in the background…

You were already doing it, with

msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })

Or at least that lets you change the near and far distance, and you have a few options for what type of projection to use. See the manual for full details.

-1 or -10 don’t matter by themselves, but you will only see things that are between your projection’s near and far distances. With the default -1 to +1, you have a lot of precision close to zero. You can put things at 0.001 or 0.002 for instance.