<commit_before>package com.missionbit.game.states;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import com.missionbit.game.GameTutorial;
import com.missionbit.game.sprites.Farmer;
import com.missionbit.game.sprites.animals.Bunny;
import com.missionbit.game.sprites.animals.Chick;
import com.missionbit.game.sprites.animals.Cow;
import com.missionbit.game.sprites.animals.Pig;
import com.missionbit.game.sprites.animals.Sheep;
import com.missionbit.game.sprites.obstacles.Barrel;
import com.missionbit.game.sprites.obstacles.Cherry;
import com.missionbit.game.sprites.obstacles.Poop;
import com.missionbit.game.sprites.obstacles.Obstacle;

import java.util.Random;


public class Level1 extends State {
    private Texture bg;
    //CHARACTERS
    private Sheep sheep;
    private Bunny bunny;
    private Chick chick;
    private Cow cow;
    private Pig pig;
    //whatever these things are
    private Farmer farmer;
    private Texture ground;
    private Texture trees;
    private Texture trees2;
    private Texture trees3;
    private Texture barn;
    private Texture shed;
    private Texture background;
    private Vector2 groundPos1;
    private Vector2 groundPos2;
    private Vector2 treePos1;
    private Vector2 treePos2;
    private Vector2 treePos3;
    private Vector2 barnPos;
    private Vector2 shedPos;
    private Vector2 bgPos1;
    private Vector2 bgPos2;
    //OBSTACLES
    private Texture haybaleTexture;
    private Obstacle haybale;
    private Cherry cherry;
    private boolean cherryIsTouched;
    private Poop poop;
    private static final int bg_width = 1000;
    private static final int GROUND_Y_OFFSET = -80;
    private static final int ground_width = 800;
    private static final int CHERRY_WIDTH = 30;
    private static final int CHERRY_SPACING = 300;
    private static final int POOP_SPACING = 250;
    private static final int POOP_WIDTH = 30;
    //
    private int a;

    public Level1(final GameStateManager gsm, int c) {
        super(gsm);
        a = c;
        cam.setToOrtho(false, GameTutorial.WIDTH / 2, GameTutorial.HEIGHT / 2);
        bg = new Texture("FarmBg1.png");
        // INITIALIZING ANIMALS
        if (a == 1){
            sheep = new Sheep(150, 60);
        }
        if (a == 2){
            cow = new Cow(150, 60);
        }
        if (a == 3){
            pig = new Pig(150, 60);
        }
        if (a == 4){
            bunny = new Bunny(150, 60);
        }
        if (a == 5){
            chick = new Chick(150, 60);
        }
        farmer = new Farmer(-50, 60);
        ground = new Texture("FarmBG6.png");
        trees = new Texture("FarmBG3.png");
        trees2 = new Texture("FarmBG4.png");
        trees3 = new Texture("FarmBG5.png");
        barn = new Texture("FarmBG1.png");
        shed = new Texture("FarmBG2.png");
        background = new Texture("FarmBG7.png");
        groundPos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, GROUND_Y_OFFSET);
        groundPos2 = new Vector2(ground.getWidth() + groundPos1.x, GROUND_Y_OFFSET);
        treePos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, 0);
        treePos2 = new Vector2(trees.getWidth() + treePos1.x, 0);
        treePos3 = new Vector2(trees.getWidth() + treePos2.x, 0);
        barnPos = new Vector2(50, 0);
        shedPos = new Vector2(350, 0);
        bgPos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, 0);
        bgPos2 = new Vector2(background.getWidth() + bgPos1.x, 0);
        //OBSTACLES
        haybaleTexture = new Texture("haybale3.png");
        haybale = new Obstacle(haybaleTexture, 1300, 40, 1, 0.5f);
        poop = new Poop(260, 60);
        cherry = new Cherry(500, 50);
        cherryIsTouched = false;
    }

    @Override
    protected void handleInput() {
        if (Gdx.input.justTouched()) {
            if ( a == 1){
                sheep.jump();
            }
            if (a == 2){
                cow.jump();
            }
            if (a == 3){
                pig.jump();
            }
            if (a == 4){
                bunny.jump();
            }
            if ( a == 5){
                chick.jump();
            }
        }
    }

    @Override
    public void create() {

    }

    public void update(float dt) {
        handleInput();
        updateHaybale();
        //the characters (this is getting tiring and repetitive but I guess that's what programmimg is yay
        if (a == 1){
            sheep.update(dt);
            cam.position.x = sheep.getPosition().x + 80;
        }
        if (a == 2){
            cow.update(dt);
            cam.position.x = cow.getPosition().x + 80;
        }
        if (a == 3){
            pig.update(dt);
            cam.position.x = pig.getPosition().x + 80;
        }
        if (a == 4){
            bunny.update(dt);
            cam.position.x = bunny.getPosition().x + 80;
        }
        if (a == 5){
            chick.update(dt);
            cam.position.x = chick.getPosition().x + 80;
        }
        cherry.update(dt);
        farmer.update(dt);
        updateBg();
        updateGround();
        updateTrees();
        updateCherries();
        updatePoops();
        collisionCheck();
        timerCheck(dt);
        changeLevels();
        cam.update();

    }
<commit_msg>Update Level1.java<commit_after>package com.missionbit.game.states;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import com.missionbit.game.GameTutorial;
import com.missionbit.game.sprites.Farmer;
import com.missionbit.game.sprites.animals.Bunny;
import com.missionbit.game.sprites.animals.Chick;
import com.missionbit.game.sprites.animals.Cow;
import com.missionbit.game.sprites.animals.Pig;
import com.missionbit.game.sprites.animals.Sheep;
import com.missionbit.game.sprites.obstacles.Barrel;
import com.missionbit.game.sprites.obstacles.Cherry;
import com.missionbit.game.sprites.obstacles.Poop;
import com.missionbit.game.sprites.obstacles.Obstacle;

import java.util.Random;


public class Level1 extends State {
    private Texture bg;
    //CHARACTERS
    private Sheep sheep;
    private Bunny bunny;
    private Chick chick;
    private Cow cow;
    private Pig pig;
    //whatever these things are
    private Farmer farmer;
    private Texture ground;
    private Texture trees;
    private Texture trees2;
    private Texture trees3;
    private Texture barn;
    private Texture shed;
    private Texture background;
    private Vector2 groundPos1;
    private Vector2 groundPos2;
    private Vector2 treePos1;
    private Vector2 treePos2;
    private Vector2 treePos3;
    private Vector2 barnPos;
    private Vector2 shedPos;
    private Vector2 bgPos1;
    private Vector2 bgPos2;
    //OBSTACLES
    private Texture haybaleTexture;
    private Obstacle haybale;
    private Cherry cherry;
    private boolean cherryIsTouched;
    private Poop poop;
    private static final int bg_width = 1000;
    private static final int GROUND_Y_OFFSET = -80;
    private static final int ground_width = 800;
    private static final int CHERRY_WIDTH = 30;
    private static final int CHERRY_SPACING = 300;
    private static final int POOP_SPACING = 250;
    private static final int POOP_WIDTH = 30;
    //
    private int a;

    public Level1(final GameStateManager gsm, int c) {
        super(gsm);
        a = c;
        cam.setToOrtho(false, GameTutorial.WIDTH / 2, GameTutorial.HEIGHT / 2);
        bg = new Texture("FarmBg1.png");
        // INITIALIZING ANIMALS
        if (a == 1){
            sheep = new Sheep(150, 60);
        }
        if (a == 2){
            cow = new Cow(150, 60);
        }
        if (a == 3){
            pig = new Pig(150, 60);
        }
        if (a == 4){
            bunny = new Bunny(150, 60);
        }
        if (a == 5){
            chick = new Chick(150, 60);
        }
        farmer = new Farmer(-50, 60);
        ground = new Texture("FarmBG6.png");
        trees = new Texture("FarmBG3.png");
        trees2 = new Texture("FarmBG4.png");
        trees3 = new Texture("FarmBG5.png");
        barn = new Texture("FarmBG1.png");
        shed = new Texture("FarmBG2.png");
        background = new Texture("FarmBG7.png");
        groundPos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, GROUND_Y_OFFSET);
        groundPos2 = new Vector2(ground.getWidth() + groundPos1.x, GROUND_Y_OFFSET);
        treePos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, 0);
        treePos2 = new Vector2(trees.getWidth() + treePos1.x, 0);
        treePos3 = new Vector2(trees.getWidth() + treePos2.x, 0);
        barnPos = new Vector2(50, 0);
        shedPos = new Vector2(350, 0);
        bgPos1 = new Vector2(cam.position.x - cam.viewportWidth / 2, 0);
        bgPos2 = new Vector2(background.getWidth() + bgPos1.x, 0);
        //OBSTACLES
        haybaleTexture = new Texture("haybale3.png");
        haybale = new Obstacle(haybaleTexture, 1300, 40, 1, 0.5f);
        poop = new Poop(260, 60);
        cherry = new Cherry(500, 50);
        cherryIsTouched = false;
    }

    @Override
    protected void handleInput() {
        if (Gdx.input.justTouched()) {
            if ( a == 1){
                sheep.jump();
            }
            if (a == 2){
                cow.jump();
            }
            if (a == 3){
                pig.jump();
            }
            if (a == 4){
                bunny.jump();
            }
            if ( a == 5){
                chick.jump();
            }
        }
    }

    @Override
    public void create() {

    }

    public void update(float dt) {
        handleInput();
        updateHaybale();
        //the characters (this is getting tiring and repetitive but I guess that's what programmimg is yay
        if (a == 1){
            sheep.update(dt);
            cam.position.x = sheep.getPosition().x + 80;
            if(((System.currentTimeMillis() - startTime) > 45000 & farmer.collides(sheep.getBounds1()) == false)) {
                gsm.set(new Level2(gsm, a));
            }
        }
        if (a == 2){
            cow.update(dt);
            cam.position.x = cow.getPosition().x + 80;
            if(((System.currentTimeMillis() - startTime) > 45000 & farmer.collides(cow.getCowBounds()) == false)) {
                gsm.set(new Level2(gsm, a));
            }
        }
        if (a == 3){
            pig.update(dt);
            cam.position.x = pig.getPosition().x + 80;
            if(((System.currentTimeMillis() - startTime) > 45000 & farmer.collides(pig.getPigBounds()) == false)) {
                gsm.set(new Level2(gsm, a));
            }
        }
        if (a == 4){
            bunny.update(dt);
            cam.position.x = bunny.getPosition().x + 80;
            if(((System.currentTimeMillis() - startTime) > 45000 & farmer.collides(bunny.getBoundsBunny()) == false)) {
                gsm.set(new Level2(gsm, a));
            }
        }
        if (a == 5){
            chick.update(dt);
            cam.position.x = chick.getPosition().x + 80;
            if(((System.currentTimeMillis() - startTime) > 45000 & farmer.collides(chick.getChickBounds()) == false)) {
                gsm.set(new Level2(gsm, a));
            }
        }
        cherry.update(dt);
        farmer.update(dt);
        updateBg();
        updateGround();
        updateTrees();
        updateCherries();
        updatePoops();
        collisionCheck();
        timerCheck(dt);
        changeLevels();
        cam.update();

    }

{'fraction_non_alphanumeric': 0.1168697442938047, 'fraction_numerical': 0.030547451518791832, 'mean_word_length': 2.0131851085832473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3746976', 'n_tokens_mistral': 3995, 'n_tokens_neox': 3688, 'n_words': 877}