How can I create an indicator that reports an object?

0 favourites
  • 12 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I make multiple objects appear randomly on the map. I would like it if an indicator appeared on the screen indicating the object closest to the boat. How can I do?

    game photo:

    photo example of indicator:

  • -For Each Object (Select the Object you summoned a bunch of randomly)

    -Pick Nearest (Select the Object you summoned a bunch of randomly)

    Set Indicator position to (Select the Object you summoned a bunch of randomly .X and .Y)

  • if I set the position of the indicator in the x and y of the closest object it is positioned exactly above me but I do not want this, I want it to be placed at the edge of the screen.

  • That is why I said to pick the nearest 'Object you summoned a bunch of' - as you called it

  • I don't understand. I have a "player" that moves throughout the map and various objects that spawn throughout the map. On the edge of the screen (for example in the mobile phone) there must be an indicator that, depending on where the closest object is, moves right to left above or below, but always on the edge of the screen (so this indicator must always be visible at the 'user). An example is given by the second image from the treasure with the indicator located at the edge of the screen, they move depending on where the treasure is

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks like you do not need the For Each - Pick nearest does that for you.

    Sprite is your hero

    sprite2 is your marker

    sprite3 is your object you summon a bunch of

  • Ohhhh ... So you would still want to find the closest in the same way.

    Then I would build some invisible walls surrounding the border of the screen on a HUD Layer so they do not move when your character does. Create an invisible line stretched from your hero to your object 'treasure'. And where your line intersects with an invisible border is where you create your marker object.

  • sorry, I don't understand you :(

  • This will explain what I mean in pictures :)

  • This video might help you out. Most of the mechanics are the same and you can look at my code on there too.

    youtu.be/UwLf5Im9Au4

  • I'm getting really hard to keep the indicator in the edge of screen, I can make the line you indicated in the image, which starts from the hero to the treasure .. but I don't need all this continuous line, but only the indicators on the sides of the screen

  • No you don't need it, it is simply a way to find the intersecting point. You can also us math to do it by finding the X distance from you to the edge and comparing it to the X distance from you to the treasure, then taking that % of the Y distance and that'll give you the position.

    This in my opinion is a lot harder to understand/show in a forum.

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