A1 - Intro to the op_arcade Game Engine
The op_arcade module stands for Opinionated Arcade; an extenion I wrote of Python's Arcade game engine.
We are going to start by discussing the concept of a resource in a game engine.
A resource can be any external file such as a graphic, animation, or sound.
The red arrows labelled with a 1 in the graphic below point to resources:

There are three ways to refer to resources in op_arcade:
- By copying a string from any of the built-in resources found on this page. The first red arrow in the graphic above points to an example of this.
-
By using the built-in Class Constants. Start by typing any of the following to get to your desired category:
cc.Images.Wallscc.Images.Itemscc.Images.Playerscc.Images.Enemiescc.Anims.Players.TopDowncc.Anims.Players.SideScrollingcc.Anims.Enemies
You'll find that after typing
cc., you'll start being provided with options for what you want next, so that you don't need to memorize these. Similarly, if you type another.after any of these, you'll get a list of resources to choose from. You can choose anything from this list that is all capitalized. For examplecc.Images.Items.GEM_GREEN. The second and third red arrows in the graphic above point to examples of this. -
You can provide your own file. As long as it's in the same directory as your code, you just need to type in the filename in quotes.
The blue arrow labelled 2 points to a colour selection for the background.
There are many colours to choose from, and you can get a list by typing: cc.colors.
The orange boxes in the graphic above highlight (x, y) coordinates of where certain items are placed on screen.
Constants
A variable that is in all capitals is called a constant. It is simply a variable that never changes. We use them as a shorthand to refer to values that may either be hard to remember or to type, or for values whose meanings might not be completely obvious when used in the middle of a piece of code.
There are two constants defined in the figure above: WALL_IMAGE and WALL_SCALE.
Our First Three op_arcade Functions
oa.Sprite(x, y, resource)- This creates a sprite on the screen, which is basically a game object. You need to specify three arguments: The (x, y) coordinates of the sprite, and a path to a resource that will be used for the sprite's visual. The resource should be either an image or animation. You can also add the optional argumentscale=___if you want to scale the visual up or down in size.self.create_vwall(x, y, repetitions, resource, scale)- This creates a vertical wall. You need to specify four or five arguments: The (x, y) coordiantes of the starting point, the number of times the wall tile should repeat, a path to a resource that will be used for the sprite's visual, and optionally a scale factor to change the size of the sprite.self.create_hwall(x, y, repetitions, resource, scale)- similar toself.create_vwall, but for horizontal walls.
Your Task
- Change the resources for the walls and some (or all) of the sprites in this program.
- Create at least one additional sprite.
- Add at least two more horizontal walls and two more vertical walls