© Zarrar Chishti 2017

Zarrar Chishti, Cross Over to HTML5 Game Development, https://doi.org/10.1007/978-1-4842-3291-0_5

5. Take a Shot: Part 1

Zarrar Chishti

(1)Glasgow, UK

“Code never lies, comments sometimes do.”

Ron Jeffries

In this chapter, we’ll work on what we want our gun to do. When the user presses anywhere on the screen, apart from the Reload button, it should be treated as a shot. How a shot happens and the consequences of a shot are dealt with in Chapter 7. For now, let’s look at reacting to a user click.

There will be a few awesome techniques employed, including sprite sheets for animation and mathematics for fluid movement. As you build other games in the future, you may find yourself coming back and reusing these functions and techniques. ...

Get Cross Over to HTML5 Game Development: Use Your Programming Experience to Create Mobile Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.