creature interface and super classe

This commit is contained in:
gauthiier 2015-03-05 12:57:02 +01:00
parent ac498092a9
commit f389f9473c
4 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import teilchen.BehaviorParticle;
import mathematik.Vector3f;
class Creature extends BehaviorParticle {
float _scale;
public Creature(int x, int y, int r) {
super();
position().set(x, y);
maximumInnerForce(100);
radius(r);
_scale = 1.0;
}
public void display() {
pushMatrix();
translate(position().x, position().y);
rotate(getRotation());
scale(_scale);
draw_shape();
popMatrix();
}
private float getRotation() {
if(velocity().isNaN() || velocity().magnitude() == 0) return 0;
Vector3f v = new Vector3f(-1, 0, 0);
return velocity().angle(v);
}
public void draw_shape() {}
public boolean inside(int mx, int my){return false;}
};

View File

@ -0,0 +1,11 @@
interface CreatureBehavior {
public void event(int x, int y);
public void event(int c);
public void update(float dt);
public void add(Creature c);
}

View File

@ -0,0 +1,2 @@
mode.id=processing.mode.java.JavaMode
mode=Java