In this activity, we are going to load up a skybox in the game engine. A skybox is basically a cube with image files on each of the 6 faces of the cube with a camera in the center. The viewpoint for the game user is through the camera.
Note that this lesson is not accessible for unsighted users since the output will be displayed visually, but we will add accessibility in the next lesson. We have left the audio sound from the previous lesson so you can hear when the skybox is loaded.
The first thing that we need to do is load the 6 images for the faces of the cube for the skybox. We do this by calling the Load action of the skybox object and give it the file names of images for the right, left, top, bottom, front and back of the skybox in that order.
The image files we will use for this first skybox are:
So our first line of code in the CreateGame action will look like this:
skybox:Load("media/astro/right.jpg", "media/astro/left.jpg", "media/astro/top.jpg", "media/astro/bottom.jpg", "media/astro/front.jpg", "media/astro/back.jpg")
Then to display the skybox around the camera, we just need to call the SetSkybox command like this:
When you are done, click the green Run Program button and the skybox will come up. You can't move around and do anything yet, but you the front image should be displayed.
Exploration Challenge (Optional):
For this Exploration Challege, experiment with the actions that you can call from the reference page on the Skybox class. Try to use the Rotate() or InvertSkybox() actions to see what happens.
In the next tutorial, we will discuss Astronomy Hour of Code | Activity 0, which describes Accessible astronomy themed Hour of Code.