<commit_before>﻿using UnityEngine;
using System.Collections;

public class CollectableCollision : MonoBehaviour {

        private bool followPlayer = false;
        private PlayerControl player;
        private ParticleSystem ps;
        private bool following = false;
        private bool facingRight = true;

	void OnCollisionEnter2D(Collision2D col){
         
        if (col.gameObject.tag == "Player"){
        	player = col.gameObject.GetComponent<PlayerControl>();
            player.pickupCollectible(this.gameObject);
            followPlayer = true;
            //Destroy(rigidbody2D);
            Destroy(this.collider2D);
            ps.Stop();
         }
	}
	// Use this for initialization
	void Start () {
            ps = GetComponent<ParticleSystem>();
	}

	// Update is called once per frame
	void Update () {
    
            if(followPlayer){
                //transform.position = player.transform.position;
            } else {
                ps.Emit(2);
            }
	
	}

        void FixedUpdate(){
            if(followPlayer){
                Vector3 followVector = player.transform.position - transform.position;
                rigidbody2D.AddForce(new Vector2( followVector.x + ( 5f * Random.Range(-1f, 1f)), followVector.y + (5f * Random.Range(-1f, 1f))) );
                if(rigidbody2D.velocity.x > 0.1 && !facingRight) {
                    FlipMe();
                }
                else if(rigidbody2D.velocity.x < -0.1 && facingRight) {
                    FlipMe();
                }

            }
        }

        void FlipMe () {
            // Switch the way the player is labelled as facing.
            facingRight = !facingRight;

            // Multiply the player's x local scale by -1.
            Vector3 theScale = transform.localScale;
            theScale.x *= -1;
            transform.localScale = theScale;
	}
}
<commit_msg>ducks follow more closely<commit_after>﻿using UnityEngine;
using System.Collections;

public class CollectableCollision : MonoBehaviour {

        private bool followPlayer = false;
        private PlayerControl player;
        private ParticleSystem ps;
        private bool following = false;
        private bool facingRight = true;

	void OnCollisionEnter2D(Collision2D col){
         
        if (col.gameObject.tag == "Player"){
        	player = col.gameObject.GetComponent<PlayerControl>();
            player.pickupCollectible(this.gameObject);
            followPlayer = true;
            //Destroy(rigidbody2D);
            Destroy(this.collider2D);
            ps.Stop();
         }
	}
	// Use this for initialization
	void Start () {
            ps = GetComponent<ParticleSystem>();
	}

	// Update is called once per frame
	void Update () {
    
            if(followPlayer){
                //transform.position = player.transform.position;
            } else {
                ps.Emit(2);
            }
	
	}

        void FixedUpdate(){
            if(followPlayer){
                Vector3 followVector = 5f * (player.transform.position - transform.position);
                rigidbody2D.AddForce(new Vector2( followVector.x + ( 7f * Random.Range(-1f, 1f)), followVector.y + (7f * Random.Range(-1f, 1f))) );
				float flipThreshold = 0.5f;
				if(rigidbody2D.velocity.x > flipThreshold && !facingRight) {
                    FlipMe();
                }
				else if(rigidbody2D.velocity.x < -flipThreshold && facingRight) {
                    FlipMe();
                }

            }
        }

        void FlipMe () {
            // Switch the way the player is labelled as facing.
            facingRight = !facingRight;

            // Multiply the player's x local scale by -1.
            Vector3 theScale = transform.localScale;
            theScale.x *= -1;
            transform.localScale = theScale;
	}
}

{'fraction_non_alphanumeric': 0.10049725202826486, 'fraction_numerical': 0.011777021722062287, 'mean_word_length': 1.7048832271762209, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6428863', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1013, 'n_words': 237}