Tag Info

New answers tagged

0

Got it working full javascript below var game = { //game object level: 1, //current level turn: 0, //current turn difficulty: 1, // user difficulty score: 0, //current score active: false, //whether a turn is active or not handler: false, // whether the click and sound handlers are active shape: '.shape', // cached string for ...


0

I guess you want something like this: var givenTime=10000 var timeLimit var clockInterval resetClock() function updateClock(){ var now=new Date().getTime() if(now<timeLimit){ //Set the displayed clock to timeLimit-now } else{ //Time has run out clearInterval(clockInterval) } } function resetClock(){ ...


0

Javascript has the setInterval(function(), milliseconds) function which could help here. If you need to get rid of the interval once you're done with it you can store your interval like so, and then clear it: var timer = setInterval(tick, 1000); clearInterval(timer);


1

You're destroying the object that contains the coroutine. A simple fix for this situation is to use the extended version of Destroy. // Destroy the bum after 1 second Destroy (bum, 1);


1

It's because you're going Destroy(this.gameObject) before starting the coroutine. A destroyed object cannot keep running a coroutine. A solution would be to run the coroutine on the clone object.


0

So you are on the right track but using not understanding what some of the parts of your code do. GameTime.TotalGameTime Property Game time since the start of the game. GameTime.ElapsedGameTime Elapsed game time since the last update. MiningElapsed is currently set to the number of seconds since your game started. As a result its always going to ...


1

A health/damage mining system would be much more flexible and should be easier to implement than a fixed, time-based system. Basically, assign each block a health value, and your pickaxe a "mining damage" value, and whenever the pick strikes the block, you subtract its damage from the health of the block. When the block's health goes to zero or below, the ...


1

http://docs.unity3d.com/ScriptReference/Vector3.Lerp.html Have a look at lerp. You'll be able to move to a position over time like this: transform.position = Vector3.Lerp( start, end, currentTime / totalTime ); Where start is the initial position of the object you are moving and end is the place you want to be once currentTime = totalTime. In your case, ...



Top 50 recent answers are included