Reader small image

You're reading from  Learning Java by Building Android Games - Third Edition

Product typeBook
Published inMar 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800565869
Edition3rd Edition
Languages
Right arrow
Author (1)
John Horton
John Horton
author image
John Horton

John Horton is a programming and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles. He is the founder of Game Code School.
Read more about John Horton

Right arrow

Testing the game

Run the game in the usual way and observe the output. This is the logcat output:

Debugging: In onCreate
Debugging: In newGame
Debugging: In draw
numberHorizontalPixels: 1776
numberVerticalPixels: 1080
blockSize: 44
gridWidth: 40
gridHeight: 24
horizontalTouched: -100.0
verticalTouched: -100.0
subHorizontalPosition: 0
subVerticalPosition: 0
hit: false
shotsTaken: 0
debugging: true
distanceFromSub: 0

We can see all the usual methods being activated in the same way as before, with the addition of all our debugging variables being printed after the draw method. And if we click the screen, all the debugging data is printed out every time the draw method is called. This is because the draw method calls the printDebuggingText method.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Java by Building Android Games - Third Edition
Published in: Mar 2021Publisher: PacktISBN-13: 9781800565869

Author (1)

author image
John Horton

John Horton is a programming and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles. He is the founder of Game Code School.
Read more about John Horton