SlideShare a Scribd company logo
Sprite Animation
An exercise on filling circles and
polygons to create the animated
sprite used in ‘Pac Man’
What is a ‘sprite’?
• It’s a small graphics pixmap image
• It’s normally stored in off-screen VRAM
• It’s ready to be copied to on-screen VRAM
• The copying operation is called a ‘BitBlt’
• (Bit blit is a data operation commonly used in computer graphics in which
several bitmaps are combined into one using a boolean function. The
operation involves at least two bitmaps, one source and destination,
possibly a third that is often called the "mask" and sometimes a fourth used
to create a stencil.)
• Several sprites can support an animation
• Let’s see how to create a sprite array, then
synchronize BitBlts with Vertical Retrace
The ‘Pac Man’ sprite
1. Fill a circle with the foreground color
2. Fill a triangle in the background color
The ‘Pac Man’ sprite-array
Create an array of sprites, arranged in a sequence that
matches the order in which they will be drawn to VRAM
Typical animation loop
sprite pacman[ 8 ]; // the array of sprite-images
int i = 0;
while ( !done )
{
draw( pacman[ i ], vramptr );
vsync(); // await next vertical retrace
hide( sprite[ i ], vramptr );
i = ( ++i ) % 8; // cycle through sprite array
}
Multiple sprite-arrays
RIGHT
DOWN
UP
Demo: ‘sprites.cpp’
• Study the source-code for this demo
• Arrange your sprites in an array
• Write a sprite-animation loop
• Incorporate movement in sprite’s location
• Let user control direction with arrow-keys
• Store your sprite-arrays in offscreen vram

More Related Content

PDF
Pro Unity Game Development with C-sharp Book
PDF
Introduction to Pygame (Lecture 7 Python Game Development)
PPT
Writing and Interactive Storytelling (lecture 6 Game Development)
PPT
Principles of Game Design (Lecture 5 Game Development)
PPT
Formal Game Elements lecture 4 Game Development
PPTX
Game Development with Unity3D (Game Development lecture 3)
PDF
Lecture 2 history of video games (Game Development)
PPTX
Lecture 1 Introduction to games development
Pro Unity Game Development with C-sharp Book
Introduction to Pygame (Lecture 7 Python Game Development)
Writing and Interactive Storytelling (lecture 6 Game Development)
Principles of Game Design (Lecture 5 Game Development)
Formal Game Elements lecture 4 Game Development
Game Development with Unity3D (Game Development lecture 3)
Lecture 2 history of video games (Game Development)
Lecture 1 Introduction to games development

More from abdulrafaychaudhry (6)

PPT
Use case diagrams
PPT
Lahore Resolution 1940 and Aftermath
PPT
Pakistan studies First Military Regime And The Second Republic 1958-69
PPTX
Graphical reprsentation dsa (DATA STRUCTURE ALGORITHM)
DOCX
importance of resources allocation in formal method of software engineering ...
PPTX
Software Engineering Process
Use case diagrams
Lahore Resolution 1940 and Aftermath
Pakistan studies First Military Regime And The Second Republic 1958-69
Graphical reprsentation dsa (DATA STRUCTURE ALGORITHM)
importance of resources allocation in formal method of software engineering ...
Software Engineering Process
Ad

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
top salesforce developer skills in 2025.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
System and Network Administration Chapter 2
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Reimagine Home Health with the Power of Agentic AI​
top salesforce developer skills in 2025.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Operating system designcfffgfgggggggvggggggggg
Odoo Companies in India – Driving Business Transformation.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
System and Network Administration Chapter 2
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
ai tools demonstartion for schools and inter college
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How Creative Agencies Leverage Project Management Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Wondershare Filmora 15 Crack With Activation Key [2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
wealthsignaloriginal-com-DS-text-... (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Ad

sprites and animation concept (Lecture 8 Game Development)

  • 1. Sprite Animation An exercise on filling circles and polygons to create the animated sprite used in ‘Pac Man’
  • 2. What is a ‘sprite’? • It’s a small graphics pixmap image • It’s normally stored in off-screen VRAM • It’s ready to be copied to on-screen VRAM • The copying operation is called a ‘BitBlt’ • (Bit blit is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. The operation involves at least two bitmaps, one source and destination, possibly a third that is often called the "mask" and sometimes a fourth used to create a stencil.) • Several sprites can support an animation • Let’s see how to create a sprite array, then synchronize BitBlts with Vertical Retrace
  • 3. The ‘Pac Man’ sprite 1. Fill a circle with the foreground color 2. Fill a triangle in the background color
  • 4. The ‘Pac Man’ sprite-array Create an array of sprites, arranged in a sequence that matches the order in which they will be drawn to VRAM
  • 5. Typical animation loop sprite pacman[ 8 ]; // the array of sprite-images int i = 0; while ( !done ) { draw( pacman[ i ], vramptr ); vsync(); // await next vertical retrace hide( sprite[ i ], vramptr ); i = ( ++i ) % 8; // cycle through sprite array }
  • 7. Demo: ‘sprites.cpp’ • Study the source-code for this demo • Arrange your sprites in an array • Write a sprite-animation loop • Incorporate movement in sprite’s location • Let user control direction with arrow-keys • Store your sprite-arrays in offscreen vram