# HAC Tutorial #01: The Game object
By the end of these tutorials you will be able to do all that by yourself, but right now it ease the learning curve to rely on some (hopefully) robust pre-existing logic.
To follow this tutorial you will need the hac-game-lib on your system.
You can either get it on Github or (this is the preferred solution) install it from PyPi by running:
pip3 install virtualenv --user virtualenv hgl-tutorial-1 cd hgl-tutorial-1 source bin/activate pip3 install -i https://test.pypi.org/simple/ hac-game-lib
For some reasons the dependencies seems to be skipped on Test PyPi.
This first tutorial is done under the form of a code along video available on Youtube (a bad one but bear with us, it'll become better over time).
Here is the final code of this tutorial.
from gamelib.Game import Game from gamelib.Board import Board import gamelib.Utils as Utils import gamelib.Sprites as Sprites from gamelib.Characters import Player import time mygame = Game(name='Demo game') board1 = Board(name='Level 1', ui_borders=Sprites.WALL, ui_board_void_cell=Utils.BLACK_SQUARE, player_starting_position=[0,0]) board2 = Board(name='Level 2', ui_borders=Utils.RED_SQUARE, ui_board_void_cell=Utils.BLACK_SQUARE, player_starting_position=[4,4]) mygame.player = Player(name='DaPlay3r', model=Sprites.UNICORN_FACE) mygame.add_board(1,board1) mygame.add_board(2,board2) count = 0 lvl = 1 while count < 10: mygame.clear_screen() mygame.change_level(lvl) mygame.current_board().display() lvl +=1 if lvl > 2: lvl = 1 time.sleep(2) count += 1
If you like that content, feel free to share it on social platforms: