<commit_before>package fpsGame;

import processing.core.*;

public class TieFighter extends Ship{
	
	float size;
	float hsize;
	float qsize;
	float theta;
	float thetaInc;
	float rot;
	float rotInc;
	float radX;
	float radY;
	float radZ;
	float oPosZ;
	PVector dest;
	boolean towards;
	boolean rotating;
	int flightPath;

	TieFighter(PApplet p, PVector pos){
		super(p);
		this.pos = pos;
		size = 100;
		speed = 35;
		hsize = size / 2;
		qsize = hsize / 2;
		
		calcFlightPath();
	}
	
	//Set the flight path and calculate and variables needed for it to work
	void calcFlightPath(){
		flightPath = (int) p.random(0, 3);
		PApplet.println(flightPath);

		switch(flightPath){

		//Elliptically loop around the XWing
		case 0:{
			theta = 0;
			thetaInc = p.random(1, speed / 2) / 100;
			radX = p.random(-speed, speed);
			radY = p.random(-speed, speed);
			radZ = p.random(0, speed);
			break;
		}
		
		//Move towards & away from XWing
		case 1:{
			oPosZ = pos.z;
			towards = true;
			break;
		}
		
		//Move towards a random point
		case 2:{
			dest = new PVector(p.random(0, p.width), p.random(0, p.height), pos.z);
			theta = PApplet.atan((dest.y - pos.y) / (dest.x - pos.x));
			PApplet.println("Theta: " + PApplet.degrees(theta));
			PApplet.println("CPos: " + pos.x + "\t" + pos.y + "\t" + pos.z);
			PApplet.println("Dest: " + dest.x + "\t" + dest.y + "\t" + dest.z + "\n");
			break;
		}

		}
	}

	@Override
	void update() {
		switch(flightPath){

		//Elliptically loop around the XWing
		case 0:{<commit_msg>Angle corrections<commit_after>package fpsGame;

import processing.core.*;

public class TieFighter extends Ship{
	
	float size;
	float hsize;
	float qsize;
	float theta;
	float thetaInc;
	float rot;
	float rotInc;
	float radX;
	float radY;
	float radZ;
	float oPosZ;
	PVector dest;
	boolean towards;
	boolean rotating;
	int flightPath;

	TieFighter(PApplet p, PVector pos){
		super(p);
		this.pos = pos;
		size = 100;
		speed = 35;
		hsize = size / 2;
		qsize = hsize / 2;
		
		calcFlightPath();
	}
	
	//Set the flight path and calculate and variables needed for it to work
	void calcFlightPath(){
		flightPath = (int) p.random(0, 3);
		PApplet.println(flightPath);

		switch(flightPath){

		//Elliptically loop around the XWing
		case 0:{
			theta = 0;
			thetaInc = p.random(1, speed / 2) / 100;
			radX = p.random(-speed, speed);
			radY = p.random(-speed, speed);
			radZ = p.random(0, speed);
			break;
		}
		
		//Move towards & away from XWing
		case 1:{
			oPosZ = pos.z;
			towards = true;
			break;
		}
		
		//Move towards a random point
		case 2:{
			dest = new PVector(p.random(0, p.width), p.random(0, p.height), pos.z);
			
			float xDif = dest.x - pos.x;
			float yDif = dest.y - pos.y;

			theta = PApplet.atan(yDif/ xDif);
			
			//theta = PApplet.atan((pos.y - dest.y) / (pos.x - dest.x));
			//theta = (theta < 0) ? theta + PApplet.TWO_PI: theta;
			//theta = (theta < 0) ? theta + PApplet.HALF_PI :  theta;
			
			//Angle correction. Taken from old commit, needs rework
			if(xDif > 0 && yDif > 0){
				theta = PApplet.PI - theta;
			}
			else if(xDif > 0 && yDif < 0){
				theta = theta;
			}
			else if(xDif < 0 && yDif > 0){
				theta = PApplet.PI + theta;
			}
			else if(xDif < 0 && yDif < 0){
				theta = PApplet.TWO_PI - theta;
			}	

			PApplet.println("Theta: " + PApplet.degrees(theta));
			PApplet.println("CPos: " + pos.x + "\t" + pos.y + "\t" + pos.z);
			PApplet.println("Dest: " + dest.x + "\t" + dest.y + "\t" + dest.z + "\n");
			break;
		}

		}
	}

	@Override
	void update() {
		switch(flightPath){

		//Elliptically loop around the XWing
		case 0:{
{'fraction_non_alphanumeric': 0.14983351831298558, 'fraction_numerical': 0.014983351831298557, 'mean_word_length': 2.6710794297352343, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3192269', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1401, 'n_words': 381}