Handy Instruction Manual
34BG (Backgrounds)
Petit Computer 3's SmileBASIC provides structures called BG and sprites that make it easy to create game screens with movement.
About BG
BG is an abbreviation for background, and refers to a common structure used for creating background scenery in console games.
Tiles of 16x16 dots in size are arranged together in order to create one larger image (the background). By arranging identical tiles together, you can easily create areas of uniform graphics, such as oceans or fields.
In this product, various BG tiles commonly used in games are predefined. These can be used immediately by simply placing them on the BG screen using the BGPUT instruction.
◆BG Tiles
The BG tiles are preloaded in the GRP5 graphic page. Each tile is 16x16 dots in size and has a tile number in the range 0-1023.
You can check which number corresponds to which tile from the touch screen by using the SMILE tool.
◆BG Screen/Layers
BG tiles are displayed on-screen only after they are placed on the BG screen.
The same BG tile can be placed repeatedly on the screen. The BG screen has coordinates in tile units. One screen can contain 25 tiles horizontally and 15 tiles vertically. Please note that by using the BGSCREEN instruction, you can also use a BG screen that is larger than the display screen.
The BG screen consists of 4 superimposed layers, and BG tiles can be placed on each one. These layers can be used to, for example, distinguish between the background and the foreground, or to enable multi-scrolling.
When placing BG tiles, a layer number (0-3) must be specified.
You can use the BGOFS instruction to change the display location of each layer in dot units. This makes scrolling possible.
You can also change the order in which the layers are superimposed by specifying the Z-coordinate in the BGOFS instruction. This also affects depth in 3D display.
Place a BG Tile - BGPUT Instruction
This instruction is used to place a BG tile on the specified BG screen layer.
Format | BGPUT Layer, X, Y, Tile number
|
---|---|
Usage example | BGPUT 0,12,7,1
This places BG tile 1 near the center of the screen on layer 0 |
Fill an Area with Repeated BG Tiles - BGFILL Instruction
This instruction is used to fill a specified rectangular area with repeated instances of one BG tile.
Format | BGFILL Layer, Start point X, Start point Y, End point X, End point Y, Tile number
|
---|---|
Usage example | BGFILL 0, 1, 1, 23,13, 2
This will fill an area of one tile around the inside of the circumference of layer 0 with BG tile 2 |
Change the Display Location of the BG Screen - BGOFS Instruction
This instruction is used to change the display location and depth of a specified layer.
Format | BGOFS Layer, X, Y, Z
|
---|---|
Usage example | BGOFS 0, -3, -4
This moves the display location of layer 0 by 3 dots to the right and 4 dots downwards |
Clear the BG Screen - BGCLR Instruction
This instruction is used to clear a specified BG screen layer.
Format | BGCLR Layer
|
---|---|
Usage example | BGCLR 0
This clears the display of layer 0 |
Other BG Instructions
There are lots of other BG instructions. Please refer to HELP and the sample programs for information on how to use them. The following is a list of the main instructions.
◆BGSCREEN instruction
Changes the maximum size of the BG screen
◆BGSCALE instruction
Scales the BG screen up/down
◆BGROT instruction
Rotates the BG screen
◆BGCOPY instruction
Copies a specified range from the BG screen to another location
◆BGANIM instruction
Performs animation using the BG
e-manual.pdf (3.0 MB)
Contents
- 1
Basic Information
- 2345678
Introduction
- 9About SmileBASIC
- 10Using SmileBASIC
- 11About BASIC
- 12About the TOP MENU
- 13Projects in the Cloud
- 14Managing Projects / Files
- 15Options
Create Programs
- 16Starting BASIC
- 17Using the Keyboard
- 18What is DIRECT Mode?
- 19Writing in EDIT Mode
- 20Features in EDIT Mode
- 21Managing Programs
- 22About Sample Programs
- 23Using the HELP Tool
- 24Using the SMILE Tool
Introduction to BASIC
- 25"PRINT" and Variables
- 26Using Variables
- 27Conditional Judgment
- 28Computer Colors (RGB)
- 29Graphic Instructions
- 30Sound Instructions
Further Information
- 31
- 323D Effects
- 33Screen Layout
- 34BG (Backgrounds)
- 35Sprites
- 36