Clicking on minimap

This forum is currently in read-only mode.
From the Asset Store
Two types of minimap: "full map" and "player is the center" (square map and radial map)
  • I'm trying to make an object appear on the layout, based on where I clicked on the map. I tried using the MaptoLayout, but didn't manage to make it work

  • So what did you try and what didn't work about it? Try including a bit more information...

  • MouseKeyboard: 14 On Left Clicked on Minimap 0 
    

    Destination Make Visible

    Destination Set position to Minimap 0 .MapToLayoutX(MouseX), Minimap 2 .MapToLayoutY(MouseY)

    [/code:1ecz8zif]

    That's what I tried...

  • MapToLayoutX/Y takes a map co-ordinate (ie. 0 to width/height of the map) and you're passing in MouseX in layout co-ordinates. Try MouseX - Minimap.X or something like that.

  • MouseKeyboard: 14 On Left Clicked on Minimap 0 
    

    Destination Make Visible

    Destination Set position to Minimap 0 .MapToLayoutX(MouseX-Minimap 1 .X), Minimap 2 .MapToLayoutY(MouseY-Minimap 3 .Y)

    Destination Flash for 0.5 seconds with 0.1 seconds interval

    [/code:gr63svrl]

    I tried that, and it still doesn't work...

  • Can you post your CAP file or a simplified CAP that has the same problem?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem is that clicking on minimap doesn't work. The solution is to use a hidden object that can be clicked on, (box works well for that).

    Here's a quick example:

    http://www.filedropper.com/minimapclick

    PS: I forgot my box.net password, now where did I write it down.

  • Your example doesn't open, something about an abnormal program termination, but I think I understand what you mean, I'll try it.

  • Your example doesn't open, something about an abnormal program termination, but I think I understand what you mean, I'll try it.

    You probably need to update to the newest version, or at least the same one he used.

  • That example was made with version 99.84.

    Here are the events I used

    + MouseKeyboard: Mouse is over Box
    -> Sprite: Set position to Minimap.MapToLayoutX(MouseX-Minimap.X), Minimap.MapToLayoutY(MouseY-Minimap.Y)
    
    + System: Start of layout
    -> Box: Make Invisible
    -> Box: Attach to object Minimap with 0 padding[/code:cmyymoiz]
  • MouseKeyboard: 14 On Left Clicked on Sprite 0 
    

    Dragon Set 'Moving to Attack' to 0

    Destination Make Visible

    Destination Set position to Minimap 0 .MapToLayoutX(MouseX-Sprite 1 .Left-ScrollXLeft), Minimap 2 .MapToLayoutY(MouseY-Sprite 3 .Top-ScrollYTop)[/code:zr4kv2g1]

    This accounts for scrolling, works fine The "Sprite" is a sprite with the same dimensions as the minimap. For some reason the box didn't work with me...

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