Skip to Content
Programming 2D Games
book

Programming 2D Games

by Charles Kelly
June 2012
Beginner
438 pages
15h 26m
English
A K Peters/CRC Press
Content preview from Programming 2D Games
413Chapter Review
if(active)
setVisible(true);
else
setVisible(false);
setX(ts.X);
setY(ts.Y);
setVelocity(ts.velocity);
}
Listing 12.29. Updating a client torpedo with data sent from the server.
12.14.3 Modifications to the Game Class
e Game class run function includes a call to the communicate function just as the server
code did (Listing 12.30).
// update(), ai(), collisions() and render() are pure virtual functions
// You must override these functions in your code when you inherit from
// game.h
if (!paused) // If not paused
{
update(); // Update all game items
ai(); // Artificial intelligence
collisions(); // Handle collisions
input->vibrateControllers(frameTime); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning 3D Game Programming

Beginning 3D Game Programming

Tom Miller

Publisher Resources

ISBN: 9781466508705