|
|
<!DOCTYPE HTML> <html lang="de"> <head> <!-- Generated by javadoc (17) on Fri May 27 21:55:02 CEST 2022 --> <title>GameObject</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="dc.created" content="2022-05-27"> <meta name="description" content="declaration: package: gameobjects, class: GameObject"> <meta name="generator" content="javadoc/ClassWriterImpl"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../script-dir/jquery-ui.min.css" title="Style"> <link rel="stylesheet" type="text/css" href="../jquery-ui.overrides.css" title="Style"> <script type="text/javascript" src="../script.js"></script> <script type="text/javascript" src="../script-dir/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="../script-dir/jquery-ui.min.js"></script> </head> <body class="class-declaration-page"> <script type="text/javascript">var evenRowColor = "even-row-color"; var oddRowColor = "odd-row-color"; var tableTab = "table-tab"; var activeTableTab = "active-table-tab"; var pathtoroot = "../"; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="flex-box"> <header role="banner" class="flex-header"> <nav role="navigation"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="top-nav" id="navbar-top"> <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> <li><a href="../index.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="nav-bar-cell1-rev">Class</li> <li><a href="class-use/GameObject.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../index-files/index-1.html">Index</a></li> <li><a href="../help-doc.html#class">Help</a></li> </ul> </div> <div class="sub-nav"> <div> <ul class="sub-nav-list"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field-summary">Field</a> | </li> <li><a href="#constructor-summary">Constr</a> | </li> <li><a href="#method-summary">Method</a></li> </ul> <ul class="sub-nav-list"> <li>Detail: </li> <li><a href="#field-detail">Field</a> | </li> <li><a href="#constructor-detail">Constr</a> | </li> <li><a href="#method-detail">Method</a></li> </ul> </div> <div class="nav-list-search"><label for="search-input">SEARCH:</label> <input type="text" id="search-input" value="search" disabled="disabled"> <input type="reset" id="reset-button" value="reset" disabled="disabled"> </div> </div> <!-- ========= END OF TOP NAVBAR ========= --> <span class="skip-nav" id="skip-navbar-top"></span></nav> </header> <div class="flex-content"> <main role="main"> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">gameobjects</a></div> <h1 title="Class GameObject" class="title">Class GameObject</h1> </div> <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a> <div class="inheritance">gameobjects.GameObject</div> </div> <section class="class-description" id="class-description"> <dl class="notes"> <dt>Direct Known Subclasses:</dt> <dd><code><a href="AnimatedGameobject.html" title="class in gameobjects">AnimatedGameobject</a></code>, <code><a href="EgoObject.html" title="class in gameobjects">EgoObject</a></code>, <code><a href="FallingStar.html" title="class in gameobjects">FallingStar</a></code>, <code><a href="RectObject.html" title="class in gameobjects">RectObject</a></code>, <code><a href="TextObject.html" title="class in gameobjects">TextObject</a></code></dd> </dl> <hr> <div class="type-signature"><span class="modifiers">public abstract class </span><span class="element-name type-name-label">GameObject</span> <span class="extends-implements">extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div> <div class="block">The class <a href="GameObject.html" title="class in gameobjects"><code>GameObject</code></a> represents a (possibly animated) object appearing in a level of the game. It is therefore attached to an instance of the class <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a>. A GameObject has at least the following properties: <ul> <li>2D screen position <li>2D speed <li>a name that is unique within a certain <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a><br> <li>a reference to the <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a> object it belongs to<br> <li>a reference to an instance of <a href="../controller/ObjectController.html" title="class in controller"><code>ObjectController</code></a> that handles the movement logic of the object<br> <li>a (circular) radius for simple collision checking. This may be handled differently in subclasses<br> </ul> The main task of GameObject, or its subclasses, is to draw the object on the screen, which is handles by the <a href="#draw(java.awt.Graphics2D)"><code>draw(Graphics2D)</code></a> method. It is this method that must be redefined if a new appearance should be realized. For introducing new behavior, it is sufficient to supply a different <a href="../controller/ObjectController.html" title="class in controller"><code>ObjectController</code></a> instance when constructing a GameObject.</div> </section> <section class="summary"> <ul class="summary-list"> <!-- =========== FIELD SUMMARY =========== --> <li> <section class="field-summary" id="field-summary"> <h2>Field Summary</h2> <div class="caption"><span>Fields</span></div> <div class="summary-table three-column-summary"> <div class="table-header col-first">Modifier and Type</div> <div class="table-header col-second">Field</div> <div class="table-header col-last">Description</div> <div class="col-first even-row-color"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> <div class="col-second even-row-color"><code><a href="#id" class="member-name-link">id</a></code></div> <div class="col-last even-row-color"> </div> <div class="col-first odd-row-color"><code>static final int</code></div> <div class="col-second odd-row-color"><code><a href="#MASK" class="member-name-link">MASK</a></code></div> <div class="col-last odd-row-color"> </div> <div class="col-first even-row-color"><code>static final int</code></div> <div class="col-second even-row-color"><code><a href="#RADIUS" class="member-name-link">RADIUS</a></code></div> <div class="col-last even-row-color"> </div> <div class="col-first odd-row-color"><code>static final int</code></div> <div class="col-second odd-row-color"><code><a href="#RECTANGLE" class="member-name-link">RECTANGLE</a></code></div> <div class="col-last odd-row-color"> </div> <div class="col-first even-row-color"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html" title="class or interface in java.util" class="external-link">LinkedList</a><<a href="../collider/Collider.html" title="class in collider">Collider</a>></code></div> <div class="col-second even-row-color"><code><a href="#scol" class="member-name-link">scol</a></code></div> <div class="col-last even-row-color"> </div> </div> </section> </li> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <li> <section class="constructor-summary" id="constructor-summary"> <h2>Constructor Summary</h2> <div class="caption"><span>Constructors</span></div> <div class="summary-table two-column-summary"> <div class="table-header col-first">Constructor</div> <div class="table-header col-last">Description</div> <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.lang.String,playground.Playground,double,double,double,double)" class="member-name-link">GameObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> id, <a href="../playground/Playground.html" title="class in playground">Playground</a> playground, double x, double y, double vx, double vy)</code></div> <div class="col-last even-row-color"> <div class="block">Constructor to initialize a GameObject, respectively set the current <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a> instance this GameObject belongs to.</div> </div> <div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(java.lang.String,playground.Playground,controller.ObjectController,double,double,double,double)" class="member-name-link">GameObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> id, <a href="../playground/Playground.html" title="class in playground">Playground</a> playground, <a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> controller, double x, double y, double vx, double vy)</code></div> <div class="col-last odd-row-color"> <div class="block">Constructor to initialize a GameObject, respectively set the current Playground instance this GameObject belongs to.</div> </div> </div> </section> </li> <!-- ========== METHOD SUMMARY =========== --> <li> <section class="method-summary" id="method-summary"> <h2>Method Summary</h2> <div id="method-summary-table"> <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> <div id="method-summary-table.tabpanel" role="tabpanel"> <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> <div class="table-header col-first">Modifier and Type</div> <div class="table-header col-second">Method</div> <div class="table-header col-last">Description</div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GameObject.html" title="class in gameobjects">GameObject</a></code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addArtist(rendering.Artist)" class="member-name-link">addArtist</a><wbr>(<a href="../rendering/Artist.html" title="class in rendering">Artist</a> a)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Sets the artist to be used for drawing the object onto visible canvas area.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addCollider(collider.Collider)" class="member-name-link">addCollider</a><wbr>(<a href="../collider/Collider.html" title="class in collider">Collider</a> c)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">saves the collider in the internal list of Colliders to be used for this GameObject.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GameObject.html" title="class in gameobjects">GameObject</a></code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addController(controller.ObjectController)" class="member-name-link">addController</a><wbr>(<a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> c)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Sets the controller to use for this GameObject's logical behavior.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#collisionDetection(gameobjects.GameObject)" class="member-name-link">collisionDetection</a><wbr>(<a href="GameObject.html" title="class in gameobjects">GameObject</a> other)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Collision detection implemented by iteration through the own list of <a href="../collider/Collider.html" title="class in collider"><code>Collider</code></a> and calling their <a href="../collider/Collider.html#collidesWith(collider.Collider)"><code>Collider.collidesWith(Collider)</code></a> method to check collision with the given parameter instance of other <a href="GameObject.html" title="class in gameobjects"><code>GameObject</code></a>.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#draw(java.awt.Graphics2D)" class="member-name-link">draw</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html" title="class or interface in java.awt" class="external-link">Graphics2D</a> g)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Draws the object in its current state.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GameObject.html" title="class in gameobjects">GameObject</a></code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#generateColliders()" class="member-name-link">generateColliders</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">generates and sets collider(s) for this GameObject.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getGameTime()" class="member-name-link">getGameTime</a>()</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getId()" class="member-name-link">getId</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">return the unique object ID.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../controller/ObjectController.html" title="class in controller">ObjectController</a></code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getObjectController()" class="member-name-link">getObjectController</a>()</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Access to object controller.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getObjectFlag(java.lang.String)" class="member-name-link">getObjectFlag</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getOrCreateObjectFlag(java.lang.String,java.lang.Object)" class="member-name-link">getOrCreateObjectFlag</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> createValue)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../playground/Playground.html" title="class in playground">Playground</a></code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPlayground()" class="member-name-link">getPlayground</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getVX()" class="member-name-link">getVX</a>()</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">gets the screen X speed in pixels per frame.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getVY()" class="member-name-link">getVY</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">gets the screen Y speed in pixels per frame.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getX()" class="member-name-link">getX</a>()</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">gets the screen X position.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getY()" class="member-name-link">getY</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">gets the screen Y position.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isActive()" class="member-name-link">isActive</a>()</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GameObject.html" title="class in gameobjects">GameObject</a></code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setActive(boolean)" class="member-name-link">setActive</a><wbr>(boolean flag)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setColliders(java.util.LinkedList)" class="member-name-link">setColliders</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html" title="class or interface in java.util" class="external-link">LinkedList</a><<a href="../collider/Collider.html" title="class in collider">Collider</a>> l)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">sets colliders.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setComponentProperty(java.lang.String,java.lang.String,java.lang.Object)" class="member-name-link">setComponentProperty</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> comp, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> property, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">calls via reflection a method of a component if this GameObjects instance and provides the given value as String parameter.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setObjectController(controller.ObjectController)" class="member-name-link">setObjectController</a><wbr>(<a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> controller)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">Sets a new object controller (replaces any former one).</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setObjectFlag(java.lang.String,java.lang.Object)" class="member-name-link">setObjectFlag</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setPlayground(playground.Playground)" class="member-name-link">setPlayground</a><wbr>(<a href="../playground/Playground.html" title="class in playground">Playground</a> playground)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setVX(double)" class="member-name-link">setVX</a><wbr>(double vx)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">set screen x speed in pixel per frame</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setVY(double)" class="member-name-link">setVY</a><wbr>(double vy)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">set screen y speed in pixel per frame.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setX(double)" class="member-name-link">setX</a><wbr>(double x)</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">set screen x position.</div> </div> <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setY(double)" class="member-name-link">setY</a><wbr>(double y)</code></div> <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">set screen y position.</div> </div> <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#updateObject()" class="member-name-link">updateObject</a>()</code></div> <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> <div class="block">triggers this GameObjects own controller (if set) to update the object.</div> </div> </div> </div> </div> <div class="inherited-list"> <h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> </section> </li> </ul> </section> <section class="details"> <ul class="details-list"> <!-- ============ FIELD DETAIL =========== --> <li> <section class="field-details" id="field-detail"> <h2>Field Details</h2> <ul class="member-list"> <li> <section class="detail" id="RADIUS"> <h3>RADIUS</h3> <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">int</span> <span class="element-name">RADIUS</span></div> <dl class="notes"> <dt>See Also:</dt> <dd> <ul class="see-list"> <li><a href="../constant-values.html#gameobjects.GameObject.RADIUS">Constant Field Values</a></li> </ul> </dd> </dl> </section> </li> <li> <section class="detail" id="RECTANGLE"> <h3>RECTANGLE</h3> <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">int</span> <span class="element-name">RECTANGLE</span></div> <dl class="notes"> <dt>See Also:</dt> <dd> <ul class="see-list"> <li><a href="../constant-values.html#gameobjects.GameObject.RECTANGLE">Constant Field Values</a></li> </ul> </dd> </dl> </section> </li> <li> <section class="detail" id="MASK"> <h3>MASK</h3> <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">int</span> <span class="element-name">MASK</span></div> <dl class="notes"> <dt>See Also:</dt> <dd> <ul class="see-list"> <li><a href="../constant-values.html#gameobjects.GameObject.MASK">Constant Field Values</a></li> </ul> </dd> </dl> </section> </li> <li> <section class="detail" id="id"> <h3>id</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name">id</span></div> </section> </li> <li> <section class="detail" id="scol"> <h3>scol</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html" title="class or interface in java.util" class="external-link">LinkedList</a><<a href="../collider/Collider.html" title="class in collider">Collider</a>></span> <span class="element-name">scol</span></div> </section> </li> </ul> </section> </li> <!-- ========= CONSTRUCTOR DETAIL ======== --> <li> <section class="constructor-details" id="constructor-detail"> <h2>Constructor Details</h2> <ul class="member-list"> <li> <section class="detail" id="<init>(java.lang.String,playground.Playground,double,double,double,double)"> <h3>GameObject</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="element-name">GameObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> id, <a href="../playground/Playground.html" title="class in playground">Playground</a> playground, double x, double y, double vx, double vy)</span></div> <div class="block">Constructor to initialize a GameObject, respectively set the current <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a> instance this GameObject belongs to.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>id</code> - unique ID for this GameObject (should not be null or empty String)</dd> <dd><code>playground</code> - the Playground the GameObject belongs to (should not be null)</dd> <dd><code>x</code> - initial screen position in direction horizontal (positive value including zero)</dd> <dd><code>y</code> - initial screen position in direction vertical (positive value including zero)</dd> <dd><code>vx</code> - initial speed (velocity) in direction horizontal (can be negative, zero, positive)</dd> <dd><code>vy</code> - initial speed (velocity) in direction horizontal (can be negative, zero, positive)</dd> </dl> </section> </li> <li> <section class="detail" id="<init>(java.lang.String,playground.Playground,controller.ObjectController,double,double,double,double)"> <h3>GameObject</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="element-name">GameObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> id, <a href="../playground/Playground.html" title="class in playground">Playground</a> playground, <a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> controller, double x, double y, double vx, double vy)</span></div> <div class="block">Constructor to initialize a GameObject, respectively set the current Playground instance this GameObject belongs to.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>id</code> - unique ID for this GameObject (should not be null or empty String)</dd> <dd><code>playground</code> - the Playground the GameObject belongs to (should not be null)</dd> <dd><code>controller</code> - controller instance to be used for this GameObject (can be null)</dd> <dd><code>x</code> - initial screen position in direction horizontal (positive value including zero)</dd> <dd><code>y</code> - initial screen position in direction vertical (positive value including zero)</dd> <dd><code>vx</code> - initial speed (velocity) in direction horizontal (can be negative, zero, positive)</dd> <dd><code>vy</code> - initial speed (velocity) in direction horizontal (can be negative, zero, positive)</dd> </dl> </section> </li> </ul> </section> </li> <!-- ============ METHOD DETAIL ========== --> <li> <section class="method-details" id="method-detail"> <h2>Method Details</h2> <ul class="member-list"> <li> <section class="detail" id="setColliders(java.util.LinkedList)"> <h3>setColliders</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setColliders</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html" title="class or interface in java.util" class="external-link">LinkedList</a><<a href="../collider/Collider.html" title="class in collider">Collider</a>> l)</span></div> <div class="block">sets colliders.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>l</code> - LinkedList of Colliders.</dd> </dl> </section> </li> <li> <section class="detail" id="generateColliders()"> <h3>generateColliders</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="GameObject.html" title="class in gameobjects">GameObject</a></span> <span class="element-name">generateColliders</span>()</div> <div class="block">generates and sets collider(s) for this GameObject. This implementation does nothing. Intended to be overridden by subclasses.</div> <dl class="notes"> <dt>Returns:</dt> <dd>instance of this GameObject (this).</dd> </dl> </section> </li> <li> <section class="detail" id="addController(controller.ObjectController)"> <h3>addController</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="GameObject.html" title="class in gameobjects">GameObject</a></span> <span class="element-name">addController</span><wbr><span class="parameters">(<a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> c)</span></div> <div class="block">Sets the controller to use for this GameObject's logical behavior.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>c</code> - instance to be used.</dd> <dt>Returns:</dt> <dd>the current instance (this).</dd> </dl> </section> </li> <li> <section class="detail" id="addArtist(rendering.Artist)"> <h3>addArtist</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="GameObject.html" title="class in gameobjects">GameObject</a></span> <span class="element-name">addArtist</span><wbr><span class="parameters">(<a href="../rendering/Artist.html" title="class in rendering">Artist</a> a)</span></div> <div class="block">Sets the artist to be used for drawing the object onto visible canvas area.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>a</code> - instance to be used for calling <a href="../rendering/Artist.html#draw(java.awt.Graphics2D)"><code>Artist.draw(Graphics2D)</code></a>.</dd> <dt>Returns:</dt> <dd>the current instance (this).</dd> </dl> </section> </li> <li> <section class="detail" id="addCollider(collider.Collider)"> <h3>addCollider</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">addCollider</span><wbr><span class="parameters">(<a href="../collider/Collider.html" title="class in collider">Collider</a> c)</span></div> <div class="block">saves the collider in the internal list of Colliders to be used for this GameObject.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>c</code> - instance to be added to internal list</dd> </dl> </section> </li> <li> <section class="detail" id="getPlayground()"> <h3>getPlayground</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="../playground/Playground.html" title="class in playground">Playground</a></span> <span class="element-name">getPlayground</span>()</div> </section> </li> <li> <section class="detail" id="setPlayground(playground.Playground)"> <h3>setPlayground</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setPlayground</span><wbr><span class="parameters">(<a href="../playground/Playground.html" title="class in playground">Playground</a> playground)</span></div> </section> </li> <li> <section class="detail" id="setComponentProperty(java.lang.String,java.lang.String,java.lang.Object)"> <h3>setComponentProperty</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setComponentProperty</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> comp, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> property, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</span></div> <div class="block">calls via reflection a method of a component if this GameObjects instance and provides the given value as String parameter.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>comp</code> - class name of GameObject component. Currently only "controller" is supported, otherwise nothing happens.</dd> <dd><code>property</code> - method name of the component to call.</dd> <dd><code>value</code> - argument to pass to the method as String parameter.</dd> </dl> </section> </li> <li> <section class="detail" id="setObjectFlag(java.lang.String,java.lang.Object)"> <h3>setObjectFlag</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setObjectFlag</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</span></div> </section> </li> <li> <section class="detail" id="getObjectFlag(java.lang.String)"> <h3>getObjectFlag</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span> <span class="element-name">getObjectFlag</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag)</span></div> </section> </li> <li> <section class="detail" id="getOrCreateObjectFlag(java.lang.String,java.lang.Object)"> <h3>getOrCreateObjectFlag</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span> <span class="element-name">getOrCreateObjectFlag</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> flag, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> createValue)</span></div> </section> </li> <li> <section class="detail" id="isActive()"> <h3>isActive</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isActive</span>()</div> </section> </li> <li> <section class="detail" id="setActive(boolean)"> <h3>setActive</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="GameObject.html" title="class in gameobjects">GameObject</a></span> <span class="element-name">setActive</span><wbr><span class="parameters">(boolean flag)</span></div> </section> </li> <li> <section class="detail" id="getId()"> <h3>getId</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name">getId</span>()</div> <div class="block">return the unique object ID.</div> <dl class="notes"> <dt>Returns:</dt> <dd>unique object ID</dd> </dl> </section> </li> <li> <section class="detail" id="getX()"> <h3>getX</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">getX</span>()</div> <div class="block">gets the screen X position.</div> <dl class="notes"> <dt>Returns:</dt> <dd>screen x position</dd> </dl> </section> </li> <li> <section class="detail" id="getY()"> <h3>getY</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">getY</span>()</div> <div class="block">gets the screen Y position.</div> <dl class="notes"> <dt>Returns:</dt> <dd>screen Y position</dd> </dl> </section> </li> <li> <section class="detail" id="getVX()"> <h3>getVX</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">getVX</span>()</div> <div class="block">gets the screen X speed in pixels per frame.</div> <dl class="notes"> <dt>Returns:</dt> <dd>screen x speed</dd> </dl> </section> </li> <li> <section class="detail" id="getVY()"> <h3>getVY</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">getVY</span>()</div> <div class="block">gets the screen Y speed in pixels per frame.</div> <dl class="notes"> <dt>Returns:</dt> <dd>screen y speed</dd> </dl> </section> </li> <li> <section class="detail" id="setX(double)"> <h3>setX</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setX</span><wbr><span class="parameters">(double x)</span></div> <div class="block">set screen x position.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>x</code> - new position</dd> </dl> </section> </li> <li> <section class="detail" id="setY(double)"> <h3>setY</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setY</span><wbr><span class="parameters">(double y)</span></div> <div class="block">set screen y position.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>y</code> - new position</dd> </dl> </section> </li> <li> <section class="detail" id="setVX(double)"> <h3>setVX</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setVX</span><wbr><span class="parameters">(double vx)</span></div> <div class="block">set screen x speed in pixel per frame</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>vx</code> - new x speed</dd> </dl> </section> </li> <li> <section class="detail" id="setVY(double)"> <h3>setVY</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setVY</span><wbr><span class="parameters">(double vy)</span></div> <div class="block">set screen y speed in pixel per frame.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>vy</code> - new y speed.</dd> </dl> </section> </li> <li> <section class="detail" id="setObjectController(controller.ObjectController)"> <h3>setObjectController</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setObjectController</span><wbr><span class="parameters">(<a href="../controller/ObjectController.html" title="class in controller">ObjectController</a> controller)</span></div> <div class="block">Sets a new object controller (replaces any former one).</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>controller</code> - An instance of <a href="../controller/ObjectController.html" title="class in controller"><code>ObjectController</code></a> or one of its subclasses.</dd> </dl> </section> </li> <li> <section class="detail" id="getObjectController()"> <h3>getObjectController</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="../controller/ObjectController.html" title="class in controller">ObjectController</a></span> <span class="element-name">getObjectController</span>()</div> <div class="block">Access to object controller.</div> <dl class="notes"> <dt>Returns:</dt> <dd>the controller for this object.</dd> </dl> </section> </li> <li> <section class="detail" id="getGameTime()"> <h3>getGameTime</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">getGameTime</span>()</div> </section> </li> <li> <section class="detail" id="collisionDetection(gameobjects.GameObject)"> <h3>collisionDetection</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">collisionDetection</span><wbr><span class="parameters">(<a href="GameObject.html" title="class in gameobjects">GameObject</a> other)</span></div> <div class="block">Collision detection implemented by iteration through the own list of <a href="../collider/Collider.html" title="class in collider"><code>Collider</code></a> and calling their <a href="../collider/Collider.html#collidesWith(collider.Collider)"><code>Collider.collidesWith(Collider)</code></a> method to check collision with the given parameter instance of other <a href="GameObject.html" title="class in gameobjects"><code>GameObject</code></a>.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>other</code> - instance of the other GameObject to check collision with</dd> <dt>Returns:</dt> <dd>true if collision is detected, false otherwise</dd> </dl> </section> </li> <li> <section class="detail" id="updateObject()"> <h3>updateObject</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">updateObject</span>()</div> <div class="block">triggers this GameObjects own controller (if set) to update the object.</div> <dl class="notes"> <dt>See Also:</dt> <dd> <ul class="see-list"> <li><code>controller</code></li> </ul> </dd> </dl> </section> </li> <li> <section class="detail" id="draw(java.awt.Graphics2D)"> <h3>draw</h3> <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">draw</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html" title="class or interface in java.awt" class="external-link">Graphics2D</a> g)</span></div> <div class="block">Draws the object in its current state. Is called by the game engine, should NOT be called otherwise.</div> <dl class="notes"> <dt>Parameters:</dt> <dd><code>g</code> - object that has all the necessary drawing functionalities</dd> </dl> </section> </li> </ul> </section> </li> </ul> </section> <!-- ========= END OF CLASS DATA ========= --> </main> </div> </div> </body> </html>
|