(Complicated) Matching mini-map with scale

Not favoritedFavorited Favorited 0 favourites
From the Asset Store
Two types of minimap: "full map" and "player is the center" (square map and radial map)
  • Your example disappeared. It should be reversible, but it’s been a bit so let’s redo it from scratch.

    To setup you’d have four objects: oval0, cur0 on layer0, and oval1 and cur1 on layer1. It shouldn’t matter the scale,rotation or rotation of the objects, layer or layout.

    Now let’s suppose you want the mouse position on an oval on one layer to be mapped to an oval on another. We can do that with four set position actions.

    Cur0: set position to mouse(0).x, mouse(0).y
    
    Cur1: set position to cur0.x-oval0.x, cur0.y-oval0.y
    
    Cur1: set position to (self.x*cos(oval0.angle)+self.y*sin(oval0.angle))/oval0.width*oval1.width, (self.x*cos(oval0.angle+90)+self.y*sin(oval0.angle+90))/oval0.height*oval1.height
    
    Cur1: set position to oval1.x+self.x*cos(oval1.angle)+self.y*cos(oval1.angle+90), oval1.y+self.x*sin(oval1.angle)+self.y*sin(oval1.angle+90)

    It should work mapping from any layer to any other layer. The idea here is we get the xy relative from one oval and then calculate the xy relative to another.

    That's odd, sorry about that. I updated the link, so hopefully it works now, and here it is just in case:

    https://1drv.ms/u/c/45d17dca4e466456/EYqQ_BcI_F5FqvgRKA06wbIBj0gJxOZAjfEB-AJU12qdzw?e=lQ9gMs

    I'm still having issues with the different layers.

  • I need to stop posting text versions of events I guess. Here's what I posted implemented in events. Does that work?

    dropbox.com/scl/fi/7skmhfwidcf0ygdqucsp3/oval_to_oval.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I need to stop posting text versions of events I guess. Here's what I posted implemented in events. Does that work?

    https://www.dropbox.com/scl/fi/7skmhfwidcf0ygdqucsp3/oval_to_oval.capx?rlkey=lcin8s5rnwye32cgabzokbdd5&st=rcnta4d9

    Sorry for the late reply! I ended up doing it step-by-step like in the image. Seems to work the same but with better scaling control.

    Not sure which approach is actually better though. Thoughts?

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