thepeach's Recent Forum Activity

  • Thanks for your reply! Is it possible to set the time scale to 0 for testing without using an event sheet? It seems like it's not based on this discussion.

  • Just for clarity, this.#runtime.objects.Camera.getFirstPickedInstance() is a sprite with the scrollTo behavior enabled.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley's 2017 article on delta-time says:

    Don't forget behaviors already use dt. If you use behaviors to control all motion in your game, you don't have to worry about dt at all!

    So, can I ignore delta-time when using the lerp function to position a sprite with the ScrollTo behavior? For context, see the comments in my code below:

    const lerp = (start, stop, amount) => amount * (stop - start) + start;
    
    export default class Game {
     #runtime;
     #camera;
     #player;
    
     start(runtime) {
     this.#runtime = runtime;
     this.#camera = this.#runtime.objects.Camera.getFirstPickedInstance();
     this.#player = this.#runtime.objects.Player.getFirstPickedInstance();
     this.#runtime.addEventListener('tick', () => this.#onTick());
     }
    
     #onTick() {
     // Do I need `this.#runtime.dt` here?
     // Or, does the scrollTo behavior already use it?
     const amount = 0.3 * this.#runtime.dt;
     // Move the camera to the player's position using lerp.
     this.#camera.x = lerp(this.#camera.x, this.#player.x, amount);
     this.#camera.y = lerp(this.#camera.y, this.#player.y, amount);
     }
    }
    
  • I have a layout that uses the default Sprite Font object. The character width and height are both set to 16 in the editor. Is it possible to get the corresponding property values in a script file? For example, something like the following where `SpriteFont` is the object's name:

    `runtime.objects.SpriteFont.getFirstInstance().characterSize.width`

thepeach's avatar

thepeach

Member since 10 Dec, 2022

None one is following thepeach yet!

Connect with thepeach