To get started with JoBase, you can use the online editor here. When you are ready, follow the steps on the homepage to install JoBase on your local computer.
Let's start by importing JoBase.
from JoBase import *
This imports and initialises all the tools in the JoBase library. When you run the code, it should print Welcome to JoBase in the Python Shell. Now add the following code.
from JoBase import * run()
The run method displays the window. When you run the code, you should have a blank, resizable window. If you are using JoBase in the browser, the program will keep running until you stop it. These two lines of code are necessary for every JoBase game.
Now let's create some text.
from JoBase import * text = Text("Hello World") run()
The line of code above creates some text, we can draw it by making a game loop.
from JoBase import * text = Text("Hello World") def loop(): text.draw() run()
This will render a Hello World message on the screen. Remember to always draw things in the game loop so that they are displayed every frame.
Now we can make it more interesting.
from JoBase import * text = Text("Hello World", color = NAVY) def loop(): text.angle += 1 text.draw() run()
In the code above, we give the text colour and rotate it in the loop. Now let's make it interactive.
from JoBase import * text = Text("Hello World", color = NAVY) def loop(): text.angle += 1 text.draw() if cursor.press: text.content = "Click!" text.color = RED run()
Now you understand the basics of a JoBase application, you can create your first game. If you are familiar with Python, please use the reference to get an understanding of the features of JoBase.