Skip to main content

A Limited Number of Lives

  • Chapter
  • First Online:
  • 2269 Accesses

Abstract

In this chapter, we are going to make the game more interesting by giving the player a limited number of lives. If the player misses too many paint cans, she/he dies. In this chapter, we will discuss how to deal with that, and how to display the current number of lives to the player. In order to do the latter, we introduce a few programming concepts that allow us to repeat a group of instructions several times, notably the for and while instructions. We will also show how to restart/reset a game after the game is over.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer-Verlag GmbH Germany, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

van Toll, W., Egges, A., Fokker, J.D. (2019). A Limited Number of Lives. In: Learning C# by Programming Games. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-59252-6_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-59252-6_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-59251-9

  • Online ISBN: 978-3-662-59252-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics