Character speed change period under certain conditions
To change movement speed of an PLAYER, you can use
PLAYER.changePlayerSpeed(1), by default speed is 1. More information about
avatar api can be found here
🚫
Don’t forget to check Body in the object’s properties panel to use methods
like onCollide()!
Physics > BodyPlace objects wherever you want
Place the object where you want it.
Code
BoostItem
const boost = WORLD.getObject("boostTitle");
function Start() {
// use here PLAYER related logic
boost.onCollide(PLAYER, () => {
boost.kill();
//change PLAYER speed
PLAYER.changePlayerSpeed(2);
});
}Make it fast for 3 seconds when you eat a specific item
BoostItem
const boost = WORLD.getObject("boostTitle");
function Start() {
// use here PLAYER related logic
boost.onCollide(PLAYER, () => {
boost.kill();
//change PLAYER speed
PLAYER.changePlayerSpeed(2);
setTimeout(() => {
PLAYER.changePlayerSpeed(1);
}, 3000); //wait 3 seconds
});
}