Need math help for Unbound Minimap

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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

  • 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!

  • Nice work keep learning. That is the only way you will learn

  • 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.

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It just helped me

  • awesome, glad it helped someone!

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