28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3 ■ A <strong>Java</strong> 8 Primer: An Introduction to <strong>Java</strong> 8 Concepts and Principles<br />

}<br />

public String getInvinciBagelOrientation() {<br />

return bagelOrientation;<br />

}<br />

public void setInvinciBagelOrientation(String orientation) {<br />

bagelOrientation = orientation;<br />

}<br />

public int getInvinciBagelLifeIndex() {<br />

return lifeIndex;<br />

}<br />

public void setInvinciBagelLifeIndex(int lifespan) {<br />

lifeIndex = lifespan;<br />

}<br />

public String getInvinciBagelDirection() {<br />

return directionFacing;<br />

}<br />

public void setInvinciBagelDirection(String direction) {<br />

directionFacing = direction;<br />

}<br />

public int getInvinciBagelHitsIndex() {<br />

return hitsIndex;<br />

}<br />

public void setInvinciBagelHitsIndex(int damage) {<br />

hitsIndex = damage;<br />

}<br />

public String getInvinciBagelMovementType() {<br />

return movementType;<br />

}<br />

public void setInvinciBagelMovementType(String movement) {<br />

movementType = movement;<br />

}<br />

The convention is to create .get() and .set() methods, as is done here. These allow your <strong>Java</strong> code to easily<br />

access your object states (variables). Now, it is time to install all these attributes (constants), states (variables),<br />

and behaviors (methods) into a blueprint for your object. As mentioned earlier, this is done using the <strong>Java</strong> class<br />

programming structure.<br />

71<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!