1 /***************************************************************************
2 * Copyright (C) 2010 by the Alterverse team *
3 * email: rynkruger@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write see: *
17 * <http://www.gnu.org/licenses/>. *
18 ***************************************************************************/
20 package org
.alterverse
.world
;
22 import org
.alterverse
.shapes
.*;
24 public class MovableObject
extends GameObject
{
28 public MovableObject(double x
, double y
, double z
, Shape shape
) {
35 public void onBump(GameObject other
) {
36 if (other
.isSolid() && this.isSolid()) {
40 if (dx
==0&&dy
==0&&dz
==0)
42 while (this.isTouching(other
)) {
43 setPosition(getX()+dx
,getY()+dy
,getZ()+dz
);
44 // System.out.printf("%f,%f,%f delta %f,%f,%f\n",x,y,z,dx,dy,dz);
47 setX(getX()*2-other.getX());
48 setY(getY()*2-other.getY());
49 // setZ(getZ()*2-other.getZ());
54 public void setPosition(double x
,double y
,double z
) {
58 super.setPosition(x
,y
,z
);