Quick help with minimap.

Get help using Construct 2

Post » Sun Jun 15, 2014 5:02 am

Okay, so I have a minimap almost done, but there's one problem.

I am setting it up so you can click on the map to scroll to that area.

I am following this tutorial here: https://www.scirra.com/tutorials/271/ve ... nteraction

It works absolutely fine on scale integer, but when I set the game to say "scale outer" and run it full screen in Chrome, it no longer works.

It will, however, still work if I resize Chrome to make the game the same size as scale integer (so the "actual" size of the game I guess). It is 720p.

Here is a picture of some of the code if it will help. I set up a camera sprite icon to help me see things for testing purposes.

Image

So yeah, basically I want to be able to scroll to a position by clicking the minimap even when the game is run at non-integer sizes. I thought that LayoutScale would do something, but it only says "1" every time I look at it, so that's not helpful.

Surely, I'm missing something simple. Let me know if you need anymore information because I'm not sure what is causing the problem, or at least what variable or number I need to put in there to fix it.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896

Post » Sun Jun 15, 2014 9:16 pm

I'm still not having much luck. It only has problems when the game is being scaled larger or smaller (such as running it fullscreen).

Surely, there has to be a way to set it up to work.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896

Post » Tue Jun 17, 2014 12:00 am

Do to the lack of replies, I'll have to assume that this is not possible.

I found out that the only stat that changes is the mouse absolute X. Everything else stays fairly consistent such as layout size, the position of the map, etc.

The problem is that I cannot see any pattern or percentage to plug a formula into. When comparing fullscreen to default size, the absolute X values don't seem to fit a fixed percentage across the map. The left side and right side are not both exactly a certain amount higher. The right side is much higher.

So, the left side abX value (on the minimap) might be 35 on default size, and 135 when fullscreen which is about 4.4 times higher, and the right side might be 156 on default and 315 on fullscreen which is only about 2 times higher.

I don't know how to write a formula to allow for that. I am going to try a little bit more, and then maybe look at some plugins or something. If that fails, maybe I can just add points on the map that can be clicked to take me to a certain coordinate each (maybe have 50 or 100 points). I don't know yet.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896

Post » Tue Jun 17, 2014 1:07 am

Probably use Mouse.X instead of Mouse.AbsoluteX and the same for Y.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Tue Jun 17, 2014 2:41 am

R0J0hound wrote:Probably use Mouse.X instead of Mouse.AbsoluteX and the same for Y.


But the problem is that mouse.X changes depending on where you are at in the layout. So, If I scroll all the way to the left, then click the map, I get taken to about 2000 X, then clicking it again without moving the mouse I now get taken all the way to 36000 which is off the layout so I can't see it, and clicking it a 3rd time without moving the mouse takes me to a max of around roughly 40,000 which is as high as it will take me.

I was using absolute X because no matter where you are scrolled to on the layout, the numbers don't change. So, if I hover the mouse over the top left of the map I always get the same numbers. I thought that would make it consistent enough to plug into a formula, but I just can't get it to work at anything other than the default (not scaled) size.

Let me know if I'm missing something or doing something wrong.

I guess I'll keep at it.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896

Post » Tue Jun 17, 2014 6:11 am

Try the Mouse.X("Layer") and Mouse.Y("Layer") expressions with the same layer the minimap is on or just a layer that doesn't scroll.
https://www.scirra.com/manual/114/mouse
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Tue Jun 17, 2014 4:38 pm

R0J0hound wrote:Try the Mouse.X("Layer") and Mouse.Y("Layer") expressions with the same layer the minimap is on or just a layer that doesn't scroll.
https://www.scirra.com/manual/114/mouse


Sweet! It works! Thanks

I tested it with scale outer at fullscreen and half screen and scale integer at normal size. It worked consistently. This now gives me a functional mini-map that will scroll to wherever I click. It will make a big difference for my game since it is sort of a isometric strategy game.

Here is the updated line of code. It could also be done without the camera sprite, but I put in the camera so I could physically see where it was going to.

Image
B
75
S
30
G
35
Posts: 340
Reputation: 22,896


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 16 guests