List of usage examples for com.google.gwt.maeglin89273.game.mengine.physics Point getX
public double getX()
From source file:com.google.gwt.maeglin89273.shared.test.volcanogame.component.FireBall.java
public FireBall(Spacial space, Point p, int radius) { super(new Point(p.getX(), p.getY() - radius), radius * 2, radius * 2); this.radius = radius; double h = 5 + Random.nextInt(21); double s = 80 + Random.nextInt(21); double l = 35 + Random.nextInt(16); ballColor = CssColor.make("hsl(" + h + "," + s + "%," + l + "%)"); ballShadowColor = CssColor.make("hsl(" + h + "," + s + "%," + (l + 15) + "%)"); this.space = space; aabb = new PixelAABB(this.position, width, height); BodyDef bodyDef = new BodyDef(); CircleShape shape = new CircleShape(); FixtureDef fixtureDef = new FixtureDef(); Vec2 impulse = CoordinateConverter/*from www . j av a 2 s . co m*/ .vectorPixelsToWorld(new Vector(-30 + 60 * Random.nextDouble(), -(175 + 50 * Random.nextDouble()))); bodyDef.type = BodyType.DYNAMIC; bodyDef.position.set(CoordinateConverter.coordPixelsToWorld(position)); body = space.getWorld().createBody(bodyDef); body.setLinearVelocity(impulse); body.applyLinearImpulse(impulse, body.getPosition()); shape.m_radius = CoordinateConverter.scalerPixelsToWorld(radius); fixtureDef.shape = shape; fixtureDef.density = 4.3f; fixtureDef.restitution = 0.2f; fixtureDef.friction = 0.8f; body.createFixture(fixtureDef); }
From source file:com.google.gwt.maeglin89273.shared.test.volcanogame.component.Volcano.java
@Override public void draw(Context2d context) { Point p = getPositionAt(PositionType.NORTHWEST); context.save();//from www. j a va 2 s. c om /*context.setShadowOffsetY(1); context.setShadowOffsetX(4); context.setShadowBlur(25); context.setShadowColor("hsla(22.5,50%,5%,0.3)"); context.setShadowColor("rgba(0,0,0,0.2)");*/ context.drawImage(image.getImage(), p.getX(), p.getY() - 17, width, height + 17); context.restore(); }