Im new to this and this is for a school project I have found some other scripts but I cant seem to figure out how to increase the speed that the object moves. Here is what I’m using now(I’m doing a 2D game)
var Movement = pc.createScript('movement');
// initialize code called once per entity
Movement.prototype.initialize = function() {
};
// update code called every frame
Movement.prototype.update = function(dt) {
// get which keys are pressed
var keyboard = this.app.keyboard;
var left = keyboard.isPressed(pc.KEY_LEFT);
var right = keyboard.isPressed(pc.KEY_RIGHT);
// move this entity based on which keys are pressed
// dt is the time in seconds since the last frame and stands for 'delta time'
if (left) {
this.entity.translate(-dt,0 , 0);
}
if (right) {
this.entity.translate(dt, 0, 0 );
}
};
I tried added a z coordinate for moving but it didn’t do anything.