Making a Scene
Making a scene
Let’s start off by creating a blank scene for our animation.
This will hold all of our emojis, moves, and other properties.
In where you were told to write code, write this & then run it:
def setup(game: Game) -> None: newScene = SceneAction() newScene.setBackgroundColour(COL_BLUE) game.addScene(newScene)
If you managed to see the correct output - a short flash of a blue square - then good job, you’ve managed to make your first scene!
If not, make sure that you’ve copied down all the code correctly.
There are a few colours built into the program you can use to change the colour of the background:
COL_BLUEin your code to one of these, then run it and see the colour change!
These variables are just shorthands for ‘RGB’ (red, blue, green) values of the colours.
You can express a colour in RGB by describing the ratio of red:blue:green the colour is made of (think of it like mixing paint together).
For example, to create aqua you could write:
COL_AQUA = (0, 255, 255)
i.e. aqua is made with no red, and equal parts blue & green.
And remember… these are optional comments so you don’t have to understand them!