<commit_before>package com.google.sprint1;

import android.util.Log;

import com.metaio.sdk.jni.IGeometry;
import com.metaio.sdk.jni.Rotation;
import com.metaio.sdk.jni.Vector3d;

public class PowerUp extends Drawable {
	
	public static final String TAG = "powerUp";
	private IGeometry geometry;
	private boolean visible;
	private float timer;
	private float startTime;
	
	public PowerUp(IGeometry geo){
		geometry = geo;
		visible = true;
		setGeometryProperties(geometry, 2.1f, new Vector3d(0f, 0f, 50f), new Rotation(0f, 0f, 0f));
		timer = 15f;
		
	}
	
	public IGeometry getGeometry()
	{
		return geometry;
	}
	
	public void setHit(boolean hit)
	{
		visible = !hit;
		if(hit)
			startTime(timer);
	}
	
	public boolean isHit()
	{
		if (visible)
			return false;
		else 
			return true;
	}
	
	public void update()
	{	
		float scaleStart = 0f;
		/** Function for animation on the powerup */
			if (geometry.getScale().getX() > 4.0f) {
				scaleStart = -0.04f;
			}
			if (geometry.getScale().getX() < 1.0f) {
				scaleStart = 0.04f;
			}
			geometry.setScale(geometry.getScale().add(
					new Vector3d(scaleStart, scaleStart, scaleStart)));
			// Log.d(TAG, "scale = " + powerUp.getScale());
			if(visible == false)
			{
				geometry.setVisible(false);
				if(updateTimer())	//if the timer returns 0 the powerup respawns
				{
					timer = 15f;
					geometry.setVisible(true);
					setHit(false);
					//aim.setPowerUp(false);
					GameState.getState().powerUps.get(0).setHit(false);
				}
			}
	}
	
	public void startTime(float timerTime)
	{
		
	}
	
	public boolean updateTimer()
	{
//		float deltaTime;
//		if(timer == 15f)		//if first time entering the function
//		{
//			startTime = System.nanoTime();
//			//deltaTime = (System.nanoTime() - startTime) / 1000000000.0f;
//			timer = startTime - 0.1f;	//to avoid this if again
//		}
//		else
//		{
//			deltaTime = startTime - (System.nanoTime() / 1000000000.0f);
//			timer = timer - deltaTime;			
//		}
		
		timer = timer - 0.05f;
		Log.d(TAG, "timer : " + timer);

		if(timer <= 0f)
			return true;
		else
			return false;
	}
	
	
}
<commit_msg> fixed so timer for powerup is based on time instead of frame<commit_after>package com.google.sprint1;

import android.util.Log;

import com.metaio.sdk.jni.IGeometry;
import com.metaio.sdk.jni.Rotation;
import com.metaio.sdk.jni.Vector3d;

public class PowerUp extends Drawable {
	
	public static final String TAG = "powerUp";
	private IGeometry geometry;
	private boolean visible;
	private float timer;
	private long prevTime;
	
	public PowerUp(IGeometry geo){
		geometry = geo;
		visible = true;
		setGeometryProperties(geometry, 2.1f, new Vector3d(0f, 0f, 50f), new Rotation(0f, 0f, 0f));
		timer = 20f;
		
	}
	
	public IGeometry getGeometry()
	{
		return geometry;
	}
	
	public void setHit(boolean hit)
	{
		visible = !hit;
		if(hit)
			startTime();
	}
	
	public boolean isHit()
	{
		if (visible)
			return false;
		else 
			return true;
	}
	
	public void update()
	{	
		float scaleStart = 0f;
		/** Function for animation on the powerup */
			if (geometry.getScale().getX() > 4.0f) {
				scaleStart = -0.04f;
			}
			if (geometry.getScale().getX() < 1.0f) {
				scaleStart = 0.04f;
			}
			geometry.setScale(geometry.getScale().add(
					new Vector3d(scaleStart, scaleStart, scaleStart)));
			// Log.d(TAG, "scale = " + powerUp.getScale());
			if(visible == false)
			{
				geometry.setVisible(false);
				if(updateTimer())	//if the timer returns 0 the powerup respawns
				{
					timer = 20f;
					geometry.setVisible(true);
					setHit(false);
					//aim.setPowerUp(false);
					GameState.getState().powerUps.get(0).setHit(false);
				}
			}
	}
	
	public void startTime()
	{
		prevTime = System.currentTimeMillis();
	}
	
	public boolean updateTimer()
	{
		long currentTime = System.currentTimeMillis();
		
		float deltaTime = currentTime - prevTime;
		deltaTime = deltaTime/1000; // convert from ms to s
		prevTime = System.currentTimeMillis();	// save prevTime for next iteration
		
		timer = timer - deltaTime;
		
//		timer = timer - 0.05f;
		Log.d(TAG, "timer : " + timer);

		if(timer <= 0f)
			return true;
		else
			return false;
	}
	
	
}

{'fraction_non_alphanumeric': 0.1326432354357246, 'fraction_numerical': 0.023591718825228696, 'mean_word_length': 2.9646946564885495, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1202858', 'n_tokens_mistral': 1782, 'n_tokens_neox': 1477, 'n_words': 355}