<commit_before>package engine.element.sprites;

import engine.Updateable;
import annotations.parameter;


/**
 * This class represents the projectiles shot out by certain Sprites, like towers.
 * 
 * @author <NAME>
 *
 */

public class Projectile extends MoveableSprite implements Updateable {

    @parameter(settable = true, playerDisplay = true, defaultValue = "1")
    private Integer damage;
    @parameter(settable = true, playerDisplay = true)
    private boolean homing = true;
    private GameElement target;
    
    // Getters and setters

    public Integer getDamage () {
        return damage;
    }
    
    public GameElement getTarget(){
    	return target;
    }
    
    public void setTarget(GameElement g){
    	target = g;
    }

    @Override
    public void target (Sprite sprite) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onCollide (GameElement element) {
        // TODO Auto-generated method stub
    }

    @Override
    public void move () {
    	if (homing)
    		updateHeading();
        super.setLocation(super.getLocation()
                .add(super.getHeading().multiply(super.getSpeed())));
    }

    private void updateHeading() {
    	if(!target.getState().equals(DEAD_STATE))
   			this.setHeading(target.getLocation());
	}

	@Override
    public void update (int counter) {
        this.move();
    }


}<commit_msg>fixed updateHeading problem<commit_after>package engine.element.sprites;

import javafx.geometry.Point2D;
import engine.Updateable;
import annotations.parameter;


/**
 * This class represents the projectiles shot out by certain Sprites, like towers.
 * 
 * @author <NAME>
 *
 */

public class Projectile extends MoveableSprite implements Updateable {

    @parameter(settable = true, playerDisplay = true, defaultValue = "1")
    private Integer damage;
    @parameter(settable = true, playerDisplay = true)
    private boolean homing = true;
    private GameElement target;
    
    // Getters and setters

    public Integer getDamage () {
        return damage;
    }
    
    public GameElement getTarget(){
    	return target;
    }
    
    public void setTarget(GameElement g){
    	target = g;
    }

    @Override
    public void target (Sprite sprite) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onCollide (GameElement element) {
        // TODO Auto-generated method stub
    }

    @Override
    public void move () {
    	if (homing)
    		updateHeading();
        super.setLocation(super.getLocation()
                .add(super.getHeading().multiply(super.getSpeed())));
    }

    private void updateHeading() {
    	if(!target.getState().equals(DEAD_STATE))
   			this.setHeading(new Point2D(target.getLocationX()-this.getLocationX() , target.getLocationY() - this.getLocationY()));
	}

	@Override
    public void update (int counter) {
        this.move();
    }


}
{'fraction_non_alphanumeric': 0.1002737850787132, 'fraction_numerical': 0.0013689253935660506, 'mean_word_length': 2.695322376738306, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5925573', 'n_tokens_mistral': 859, 'n_tokens_neox': 829, 'n_words': 221}