예제 #1
0
    void reset() {
      // clear result
      m_result.clear();

      // relocate sprite
      WYSize s = Director.getInstance().getWindowSize();
      m_sprite1.setRotation(Utilities.rand(360));
      m_sprite1.setPosition(0, 0);
      m_sprite2.setRotation(Utilities.rand(360));
      m_sprite2.setPosition(s.width, s.height);

      // re-run actions
      MoveBy move1 = MoveBy.make(4, s.width, s.height);
      move1.autoRelease();
      RotateBy rotate1 = RotateBy.make(4, Utilities.rand(360));
      rotate1.autoRelease();
      m_sprite1.runAction(move1);
      m_sprite1.runAction(rotate1);
      MoveBy move2 = MoveBy.make(4, -s.width, -s.height);
      move2.autoRelease();
      RotateBy rotate2 = RotateBy.make(4, Utilities.rand(360));
      rotate2.autoRelease();
      m_sprite2.runAction(move2);
      m_sprite2.runAction(rotate2);
    }
예제 #2
0
    @Override
    public void jDraw() {
      if (m_result.pointCount > 0) {
        // draw collision point
        GL10 gl = Director.getInstance().gl;
        gl.glColor4f(1, 0, 0, 1);
        gl.glPointSize(5);
        Primitives.drawPoints(m_result.getPoints());

        // draw normal
        Primitives.drawLine(
            m_result.points[0].x,
            m_result.points[0].y,
            m_result.points[0].x + m_result.normal.x * 50,
            m_result.points[0].y + m_result.normal.y * 50);

        gl.glColor4f(1, 1, 1, 1);
      }
    }