Example #1
1
  /**
   * 描画処理
   *
   * @param 描画オブジェクト
   */
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    // 背景を黒で塗りつぶす
    g.setColor(Color.BLACK);
    g.fillRect(0, 0, getWidth(), getHeight());

    // X方向のオフセットを計算
    int offsetX = MainPanel.WIDTH / 2 - (int) player.getX();
    // マップの端ではスクロールしないようにする
    offsetX = Math.min(offsetX, 0);
    offsetX = Math.max(offsetX, MainPanel.WIDTH - map.getWidth());

    // Y方向のオフセットを計算
    int offsetY = MainPanel.HEIGHT / 2 - (int) player.getY();
    // マップの端ではスクロールしないようにする
    offsetY = Math.min(offsetY, 0);
    offsetY = Math.max(offsetY, MainPanel.HEIGHT - map.getHeight());

    // マップを描画
    map.draw(g, offsetX, offsetY);

    // プレイヤーを描画
    player.draw(g, offsetX, offsetY);

    // スプライトを描画
    // マップにいるスプライトを取得
    LinkedList sprites = map.getSprites();
    Iterator iterator = sprites.iterator();
    while (iterator.hasNext()) {
      Sprite sprite = (Sprite) iterator.next();
      sprite.draw(g, offsetX, offsetY);
    }
  }
  public float[] getEnemiesFloatPos() {
    enemiesFloatsList.clear();
    for (Sprite sprite : sprites) {
      // TODO:[M]: add unit tests for getEnemiesFloatPos involving all kinds of creatures
      if (sprite.isDead()) continue;
      switch (sprite.kind) {
        case Sprite.KIND_GOOMBA:
        case Sprite.KIND_BULLET_BILL:
        case Sprite.KIND_ENEMY_FLOWER:
        case Sprite.KIND_GOOMBA_WINGED:
        case Sprite.KIND_GREEN_KOOPA:
        case Sprite.KIND_GREEN_KOOPA_WINGED:
        case Sprite.KIND_RED_KOOPA:
        case Sprite.KIND_RED_KOOPA_WINGED:
        case Sprite.KIND_SPIKY:
        case Sprite.KIND_SPIKY_WINGED:
        case Sprite.KIND_SHELL:
          {
            enemiesFloatsList.add((float) sprite.kind);
            enemiesFloatsList.add(sprite.x - mario.x);
            enemiesFloatsList.add(sprite.y - mario.y);
          }
      }
    }

    float[] enemiesFloatsPosArray = new float[enemiesFloatsList.size()];

    int i = 0;
    for (Float F : enemiesFloatsList) enemiesFloatsPosArray[i++] = F;

    return enemiesFloatsPosArray;
  }
Example #3
0
  public boolean collidesWith(Entity other) {

    me.setBounds((int) x, (int) y, sprite.getWidth(), sprite.getHeight());
    him.setBounds((int) other.x, (int) other.y, other.sprite.getWidth(), other.sprite.getHeight());

    return me.intersects(him);
  }
Example #4
0
  public void renderGL() {
    GL11.glClear(
        GL11.GL_COLOR_BUFFER_BIT
            | GL11.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer

    GL11.glColor3f(0.5f, 0.5f, 1.0f); // set the color of the quad (R,G,B,A)
    GL11.glBegin(GL11.GL_QUADS); // draw quad
    GL11.glVertex2f(100, 100);
    GL11.glVertex2f(100 + 200, 100);
    GL11.glVertex2f(100 + 200, 100 + 200);
    GL11.glVertex2f(100, 100 + 200);
    GL11.glEnd();

    font.draw_str("HELLO", 150, 150);

    s.draw(100, 400, 2f);
    s.draw(300, 400, 2.23f);

    GL11.glColor3f(0.5f, 0.5f, 1.0f); // R,G,B,A Set The Color To Blue One Time Only
    GL11.glPushMatrix(); // draw quad
    GL11.glTranslatef(x, y, 0);
    GL11.glRotatef(rotation, 0f, 0f, 1f);
    GL11.glTranslatef(-x, -y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x - 50, y - 50);
    GL11.glVertex2f(x + 50, y - 50);
    GL11.glVertex2f(x + 50, y + 50);
    GL11.glVertex2f(x - 50, y + 50);
    GL11.glEnd();
    GL11.glPopMatrix();
  }
Example #5
0
 public void keyReleased(KeyEvent e) {
   int key = e.getKeyCode();
   if (key == KeyEvent.VK_A) super.setDX(0);
   if (key == KeyEvent.VK_D) super.setDX(0);
   if (key == KeyEvent.VK_W) super.setDY(0);
   if (key == KeyEvent.VK_S) super.setDY(0);
 }
Example #6
0
  @Override
  public void awake() {
    rand = new Random();

    texture = new Texture("aiplayer.png");
    spriteBatch = new SpriteBatch();
    sprite = new Sprite(texture);
    collider =
        new BoxCollider(
            new Rect(sprite),
            false,
            new ContactListener() {
              @Override
              public void onContactEnter(Collider collider) {
                if (collider.tag.equals("Ball")) {
                  Vector2 ballVelocity = collider.rigidBody.getVelocity();
                  ballVelocity.set(ballVelocity.getX() * translation * 0.2f, -ballVelocity.getY());
                }
              }
            });
    collider.tag = "Platform";

    sprite.translateY(Application.HEIGHT / 2 - sprite.getWidth() / 2 + 40);
    collider.shape.translateY(Application.HEIGHT / 2 - sprite.getWidth() / 2 + 40);
  }
  // draw
  public void draw(GL10 gl) {
    if (lastTime == 0) return;

    switch (game_state) {
      case SPLASH_SCREEN:
        // gray
        gl.glClearColor(0.4f, 0.4f, 0.4f, 1.0f);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        sprite.draw(gl, xPos, yPos, win_width, win_height, winScale);
        break;
      case MAIN_MENU:
        // red
        gl.glClearColor(1f, 0.4f, 0.4f, 1.0f);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        sprite.draw(gl, xPos, yPos, win_width, win_height, winScale);
        break;
      case PLAYING:
        // green
        if (touching) gl.glClearColor(0.4f, 1f, 1f, 1.0f);
        else gl.glClearColor(0.4f, 1f, 0.4f, 1.0f);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        sprite.draw(gl, xPos, yPos, win_width, win_height, winScale);
        break;
    }
  }
  public void paint(Graphics graphics, long time) {
    // Clear the background.
    Color outsideColor = outsideClipColor.getColor(time);
    Rectangle clip = graphics.getClipBounds();
    graphics.setPaintMode();
    graphics.setColor(outsideColor);
    graphics.fillRect(0, 0, clip.width, clip.height);

    // Draw the sprite in XOR mode.
    OverrideGraphics2D g = new OverrideGraphics2D((Graphics2D) graphics);
    Color insideColor = insideClipColor.getColor(time);
    g.setOverrideXORMode(insideColor);
    sprite.paint(g, time);
    g.setOverrideXORMode(null);

    // Clear the clip area.
    g.setOverrideColor(insideColor);
    clipSprite.paint(g, time);
    g.setOverrideColor(null);

    // Draw the sprite in XOR mode.
    g.setOverrideXORMode(insideColor);
    sprite.paint(g, time);
    g.setOverrideXORMode(null);
  }
  /**
   * Get the animated sprite for an indexed tile of a tileset.
   *
   * @param tileset The tileset to load from.
   * @param index The index with-in the tileset.
   * @return A sprite, or <code>null</code> if no mapped sprite.
   */
  public Sprite getSprite(final Tileset tileset, final int index) {
    final Mapping mapping = animations.get(Integer.valueOf(index));

    if (mapping == null) {
      return null;
    }

    final int[] frameIndexes = mapping.getIndices();
    final int[] frameDelays = mapping.getDelays();

    final Sprite[] frames = new Sprite[frameIndexes.length];

    for (int i = 0; i < frameIndexes.length; i++) {
      frames[i] = tileset.getSprite(frameIndexes[i]);
    }

    // Use the reference of the first frame as the reference for the whole
    // group
    Object ref = null;
    Sprite first = frames[0];
    if (first != null) {
      ref = first.getReference();
    }
    return new AnimatedSprite(frames, frameDelays, true, ref);
  }
Example #10
0
  public GameScreen() {
    addKeyListener(new TAdapter());
    addMouseListener(new CustomListener());
    addMouseMotionListener(new CustomListener());
    setFocusable(true);
    setBackground(Color.BLACK);
    setDoubleBuffered(true);
    player = new Sprite();
    player.setX(500);
    player.setY(250);
    player.set_speed(player_speed);
    bullet = new Vector<Bullet>();
    enemy = new Vector<Enemy>();
    v_explosion = new Vector<Explosion>();
    ImageIcon ii =
        new ImageIcon(this.getClass().getResource("Data/Sprite/background/background1.png"));
    fon = ii.getImage();
    timer = new Timer(5, this);
    timer.start();
    timerj = new java.util.Timer();
    timerj.schedule(task, 100);
    ImageIcon ii2 = new ImageIcon(this.getClass().getResource("Data/Sprite/player/explosion.png"));
    explosion = ii2.getImage();

    ImageIcon i3 = new ImageIcon(this.getClass().getResource("Data/Sprite/player/live.png"));
    live = i3.getImage();
    i3 = new ImageIcon(this.getClass().getResource("Data/Sprite/player/str.png"));
    pointer = i3.getImage();
    image_bullet = new Bullet();
    start_game();
  }
Example #11
0
 public void keyPressed(KeyEvent e) {
   int key = e.getKeyCode();
   if (key == KeyEvent.VK_A) super.setDX(-4);
   if (key == KeyEvent.VK_D) super.setDX(4);
   if (key == KeyEvent.VK_W) super.setDY(-4);
   if (key == KeyEvent.VK_S) super.setDY(4);
 }
Example #12
0
  /**
   * This method checks to see if there are collisions among sprites and calls their respective
   * collision() methods if there is.
   */
  public static void handleCollisions() {
    ArrayList<Sprite> sprites = GamePanel.getSprites();

    // Loop through all of the sprites
    for (int i = 0; i < sprites.size(); ++i) {
      Sprite one = sprites.get(i);

      // Only compare sprites with which we are concerned
      if ((one instanceof Collidable && one.isAlive())
          && (one instanceof KillableSprite || one instanceof Weapon || one instanceof PowerUp)) {
        for (int j = 0; j < sprites.size(); ++j) {
          try {
            Sprite two = sprites.get(j);

            // If one is a Player, Enemy, Weapon, or PowerUp and two
            // is not the same and there is a collision
            if (((one instanceof Player && !(two instanceof Player))
                    || (one instanceof Enemy && !(two instanceof Enemy))
                    || (one instanceof Weapon && !(two instanceof Weapon))
                    || (one instanceof PowerUp && !(two instanceof PowerUp)))
                && detectCollision(one, two)) {
              Collidable collided = (Collidable) one;
              collided.collision(two);
            }
          } catch (IndexOutOfBoundsException e) {
            // Happens due to concurrency issues... and can be
            // ignored
          }
        }
      }
    }
  }
Example #13
0
 /**
  * Checks if a particular sprite is approaching the same destination as any other
  * player-controlled sprites.
  *
  * @param sprite
  * @return
  */
 boolean spriteOverlaps(Sprite sprite) {
   for (Sprite t : humanSprites) {
     if (!t.equals(sprite)
         && Math.abs(sprite.xDestination - t.xDestination) < 10
         && Math.abs(sprite.yDestination - t.yDestination) < 10) return true;
   }
   return false;
 }
 private void addSprite(Sprite layer) {
   this.sprites.add(layer);
   this.layers.put(layer.getName(), layer);
   layer.addPropertyChangeListener(this);
   Collections.sort(this.sprites, new Layer.NameComparator());
   int index = this.sprites.indexOf(layer);
   this.fireSpriteAdded(layer, index);
 }
Example #15
0
 /**
  * Updates all sprite orientations.
  *
  * @param nearDestination
  */
 void updateSpriteOrientations(boolean nearDestination) {
   for (Sprite s : spriteList) {
     if (!nearDestination
         || s.xCurrent - s.xDestination < 10
         || s.yCurrent - s.yDestination < 10) {
       s.orientation = s.selectOrientation();
     }
   }
 }
Example #16
0
 /**
  * Updates sprite destinations as to prevent overlapping sprites.
  *
  * @param sprite
  */
 void preventSpriteOverlaps(Sprite sprite) {
   generator = new Random();
   while (spriteOverlaps(sprite)) {
     boolean offsetLeft = generator.nextBoolean();
     if (offsetLeft) {
       sprite.xDestination -= 30;
     } else sprite.xDestination += 30;
     sprite.yDestination += 20;
   }
 }
  public void bumpInto(int x, int y) {
    byte block = level.getBlock(x, y);
    if (((Level.TILE_BEHAVIORS[block & 0xff]) & Level.BIT_PICKUPABLE) > 0) {
      Mario.gainCoin();
      level.setBlock(x, y, (byte) 0);
      addSprite(new CoinAnim(x, y + 1));
    }

    for (Sprite sprite : sprites) {
      sprite.bumpCheck(x, y);
    }
  }
  /**
   * Render the game (part of the main loop, no allocations anywhere in here).
   *
   * @param gl openGL context reference
   */
  public void render(GL10 gl) {

    GLGfx.clearScreen(gl, true, CLEAR_COLOR, true);

    mBack.draw(gl);

    GLGfx.drawLine(
        gl, RAIL_COLOR, 0, BANNER_HEIGHT * mDensity, getWidth(), BANNER_HEIGHT * mDensity);

    mPaddles[0].draw(gl);
    mPaddles[1].draw(gl);
    mBall.draw(gl);
  }
Example #19
0
  @Override
  public void update() {
    if (Ball.velocity.getY() > 0) {
      Vector2 p0 = Ball.position;
      Vector2 p1 = Vector2.add(Ball.position, Vector2.one());

      float k = (p0.getY() - p1.getY()) / (p0.getX() - p1.getX());
      float m = p1.getY() - k * p1.getX();
      float x = (sprite.getPosition().getY() - m) / k;

      sprite.setX(Math.min(x, Application.WIDTH / 2));
      collider.shape.setX(Math.min(x, Application.WIDTH / 2));
    }
  }
Example #20
0
  public void run() {

    while (bKeepGoing) {

      ArrayList<Sprite> sprites = controller.getModel().getSpriteList();

      synchronized (sprites) {
        Iterator<Sprite> iter = sprites.iterator();
        while (iter.hasNext()) {
          Sprite s = iter.next();
          s.move();
          for (Sprite t : sprites) {
            if ((s instanceof Razorback) && (t instanceof Opponent) && t.overlaps(s)) {
              t.hit();
            } else if ((t instanceof Razorback) && (s instanceof Opponent) && s.overlaps(t)) {
              s.hit();
            }
          }

          if (s.shouldRemove()) {
            iter.remove();
          }
        }
      }

      try {
        Thread.sleep(25);
      } catch (InterruptedException e) {
      }
      view.repaint();
    }
  }
Example #21
0
  @Override
  public void update(GameContainer gc, StateBasedGame sb, int delta) throws SlickException {
    Input input = gc.getInput();

    if (input.isMouseButtonDown(0)
        && bib.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY()))
      sb.enterState(Main.TRACKSCREEN);
    if (input.isMouseButtonDown(0)
        && shoes.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY()))
      sb.enterState(Main.TRAININGSCREEN);
    if (input.isKeyDown(Input.KEY_ESCAPE)) {
      PauseScreen.screen = 3;
      sb.enterState(Main.PAUSESCREEN);
    }
  } // end update
Example #22
0
  /**
   * Takes the map data are returns a Texture that can be drawn from a sprite.
   *
   * @param width How wide in pixels you want the returned Texture to be.
   * @param height How high in pixels you want the returned Texture to be.
   * @return a Texture that is width x height big that can then be drawn to the screen
   * @throws TextureCreationException
   */
  ConstTexture drawMap() {
    int currentSlot = 0;
    screen.clear();
    for (int x = 0; x < XSize; x++) {
      for (int y = 0; y < YSize; y++) {
        currentTile.setPosition(x * 16, y * 16);
        currentTile.setTexture(textures.tiles.get(textureMap.get(currentSlot)));
        screen.draw(currentTile);
        currentSlot++;
      }
    }
    screen.display();

    return screen.getTexture();
  }
  public void onDrawFrame(GL10 unused) {
    // Redraw background color
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    // TODO: Calculate delta time.
    m_activity.on_update(0.1f);

    m_active_shader.bind();

    // Draw everything
    for (Sprite sprite : m_sprites) {
      sprite.get_texture().bind();

      // Set up our matrix in the shader
      m_active_shader.set_model_matrix(sprite.get_matrix());

      // Set the color
      m_active_shader.set_color(sprite.get_color());

      // Set up our buffers to render.
      GLES20.glVertexAttribPointer(
          Shader.SHADER_ATTRIB_VERTEX_ID,
          2,
          GLES20.GL_FLOAT,
          false,
          4 * 4,
          sprite.get_vertex_data());

      GLES20.glEnableVertexAttribArray(Shader.SHADER_ATTRIB_VERTEX_ID);

      // The texture offsets start at UV in the struct. However we need to cast vertex data to a
      // char first so we add the offset in bytes
      // properly. This might seem weird.. but it's the only proper way that doesn't generate a gcc
      // warning.
      /*GLES20.glVertexAttribPointer(
      		Shader.SHADER_ATTRIB_TEXCOORD_ID,
      		2,
      		GLES20.GL_FLOAT,
      		false,
      		4 * 4,
      		sprite.get_vertex_data().
      );

      glEnableVertexAttribArray(SHADER_ATTRIB_TEXCOORD_ID);*/

      GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    }
  }
Example #24
0
  public void onUpdate(long gameTime) {
    super.onUpdate(gameTime);

    if (isAnimated) {
      animationTime += gameTime;

      if (animationTime > lastFrameUpdateTime + framePeriod) {

        lastFrameUpdateTime = animationTime;

        currentColumn++;

        if (currentColumn == (int) dimension.x) {
          currentRow++;
          currentColumn = 0;
        }

        currentFrame++;

        if (currentFrame == frameNumber) {
          currentFrame = 0;
          currentRow = 0;
          currentColumn = 0;
        }
      }

      updateTexureCoordinates(createTextureArray());
    }
  }
Example #25
0
 /**
  * Sets the group of human sprites within the given x-y bounds as the human squad.
  *
  * @param x1
  * @param y1
  * @param x2
  * @param y2
  */
 public void setHumanSquad(int x1, int y1, int x2, int y2) {
   humanSquadSelectionBox = PlayerMouseControls.updateSelectionBox(x1, y1, x2, y2);
   for (Sprite s : humanSquad) {
     s.setInSquad(false);
   }
   humanSquad = new ArrayList<Sprite>();
   for (Sprite s : humanSprites) {
     if (s.xCurrent >= humanSquadSelectionBox[0][0]
         && s.xCurrent <= humanSquadSelectionBox[1][0]
         && s.yCurrent >= humanSquadSelectionBox[0][1]
         && s.yCurrent <= humanSquadSelectionBox[1][1]) {
       humanSquad.add(s);
       s.setInSquad(true);
     }
   }
 }
Example #26
0
  private Body initPhysicsBody(World world, float x, float y) {
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DYNAMIC;
    bodyDef.position = new Vec2(0, 0);
    Body body = world.createBody(bodyDef);

    PolygonShape shape = new PolygonShape();
    Transform fx = new Transform();
    fx.position.set(100f, 100f);
    shape.centroid(fx);

    shape.setAsBox(
        sprite.layer().width() * GameScreen.M_PER_PIXEL / 2,
        sprite.layer().height() * GameScreen.M_PER_PIXEL / 2);
    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.density = 0.4f;
    fixtureDef.friction = 0.1f;
    fixtureDef.restitution = 0f;
    body.createFixture(fixtureDef);
    body.setLinearDamping(0.2f);
    body.setTransform(new Vec2(x, y), 0f);

    //        MassData md = body.getMassData();
    //        massD.center.set(2f, 0); body.setMassData(massD);

    return body;
  }
Example #27
0
  @TargetApi(Build.VERSION_CODES.GINGERBREAD)
  @Override
  public void onTick(long millisUntilFinished) {

    // Change milliseconds into MM:SS
    String timeLeft =
        String.format(
            "%d : %02d",
            TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished),
            TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished)
                - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished)));

    // Display the countdown
    countdown.setText(timeLeft);

    // Check to see if it's time to change the sprite
    if (!sprite.omelette) {
      if (((millisUntilFinished <= 0.8 * duration) && sprite.eggStatus == 1)
          || // 80% done
          ((millisUntilFinished <= 0.6 * duration) && sprite.eggStatus == 2)
          || // 60% done
          ((millisUntilFinished <= 0.4 * duration) && sprite.eggStatus == 3)
          || // 40% done
          ((millisUntilFinished <= 0.2 * duration) && sprite.eggStatus == 4)) { // 20% done

        sprite.nextStatus();
      }
    }
  }
Example #28
0
  /**
   * When invoked, this method results in each button in the GUI testing to see if the x, y
   * coordinates are inside its bounds. If they are, the button's actionPerformed method is invoked
   * and the appropriate event response is executed.
   *
   * @param x the x coordinate on the canvas of the mouse press
   * @param y the y coordinate on the canvas of the mouse press
   * @return true if the mouse press resulted in a button's event handler being executed, false
   *     otherwise. This is important because if false is returned, other game logic should proceed.
   */
  public boolean processButtonPress(int x, int y) {
    boolean buttonClickPerformed = false;

    // TEST EACH BUTTON
    for (Sprite s : guiButtons.values()) {
      // THIS METHOD WILL INVOKE actionPeformed WHEN NEEDED
      buttonClickPerformed = s.testForClick(this, x, y);

      // ONLY EXECUTE THE FIRST ONE, SINCE BUTTONS
      // SHOULD NOT OVERLAP
      if (buttonClickPerformed) {
        return true;
      }
    }
    return false;
  }
Example #29
0
  public void doDrawings(Canvas canvas) {
    if (canvas != null) {
      canvas.drawColor(Color.rgb(120, 153, 66));

      int amountSprites = 0;

      switch (amagotchiEvent) {
        case NORMAL:
          amountSprites = 1;
          break;
        case HAPPY:
          amountSprites = 2;
          break;
        case UNHAPPY:
          amountSprites = 2;
          break;
        case TURN_LEFT_RIGHT:
          amountSprites = 1;
          break;
        case DEVELOP:
          amountSprites = 4;
          break;
        default:
          Log.v(LOG_TAG, "drawingThread- Fehler mit dem amagotchiEvent");
      }

      amagotchi = new Sprite(GameView.spriteSheet, amagotchiEvent);
      amagotchi.drawAmagotchi(canvas, paintedSprites);

      if (paintedSprites == amountSprites) paintedSprites = -1;

      paintedSprites++;
    }
  }
Example #30
0
 public void CollideWith(Sprite S) {
   if (S.m_iFaction == m_iFaction) {
     return;
   }
   if (S instanceof Shot) {
     TakeDamage(((Shot) (S)).m_iDamage, 'P');
     S.m_bDelete = true;
   } else if (S instanceof Character) {
     S.m_dDirection.Reverse();
     TakeDamage(10, 'P');
     if (S.m_rcBoundingBox.x > m_rcBoundingBox.x) {
       m_pSpeed.x = -8;
       m_pSpeed.y = -20;
     } else {
       m_pSpeed.x = 8;
       m_pSpeed.y = -20;
     }
   } else if (S.m_bIsSolid) {
     m_pSpeed.x = (int) (1 / 2) * (-m_pSpeed.x);
     m_pSpeed.y = (int) (1 / 2) * (-m_pSpeed.y);
     S.m_pSpeed.x = (int) (1 / 2) * (-S.m_pSpeed.x);
     S.m_pSpeed.y = (int) (1 / 2) * (-S.m_pSpeed.y);
   }
   // System.out.println("Collision Character");
 }