Sprites are a very important aspect of game development. They are the frame-based animation attached to your game objects. Some sprites are 1-frame while others can get quite complex. Regardless at the point of writing this the Game Pencil Engine allows for easy sprite importing. In the image pictured below you can see a player running sprite and a few of its components.
As pictured above you can see the main engine-related properties of a sprite. Due to window-sizing a few properties are not visible here; but we will go over them below.
When uploading an image into the “Load Resource” button or selecting the “Edit Resource” button on the main page of the sprite editor you will enter the menu above.
Let’s go over each input field to firmly fully understand how to work with sprites within the editor.
Sprite Main Data
- Frame Count – this number between 0 and X is the amount of frames one sprite animation makes. This value was added into 1.x and when loading older projects it takes the calculated value from the next fields.
- Frame Width – This number in pixels is the width of each frame in an individual sprite animation.
- Frame Height – This number in pixels is the height of each frame in an individual sprite animation.
- Horizontal Pixel Offset – This number in pixels is the horizontal margin from (0,0) to the first frame of a sprite image.
- Vertical Pixel Offset – This number in pixels is the vertical margin from (0,0) to the first frame of a sprite image.
- Horizontal Frame Padding – This number in pixels is the horizontal padding between sprite frame cells.
- Vertical Frame Padding – This number in pixels is the vertical padding between sprite frame cells.
- Preloaded – If checked, this makes the sprite part of the game’s opening loading screen. If false, it is loaded when needed(although its properties is defaulted to its editor value on export for coding purposes).
3.Sprite Meta Data
Besides sprite properties, the sprite editor also handles useful meta-data for the sprite that helps it communicate to the editor and also calculate its collision values for when being exported in the engine. Below is a list of sprite meta data you can customize:
- Sprite name – the name of the sprite in the editor and it’s exported keyword(useful for coding).
- Editor Preview Frame – This is the subimage’s index you will see when your sprite is references( whether in the resource menu, object sprites, scene editor, etc). It is defaulted to 0.
- Collision shape – A rectangle or a circle as of version 1.1x.
- Collision (X,Y) – This information is used to calculate the offsets per sprite frame when determining it’s collision values.
- Collision (R) – used for the radius of the sprite when handling collision if the collision shape is a circle.
- Collision (W, H) – used for the (width, height)of the sprite when handling collision if the collision shape is a rectangle.
- Preview collision shape – Leave checked to see a glimpse of the collision shape is over each sprite frame.