How do I set the origin point of a sprite in the event sheet

0 favourites
  • 6 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I am making a tool to show a map (a sprite), which the user can drag around with their mouse and zoom in and out of. When the user zooms in and out by using the mouse wheel, I increase / decrease the scale of the sprite in the event sheet. This looks nice and works well, however the point of origin of the sprite isn't relative to the 'view' (sorry i don't know the terminology yet), which means that when you zoom in and out, the point you were looking at moves out of view.

    I would like to change the 'origin' image point of the sprite in the event sheet when the user zoom in / out to be relative the middle of the 'view' in order to make this look right, but i can't seem to find the option. Is this possible?

  • It seems to be impossible with C2 basics.. Maybe someone can propose you a javascript solution..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could try adding multiple image points, so you could then choose the image point before you perform the zoom.

  • you can also use smaller "helper" objects. make them invisible to start and reference them to scroll to instead of image points. You could even make the helper object follower your mouse.x mouse.y if you wanted it to zoom to the object where your curser was. just an idea

  • Jakzon not bad!! your solution is the best! and it must be realized!

  • I have done this in my game for zooming in and out of the layout. You really don't need image points at all. Have your map sprite as a background and set the layout scale to zoom in and out.

    I simply had if mouse real gos up change layout scale to ' current layout scale +1 ' and added a compair conditions saying the scale had to be larger than a number. Same with zooming out only reversed. doing this will zoom into the center of the screen.

    The grab and scroll is a little more tricky but just say if mouse btn is down then set the scrollx and scrolly to mousex and mousey

    I think that will work. My scrolling was done by moving the cursor to the edge of the screen but the above method should work.


    here is a quick demo. Its rough but it is just to give you some ideas

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