Chapter III

Making a Scene

  1. 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)
    

    arrow_down

    Blue Screen

    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.

  2. Scene Properties

    There are a few colours built into the program you can use to change the colour of the background:

    • COL_WHITE
    • COL_BLACK
    • COL_RED
    • COL_BLUE
    • COL_GREEN
    • COL_YELLOW
    • COL_ORANGE

    Try changing COL_BLUE in 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!