Any Game Mechanic

The 5 Building Blocks

Patterns

Input
Detection
Transformation/Change Sprite/Animation
Communication
State + Logic

Chest
Input - Chest open when player press key
Detection - Check if player is in range when interacting
Transformation/Change Sprite/Animation
Communication - One way for Player to interact and open chest, other way chest to commnicate to player to give reward.
State + Logic - For chest knowing it's open or closed

Logic and states connect all blocks together

Input
Detection
Transformation/Change Sprite/Animation
Communication
State + Logic