# Need math help for Unbound Minimap

Get help using Construct 2

### » Fri Mar 07, 2014 8:21 pm

I'm trying to make a minimap that represents where the player is on an unbound layout. So the center of the minimap is where the player is, and the object will move on the minimap as the player moves.

I almost have it.. it works in the upper left quadrant, but calculations are off... it has to do with x/y.

Coordinate math is not my strength! and all the math I look up has origin at 0,0 and use +/- numbers to help you know where origin is. But I'm not entirely sure what C2 is doing with x/y especially since the player has Scroll to Behavior.

any help would be greatly appreciated!~!

https://dl.dropboxusercontent.com/u/36234790/unbound_minimap.capx
I'm using r163
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

### » Fri Mar 07, 2014 11:39 pm

I figured it out... only took me 6 hours to wrap my head around it...

the solution was way more simple than I thought...

the formula is just: MapCenter + (Object.x/y - Player.x/y)

the MapCenter is in essence, the player.. and as the player moves, the objects move away from the player (even though the player is the one that is moving). You are basically just doing the opposite.

Hope this helps someone!
Last edited by jobel on Mon Nov 09, 2015 5:00 pm, edited 1 time in total.
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

### » Sat Mar 08, 2014 4:14 pm

Nice work keep learning. That is the only way you will learn
B
245
S
39
G
15
Posts: 1,944
Reputation: 40,262

### » Sat Mar 08, 2014 4:24 pm

jobel wrote:I figured it out... only took me 6 hours to wrap my head around it...

the solution was way more simple than I thought...

the algorithm is just: MapCenter + (Object.x/y - Player.x/y)

the MapCenter is in essence, the player.. and as the player moves, the objects move away from the player (even though the player is the one that is moving). You are basically just doing the opposite.

Hope this helps someone!

I should have seen this earlier.You wouldn't need to bang your head for 6 hrs.
Math is my passion.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

### » Sat Mar 08, 2014 6:42 pm

Yeah I figured someone had done it before which is why I posted for help (I couldn't find any forum threads relating to this). I have no problem grinding things out and spending hours problem solving. I was just exploring an idea and got stuck on the calculation. I was way down the wrong path trying to use abs() haha...

but hopefully a future person that is looking for the keyword "unbound" and "minimap" will find this post and it will save them 6 hours!

thanks @Doc Ai ! I will keep you in mind for future math dilemmas!
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

### » Sat Jul 11, 2015 11:21 pm

It just helped me
B
61
S
19
G
6
Posts: 325
Reputation: 7,944

### » Sun Jul 12, 2015 12:47 am

@facecjf awesome, glad it helped someone!
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003