Clicking on minimap

For questions about using Classic.

Post » Wed Mar 10, 2010 10:47 pm

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
B
2
G
2
Posts: 16
Reputation: 682

Post » Thu Mar 11, 2010 10:51 am

So what did you try and what didn't work about it? Try including a bit more information...
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Thu Mar 11, 2010 5:14 pm

[code:1ecz8zif]
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...
B
2
G
2
Posts: 16
Reputation: 682

Post » Thu Mar 11, 2010 5:31 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Thu Mar 11, 2010 10:28 pm

[code:gr63svrl]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...
B
2
G
2
Posts: 16
Reputation: 682

Post » Thu Mar 11, 2010 10:45 pm

Can you post your CAP file or a simplified CAP that has the same problem?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Thu Mar 11, 2010 10:59 pm

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:
[url:1f1a7vci]http://www.filedropper.com/minimapclick[/url:1f1a7vci]

PS: I forgot my box.net password, now where did I write it down.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Mar 11, 2010 11:09 pm

Your example doesn't open, something about an abnormal program termination, but I think I understand what you mean, I'll try it.
B
2
G
2
Posts: 16
Reputation: 682

Post » Thu Mar 11, 2010 11:25 pm

[quote="Kiloku":1deqx8u8]Your example doesn't open, something about an abnormal program termination, but I think I understand what you mean, I'll try it.[/quote:1deqx8u8]

You probably need to update to the newest version, or at least the same one he used.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Thu Mar 11, 2010 11:29 pm

That example was made with version 99.84.

Here are the events I used
[code:cmyymoiz]+ 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]
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest