当前位置: 首页>>代码示例>>Java>>正文


Java TimeUtils.millis方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.TimeUtils.millis方法的典型用法代码示例。如果您正苦于以下问题:Java TimeUtils.millis方法的具体用法?Java TimeUtils.millis怎么用?Java TimeUtils.millis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.TimeUtils的用法示例。


在下文中一共展示了TimeUtils.millis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TrainingScreen

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
TrainingScreen(GftGame game) {
    this.game = game;

    this.guiCam = new OrthographicCamera(800, 480);
    this.guiCam.position.set(800 / 2, 480 / 2, 0);

    this.backBounds = new Rectangle(7, 432, 48, 48);
    this.playPauseBounds = new Rectangle(7, 7, 48, 48);
    this.restartBounds = new Rectangle(62, 7, 48, 48);
    this.backFowardtBounds = new Rectangle(127, 7, 48, 48);
    this.soundBounds = new Rectangle(192, 7, 48, 48);
    this.minusBounds = new Rectangle(590, 7, 48, 48);
    this.plusBounds = new Rectangle(699, 7, 48, 48);

    this.touchPoint = new Vector3();

    this.grid = new Grid(this.game);
    this.grid.loadTraining();

    this.bottomBar = new BottomBar(this.game);

    this.firstRun = 3;
    this.lastUpdateTime = TimeUtils.millis();
    this.bpm = MINUTE_IN_MILLIS / SettingsUtil.bpm;
}
 
开发者ID:B4sileus,项目名称:guitar-finger-trainer,代码行数:26,代码来源:TrainingScreen.java

示例2: init

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
private void init() {

		// Start Shooting
		bulletCooldown = TimeUtils.millis();
		enemyBulletSpeed = 5;
		randomAttackCooldown = MathUtils.random(200, 1000);
		
		// Drop Chance | 10% chance
		dropChance = MathUtils.random(0, 9);

		// Start Sprites
		allTexture = new Texture(Gdx.files.internal(pathName));
		TextureRegion[][] tmp = TextureRegion.split(allTexture, allTexture.getWidth() / 3, allTexture.getHeight() / 1);
		rolls = new TextureRegion[3];
		for (int i = 0; i < rolls.length; i++) {
			rolls[i] = tmp[0][i];
		}

		// Start rectangle
		collisionBounds = new Rectangle(x, y, allTexture.getWidth() / 3, allTexture.getHeight());
	}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:22,代码来源:BasicAlien.java

示例3: save

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
/**
 * Speichert die Daten in die Spieldatei.
 *
 * @param slot der Slot in den gespeichert werden soll. Wenn null, wird der letzte Slot verwendet
 *
 * @see SaveData#load()
 */
public void save(Slot slot)
{
    if (slot == null)
        slot = this.slot;
    else
        this.slot = slot;

    if (this.slot == null) return;

    playTime += TimeUtils.timeSinceMillis(startTime);

    prefs.putString(slot.name() + PLAYER_NAME, playerName);
    prefs.putBoolean(slot.name() + MALE, male);
    prefs.putLong(slot.name() + PLAY_TIME, playTime);
    prefs.putString(slot.name() + LEVEL_NAME, levelName);
    prefs.putString(slot.name() + LEVEL_ID, levelId);
    prefs.flush();

    startTime = TimeUtils.millis();

}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:29,代码来源:SaveData.java

示例4: render

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0.845f, 0.845f, 0.845f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    game.batch.begin();
    game.batch.draw(appLogo, viewport.getWorldWidth()/2 - 60, viewport.getWorldHeight()/2 - 60, 120, 120);
    Color color = game.batch.getColor();
    color.a = 0.4f;
    game.batch.setColor(color);
    game.batch.draw(samukiLogo, viewport.getWorldWidth()/2-32, 32, 64, 64);
    game.batch.draw(updateText, viewport.getWorldWidth()/2-198, viewport.getWorldHeight()-100, 396, 42);
    color.a = 1f;
    game.batch.setColor(color);
    game.batch.end();

    if (TimeUtils.millis()>(startTime+1250))
        game.setScreen(new MenuScreen(game));
    stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1/30f));
    stage.draw();
}
 
开发者ID:SamukiPL,项目名称:cykacommander,代码行数:22,代码来源:CykaSplashScreen.java

示例5: transformFoodToEnergyAndPoop

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
private void transformFoodToEnergyAndPoop() {
    if ((TimeUtils.timeSinceMillis(timeCounterFoodTransform) > BIRD_FOOD_DIGEST_TIME) && (food > 0))
    {
        if (energy < BIRD_ENERGY_MAX){
            energy += BIRD_ENERGY_ADD;
            if (energy > BIRD_ENERGY_MAX)
                energy = BIRD_ENERGY_MAX;
        }
        if (poop < BIRD_POOP_MAX)
            poop++;
        else
            dropPoop();
        timeCounterFoodTransform = TimeUtils.millis();
        food--;
    }
}
 
开发者ID:andrkhar,项目名称:TheFreeBird,代码行数:17,代码来源:Bird.java

示例6: Cat

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
public Cat(ShapeRenderer renderer, Boolean facingRight) {

        super(renderer, new Vector2(), facingRight);

        if (facingRight) {
            position.set(CAT_START_X_LEFT, CAT_Y);

            velocity.set(CAT_SPEED_X, 0f);
        }
        else{
            position.set(CAT_START_X_RIGHT, CAT_Y);
            velocity.set(-CAT_SPEED_X, 0f);
        }

        catCreateMillis = TimeUtils.millis();
        circle = new Circle(0,0, CAT_HEAD_RADIUS);
        rectangle = new Rectangle(0,0, CAT_BODY_LENGTH, CAT_BODY_WIDTH);
        update(0);
    }
 
开发者ID:andrkhar,项目名称:TheFreeBird,代码行数:20,代码来源:Cat.java

示例7: render

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
@Override
public void render(float delta) {
	double newTime = TimeUtils.millis() / 1000.0;
	double frameTime = Math.min(newTime - currentTime, Env.MAX_STEP);
	float deltaTime = (float)frameTime;
	
	currentTime = newTime;
	accumulator += frameTime;
	
	while (accumulator >= Env.STEP) {
		engine.getSystem(PhysicsSystem.class).setAlpha(Env.STEP / (float)accumulator);
		engine.update(deltaTime);
		accumulator -= Env.STEP;
	}
	
	engine.getSystem(RenderingSystem.class).update(Env.STEP);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:18,代码来源:GameScreen.java

示例8: loadModelList

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
public void loadModelList()
{
	File file = Gdx.files.internal("assets/objects.json").file();
	try
	{
		ModelDesc[] list = _gson.fromJson(new FileReader(file), ModelDesc[].class);
		for (ModelDesc item : list)
		{
			item._lastUsage = TimeUtils.millis();
			_modelList.put(item._typeId, item);
		}
	}
	catch (FileNotFoundException e)
	{
		_log.error("objects config not found", e);
		System.exit(-1);
	}
}
 
开发者ID:arksu,项目名称:origin,代码行数:19,代码来源:ModelManager.java

示例9: render

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
@Override
public void render(float delta) {

    // set hasBeenShaken to true once hasShaken() registered, so the if statement
    // continues to the animation/result even if device isn't moving anymore
    if ((hasShaken() || hasBeenShaken) && canRoll) {


        // only update if it hasn't been shaken in the last 2 seconds
        if (TimeUtils.millis() - lastShakeTime > 5000) {
            diceRoll();
            lastShakeTime = TimeUtils.millis();
            hasBeenShaken = true;
        }

        // randomize results for 2 seconds after a shake
        if (TimeUtils.millis() - lastShakeTime < 2000) {
            randomizeDice();
        } else {
            showRollResult();
            hasBeenShaken = false;
            canRoll = false;
        }
    }

    super.render(delta);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:28,代码来源:DiceRollScene.java

示例10: draw

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
@Override
public void draw(Batch batch, float parentAlpha) {
    long now = TimeUtils.millis();
    if (now > nextTextUpdate) {
        interpolateText();
        nextTextUpdate = TimeUtils.millis() + SHOW_ONE_CHARACTER_EVERY;
        if (now > nextTempRevertUpdate && showingTemp) {
            // We won't be showing temp anymore if the current money is shown
            showCurrentMoney();
        }
    }
    setColor(Klooni.theme.bandColor);
    infoLabel.setColor(Klooni.theme.textColor);
    super.draw(batch, parentAlpha);
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:16,代码来源:MoneyBuyBand.java

示例11: init

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
@Override
public void init() {

	// Start Game Objects
	shipBullets = new Array<PlayerBullets>();
	enemyBulletList = new Array<EnemyBullets>();
	player = new Player(300, 150, 0, 0, shipBullets, this);
	basicAliens = new Array<GameObjects>();
	explosionList = new Array<Explosion>();
	itemList = new Array<Item>();
	collisionHandling = new CollisionHandling(this);

	// Start Level
	levelLoader = new Level("data/levels/testmap.tmx", this);
	for (int i = 0; i < levelLoader.getEnemyArray().size; i++) {
		basicAliens.add(new BasicAlien(levelLoader.getEnemyArray().get(i).x, levelLoader.getEnemyArray().get(i).y, 0, -5, 1000L, -15, getEnemyBulletList(), -20, this));
	}

	// Start the HUD
	// 0 = Health Bar
	allHUDElements = new HUD[1];
	allHUDElements[0] = new HealthBar(10, 760, 200, 25, true);

	// Timers
	deathTimer = TimeUtils.millis();
	
	// Audio
	soundManager = getGSM().getGame().getSoundManager();
	musicManager = getGSM().getGame().getMusicManager();

}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:32,代码来源:PlayState.java

示例12: Level1

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
public Level1(Array<GameObjects> enemyList, int levelNumber, PlayState playState) {
	super(enemyList, playState.getExplosionList(), playState.getEnemyBulletList(), levelNumber, playState);

	// Get lists
	this.enemyList = enemyList;
	this.levelNumber = levelNumber;
	this.playState = playState;

	// Start Background
	initializeBackground();

	// Update Timer
	timeSinceLevelBegan = TimeUtils.millis();
	waveTimer = TimeUtils.millis();

	// Initialize the switches
	gameplaySwitch = new boolean[20];
	for (int i = 0; i < gameplaySwitch.length; i++) {
		gameplaySwitch[i] = false;
	}
	gameplaySwitch[0] = true;
	switchCounter = 0;

	// Start Music
	startMusic();

}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:28,代码来源:Level1.java

示例13: applyRules

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
private void applyRules() {
    if (SettingsUtil.playEnabled) {
        if (this.firstRun > 0) {
            if (TimeUtils.timeSinceMillis(this.lastUpdateTime) >= 1000) {
                AssetsUtil.playSound(AssetsUtil.clickSound);
                this.firstRun--;
                this.lastUpdateTime = TimeUtils.millis();
            }
        } else if (TimeUtils.timeSinceMillis(this.lastUpdateTime) >= this.bpm) {
            AssetsUtil.playSound(AssetsUtil.clickSound);
            this.lastUpdateTime = TimeUtils.millis();

            if (this.grid.forward) {
                this.grid.currentPosition++;
            } else {
                this.grid.currentPosition--;
            }

            if (this.grid.currentPosition == this.grid.noteSequence.length) {
                if (!SettingsUtil.backForwardEnabled) {
                    this.grid.currentPosition = 0;
                    if (SettingsUtil.autoMoveToNext) {
                        this.firstRun = 3;
                        this.grid.loadNextTraining();
                    }
                } else {
                    this.grid.currentPosition--;
                    this.grid.forward = false;
                }
            } else if (!this.grid.forward && this.grid.currentPosition == 0) {
                this.grid.forward = true;
                if (SettingsUtil.autoMoveToNext) {
                    this.firstRun = 3;
                    this.grid.loadNextTraining();
                }
            }
        }
    }
}
 
开发者ID:B4sileus,项目名称:guitar-finger-trainer,代码行数:40,代码来源:TrainingScreen.java

示例14: Player

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
public Player(float x, float y, float dx, float dy, Array<PlayerBullets> listOfBullets, PlayState playState) {
	super(x, y, dx, dy);
	
	// GamePlay
	this.x = x;
	this.y = y;
	this.dx = dx;
	this.dy = dy;
	this.listOfBullets = listOfBullets;
	this.playState = playState;
	bulletcooldown = TimeUtils.millis();

	// Graphics
	pathname = "data/spaceships/ship1.png";
	animationFrameDuration = 1f/40f;
	
	// SFX
	this.playState = playState;
	soundManager = playState.getGSM().getGame().getSoundManager();
	bulletShotSoundPathName = "data/audio/sound/Basic Shot.wav";
	bulletShotSoundName = "Shoot1";

	// Limits
	maxSpeed = 4;
	//friction = 5;
	minimumSpeed = -4;
	bulletSpeed = 15;
	bulletShootSpeed = 200;

	// Start Player Loading
	init();
	
}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:34,代码来源:Player.java

示例15: shootBullets

import com.badlogic.gdx.utils.TimeUtils; //导入方法依赖的package包/类
private void shootBullets() {
	// Shoot Bullets
	// Right Wing
	if (!isRightWingDead && rightWingHealth > 0) {
		if (TimeUtils.timeSinceMillis(bulletCooldownRight) > randomAttackCooldownRight && x < Game.WIDTH && x > 0
				&& y < Game.HEIGHT && y > 0) {
			addBossBullets(175, 0);
			randomAttackCooldownRight = MathUtils.random(200, 1000);
			bulletCooldownRight = TimeUtils.millis();
		}
	}

	// Left Wing
	if (!isLeftWingDead && leftWingHealth > 0) {
		if (TimeUtils.timeSinceMillis(bulletCooldownLeft) > randomAttackCooldownLeft && x < Game.WIDTH && x > 0
				&& y < Game.HEIGHT && y > 0) {
			addBossBullets(20, 0);
			randomAttackCooldownLeft = MathUtils.random(200, 1000);
			bulletCooldownLeft = TimeUtils.millis();
		}
	}

	// Both Wings have died
	if (isLeftWingDead && isRightWingDead && getHP() > 0) {
		if (TimeUtils.timeSinceMillis(bulletCooldown) > randomAttackCooldown && x < Game.WIDTH && x > 0
				&& y < Game.HEIGHT && y > 0) {
			addBossBullets(98, 30);
			randomAttackCooldown = MathUtils.random(200, 800);
			bulletCooldown = TimeUtils.millis();
		}
	}
}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:33,代码来源:SamusShipBoss.java


注:本文中的com.badlogic.gdx.utils.TimeUtils.millis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。