New gear type: Pointer (to point at important things)

No replies
Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 4 days ago. Offline
Joined: 2012-06-20
Posts: 1301

I suggest to add a new gear type, the pointer.

The pointer is a small visual aid which points at some position or gear.

On the player's screen, it shall be represented by an arrow which points at the position or gear. If the pointed position is outside of the screen, the arrow should be shown at the border of the screen and the correct direction.

If a hedgehog is active, the arrow points from the CurrentHedgehog to the target.
Otherwise, the arrow points from the center of the screen to the target.

Additionally, a number should be written next to the arrow to denote the distance from the point of reference. If no hedgehog is actice at the moment

If a hedgehog is active and it is very close to the target, the arrow and distance number should be hidden.

Note that many things about this gear depend on the client, so the gear has to be displayed differently on different clients, depending on the screen size and current camera position.

To illustate all that, I give you two explanationary images:

https://i.imgur.com/PGmERYt.png

In this example, the highlighted area is the supposed screen area. As you see, the arrow is drawn at the border of the screen, and not outside of it. The number denotes the distance between the hedgehog and the crate (which is the target of the pointer).

https://i.imgur.com/G9hxdP0.png

This is an annotated example.

Proposed Lua API functions:

AddGearPointer(gear, distance)
- Adds a pointer which points at the position of the specified gear
- The arrowhead is drawn *at least* at the specified distance away from the target, if the target is visible on the screen. Theere should be a default value and this argument should be optional. The arrow *may* be further away, but it must not be closer than the specified number
- The function returns the gear handle of the created pointer.

AddCoordPointer(x, y, distance)
- Adds a pointer which points at position x, y.
- The distance argument like in AddGearPointer
- The function returns the gear handle of the created pointer.

UpdateCoordPointer(gear, x, y, distance)
- Updates the specified gear, which is a CoordPointer. The target coordinates and the distance will be simply overwritten.
- Returns nil

The pointer can be useful for several things: For example, it can be used to point to the next target in a target practice mission. It could be used to point to all crates in the game, in a shoppa script. It could be used to point to a certain goal crate in a mission. And so on.

The engine could use such a gear directly, too (automatically used, without any scripts). For example, Hedgewars already does something like that when it is a new hedgehogs's turn and it is out of screen. I wonder if this requires to change a lot of code.
Maybe you could think of other potential uses within the engine as well.

Another possible extention to the idea would be arrows in different colors, but this is not so important to me.

Hi, I am a Hedgewars developer. Smile

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]