Tutorial Downloads

File Size
LayerToCanvas CanvasToLayer example.capx172KB

Translations

Know another language? Translate this tutorial!

Stats

734 visitors
2,988 page views

LayerToCanvas/CanvasToLayer example

Favourite 9 favourites
Tutorial written by KatalaOriginally published on 20th, September 2014 - 1 revision

Simple example how to project position from another layer using LayerToCanvas and CanvasToLayer expressions.

Setting Sprite position from "UI" layer (parallax 0,0) to Player Sprite in "level" layer (parallax 100,100)
Set X position

    CanvasToLayerX("UI",LayerToCanvasX("level", Player.x, Player.y) ,LayerToCanvasY("level", Player.x, Player.y))

Set Y position

    CanvasToLayerY("UI",LayerToCanvasX("level", Player.x, Player.y) ,LayerToCanvasY("level", Player.x, Player.y))

Simple example file attached.

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.