How do I translate scaled layer positions?

0 favourites
  • 2 posts
From the Asset Store
Implement multi-language translation inside your game effortlessly with the language.translate plugin!
  • Object A is on Layer 1.

    Layer 1 is scaled to 1.25x.

    Object B is on Layer 2.

    Layer 2 is scaled to 1.0.

    I want to place B directly over A.

    Everything I'm coming up with seems way to convoluted. One of those days.

    Is there any built in command to project the position of an object on a scaled layer to a position on another, differently scaled layer?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Figured it out.

    For anyone reading this later on:

      Seeker object is on Layer "Pause" Target is on Layer "Game" "Game" is scaled to 1.25x.

    We use LayerToCanvas to translate position out to canvas co-ors, then CanvasToLayer to translate back to the target layer. Like:

    X:
    
    CanvasToLayerX("Pause", LayerToCanvasX("Game",Player.X, Player.Y), LayerToCanvasY("Game",Player.X, Player.Y) )
    
    Y:
    
    CanvasToLayerY("Pause", LayerToCanvasX("Game",Player.X, Player.Y), LayerToCanvasY("Game",Player.X, Player.Y) )[/code:18mujows]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)