Here's a plugin that let's you have brief flashes of slowed down time in your game that is common in some games, like when you die it slows down for like 1/2 a second then returns to normal.
It has added juice to my game so here it is for you guys. easy to use relatively.
https://github.com/killbot/Impactjs_timeslower
1 decade ago
by Krisjet
I was just about to implement something like this. Will have to take a look at this plugin :) Thanks!
How do I use the supertimer object? I want my player to stay in realtime.
This thing works like a boss. Nice work.
Basically I just put it in my Player.js class, just as the instructions tell you, then create an input in my main.js file. Looks like this:
// Inside of Main.js
initialization: function(){
....
ig.input.bind(ig.KEY.A, 'slowTime');
....
}
then follow the instructions at the top of the JS file you are downloading here.
From there, I added a new function in my Player.js file:
slowTime: function(){
// take 4 seconds to slow down
// to 0.2 timescale, stay at 0.5 timescale for 3 seconds,
// then return to timescale 1 gradually over 2 seconds.
myTimeSlower.alterTimeScale(0.2, 4, 3, 2);
}
And then have that called in my player.js update:
update: function(){
....
if(ig.input.state('slowTime')){
this.slowTime();
}
....
}
Now when I press A, my player shows down, and after (x) number of seconds, returns to normal speed.
Super cool, works like a dream, and easy to implement.
thanks!
Page 1 of 1
« first
« previous
next ›
last »