I've put the following code above print render($content['comments']); in comment-wrapper.tpl.php of our theme to add question or answer class to every comment:


    foreach($content['comments'] as &$c) {
      if(is_array($c) && array_key_exists('#entity_type', $c) && $c['#entity_type'] == 'comment') {
        $uid = $c['comment_body']['#object']->uid;
        $c['#attributes']['class'][] = $uid == 1 ? 'answer' : 'question';
      }
    }


The generated HTML however has no question or answer classes. Please help me to correct the error.


Question: Enemy attack the player?
Answer: What you need to do is to add force towards player. Not towards -Y direction. So change this: 

             shot.rigidbody2D.AddForce(new Vector2(0, -500));


to something like this:

             shot.rigidbody2D.AddForce(((Vector2)(player.position - shot.transform.position)).normalized * 500);


in which player.position - shot.transform.position is a vector from the shot to the player.

also remove this line:

             shot.transform.position = player.position; //bullet goes to player position


It is moving the shot to the player position immediately.