Mini Map Help

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello Guys,

    I would like to appear on my minimap the energies, and the enemies moving like in the game screen. The player_icon work, the other icon not. Anyone can help me to solve this?

    Thank you!

  • Hey,

    Your problem is quite clear here : the link between an object and its map representation isn't defined. To put it more clearly, how would the map update an enemy position if each enemy_icon isn't "connected" to an enemy ? I don't see, as a computer, how I would do it as your system is right now.

    So the solution now.

    1/ you need a map initialization. In the initialization, you'll spawn an enemy icon for each enemy on the game. Same goes for energy, so I'll just explain for the enemy for now. Every icon needs a variable, "targetUID" for example. This variable is set during the initialization to the enemy.UID. The positioning is then done exactly like you did for the player icon.

    2/ you need a map icon adding system, to spawn a new icon on the map every time a enemy is spawn.

    3/ during the map actualization, position the player icon like you did, then do a forEach on all the enemies, select the corresponding enemy_icon on the map (using the variable we added in 1/), and then position the icon on the map.

    I see you have a licence for C2, so I'd suggest you use families for "mappables" objects (i.e. the objects of the game that have a map icon) and a family of "map_icons", as all those icons have exactly the same way of initializing/updating/destroying.

    I hope this explanation is enough, I'll put some code in if you need though. Don't hesitate to ask if anything isn't clear.

  • Thank you Gumus.

    I am newbie in Construct 2 and I dont know how to start solve this minimap how you said. <img src="smileys/smiley9.gif" border="0" align="middle" /> Sorry.

    I'll trying do that with families, but i'll back if I dont.

    Thank you again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you're a newbie in C2, let me give you this example.

    This is a simple minimap, a button to spawn enemies, and the code is commented to explain everything.

    If you have any question, feel free to ask.

    I didn't put in the families to simplify everything. You can now just duplicate everything for your "energy" object, or for the player too.

  • Thank you very very very much, Guizmus.

    It will help me...

    I never used 'for each'. I will to study it.

    Thank you

  • Guizmus, i do by myself and the minimap worked fine.

    But, i have a question. If the map is bigger, the game can get slow, can't?

  • Yes and no. The map size isn't the problem. The problem is the number of points on the map and the trigger "on every tick". My code wasn't optimized, I put it like this for explaining. You'll make it faster by updating the map every 0.1 second for example, or 0.2. Also, you could hide the points of the enemies whose icons are outside of the map if you have a big layout. There are numerous ways to optimize this for a bigger map, but it would be a little harder to read/write.

    I suggest you don't bother too much about it for now. Optimization should come later in your game, when it starts to be a problem, or when you are shipping it to another support than PC. When this comes, take a look at my signature ^^

  • Thank you again <img src="smileys/smiley20.gif" border="0" align="middle" />

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