1 package org.molwind.model; 2 3 /* 4 * This file is part of Molwind. 5 * 6 * Molwind is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Molwind is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Molwind. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 /** 21 * Provides a basic implementation for a placed world entity. 22 * 23 * @author <a href="mailto:oliver.karch@molwind.org">Oliver Karch</a> 24 * @version 1.0 25 */ 26 public class PlacedWorldEntity extends BaseWorldEntity implements Place { 27 28 protected double x; 29 protected double y; 30 31 private int layer; 32 33 /** 34 * Get the Layer value. 35 * @return the Layer value. 36 */ 37 public int getLayer() { 38 return layer; 39 } 40 41 /** 42 * Set the Layer value. 43 * @param newLayer The new Layer value. 44 */ 45 public void setLayer(int newLayer) { 46 this.layer = newLayer; 47 } 48 49 50 51 52 protected PlacedWorldEntity() { 53 super(); 54 x = 0; 55 y = 0; 56 } 57 58 59 /** 60 * Returns the x-coordinate. 61 * 62 * @return 63 * x-coordinate 64 */ 65 public double getX() { 66 return x; 67 } 68 69 /** 70 * Set the X value. 71 * 72 * @param newX 73 * the new X value 74 */ 75 public void setX(final double newX) { 76 this.x = newX; 77 } 78 79 /** 80 * Returns the y-coordinate. 81 * 82 * @return 83 * y-coordinate 84 */ 85 public double getY() { 86 return y; 87 } 88 89 /** 90 * Set the Y value. 91 * 92 * @param newY 93 * the new Y value 94 */ 95 public void setY(final double newY) { 96 this.y = newY; 97 } 98 99 /** 100 * Move y for delta 101 * 102 * @param 103 * delta-x 104 */ 105 public void setDeltaX(double delta){ 106 107 this.x = this.x + delta; 108 109 110 } 111 112 /** 113 * Move y for delta 114 * 115 * @param 116 * delta-y 117 * 118 */ 119 public void setDeltaY(double delta){ 120 121 122 this.y =this.y +delta; 123 124 } 125 126 127 128 129 130 }