Window x,y vs layer XY

0 favourites
  • 4 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • Hi all,

       Im new to construct and love it so far. Ive done quite a bit of game dev in the past and C2 is just great! Ive hardly hit a snag except for this one :)

    I have a layer 5000,5000 pixels. I have enabled my window to scroll on my level around this layer. I have a 3rd layer with anchored sprites for my gui. All is working scrolling gui is in place etc.. however. I am trying to spawn an object after I drag from an element in my gui.

    It spawns fine if I dont move the window but once I move my window on the layer the object is spawning back at the original 0,0 of the layer and not within my window.

    So I am trying to spawn an Item from my gui(im dragging from and icon) to a different layer. This works but it will not spawn where once I start moving the window around. Well I had it working until I anchored the sprites and started scrolling ;)

    How do I get the object to spawn on the window coordinates instead of on the layer cords?

    Thanks and I hope that makes sense.

  • Maybe this will work?

    On mouse button released - destroy gui instance - spawn on game layer at mouse-x mouse-y.

  • There is a system expression to convert the layer X, Y coordinates to the viewport coordinates...

    or maybe adding "(layer number)" to your mouse X, Y will be better for you...

    Example

    place object at mouse.X(0) mouse.Y(0) will place an object at layer 0 mouse X, Y,

    place object at mouse.X(1) mouse.Y(1) will place it on layer 1 mouse X, Y coordinates...

    Hope that helps...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies. I solved it with touch.x and touch.y . Those are getting the layer coordinates but the mouse format you posted is very useful! I was unaware that I could specify layer number to the command!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)