Lesson 2 of 7
Game Characters
Design memorable protagonists, enemies, and NPCs with distinct roles, visuals, and stats.
Learn it
Characters give players someone to care about. Your main character is called the protagonist, and they are usually controlled directly by the player.
Non-player characters (NPCs) bring the world to life by giving quests or trading items, while antagonists and enemies try to get in your way.
Even simple 2D pixel characters can have huge personality through their silhouette, colour choices, and the way they move across the screen.
Key terms
- Protagonist
- The main character driven by the player throughout the game.
- NPC
- Non-Player Character; an entity controlled by code rather than a human.
- Sprite
- A two-dimensional bitmap graphic used to represent an object or character.
- Hitbox
- An invisible geometric shape used to detect collisions with other game objects.
Designing a Character Stat Sheet
Plan out a character by balancing their key properties before writing code.
- 1Define the Role: Decide whether the character is a swift hero, a slow tank, or a ranged spellcaster.
- 2Set Core Stats: Assign numerical values for max health, movement speed, and attack power.
- 3Choose a Visual Palette: Select 3-4 distinct colours that stand out against dark or light background tiles.
- 4Establish Hitbox Size: Determine if their collision box is identical to their sprite or slightly smaller for fair dodging.
Character Property Object
javascriptconst hero = {
name: 'Aria',
kind: 'Player',
maxHealth: 100,
speed: 120,
canDoubleJump: true,
spriteSheet: 'hero_run_strip4.png'
};
console.log(hero.name + ' moves at speed ' + hero.speed);This JavaScript object stores character attributes that control both gameplay capabilities and visual asset references.
Try it
Evaluate these statements about game characters.
An NPC is directly controlled by player controller inputs.
Distinct silhouettes help players quickly recognise enemies during fast gameplay.
Hitboxes must always be three times larger than the visible character sprite.
Enemy behaviours like patrolling or chasing are programmed using game logic.
Challenge
Invent a duo: a player hero and their nemesis. List three stats for each and explain how their abilities counter one another.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/5 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
- Clue 2 locked — reveal it only if you get stuck.
- Clue 3 locked — reveal it only if you get stuck.
- Clue 4 locked — reveal it only if you get stuck.
- Clue 5 locked — reveal it only if you get stuck.
Each clue costs 3 XP (never below 15 XP). You'd earn 30 XP right now.
Extension: Describe the 16x16 pixel colour scheme you would use to make each character instantly recognisable.