Author Topic: When restart shoot target?  (Read 8655 times)

SomeGuy

  • Rogueliker
  • ***
  • Posts: 64
  • Karma: +0/-0
    • View Profile
    • Email
When restart shoot target?
« on: December 25, 2012, 03:51:33 PM »
In most RLs, when you want to shoot at a target there appears a X or something, that lets you choose the target of your ranged attack.

It is expected that when you select a monster and shoot at him, if the monster is still alive, the X keeps in the previous aiming position so you don't have to move it all the way back to the new monster position.

The question I have is: when is this X expected to be restarted and show back over the player position?

So far, I restart it when the monster is killed, but I'm not sure if restarting it when the player moves is a good idea because in combat the player may move for any reason, but still he may want to keep the same target.

Also I thought about a "isInCombat" flag, that is true when in combat, and false when every monster is killed and/or inactive. So, moving the player while in combat, the crosshair keeps in the same previous position, and when out of combat, if the player moves the crosshair restarts.

The problem with this is that the player may want to target another target that is opposite of the previous target, and there will be no way to restart the crosshair while in combat.

So basically, what is, in your opinion, the expected or desired behavior here?

I know it may sound a stupid question, but when playing around with many ranged attacks, having to manually target over and over may be annoying, and I want the less annoying way to do this.

Also, BTW I'm not interested ina "autoselect nearest target" thing. That will come in later versions.

requerent

  • Rogueliker
  • ***
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: When restart shoot target?
« Reply #1 on: December 25, 2012, 04:40:55 PM »

Instead of targeting a location, target a specific monster. As long as that monster is visible/alive, you just always re-target it. Otherwise, you can work your way down a few criteria, such as nearest monster.

Code: [Select]
If LastTarget is not null and visible and Alive:
          LastTarget -> Target
Else if GetNearestEnemy() is not null:
          GetNearestEnemy() -> Target
Else:
          Self -> Target

SomeGuy

  • Rogueliker
  • ***
  • Posts: 64
  • Karma: +0/-0
    • View Profile
    • Email
Re: When restart shoot target?
« Reply #2 on: December 27, 2012, 11:04:20 AM »

Instead of targeting a location, target a specific monster. As long as that monster is visible/alive, you just always re-target it. Otherwise, you can work your way down a few criteria, such as nearest monster.

Code: [Select]
If LastTarget is not null and visible and Alive:
          LastTarget -> Target
Else if GetNearestEnemy() is not null:
          GetNearestEnemy() -> Target
Else:
          Self -> Target

Great idea this is, Sir.

BTW I will add to the ToDo list the "target enemy" instead of "target location".
I also have a "target nearest" for later versions.

guest509

  • Guest
Re: When restart shoot target?
« Reply #3 on: December 27, 2012, 01:05:18 PM »
Req' nailed it. This seems to be the standard.

AliensRL and DoomRL do it this way, if I'm not mistaken.

kraflab

  • Rogueliker
  • ***
  • Posts: 454
  • Karma: +0/-0
    • View Profile
    • kraflab.com
Re: When restart shoot target?
« Reply #4 on: December 27, 2012, 04:22:18 PM »
It's also nice to have a key that skips the targeting overhead and just attacks the last thing you attacked.  I.E. in Epilogue the spacebar attacks the last monster you hit, or the nearest if the last one if not available.  Less key presses.

SomeGuy

  • Rogueliker
  • ***
  • Posts: 64
  • Karma: +0/-0
    • View Profile
    • Email
Re: When restart shoot target?
« Reply #5 on: January 01, 2013, 04:56:36 PM »
It's also nice to have a key that skips the targeting overhead and just attacks the last thing you attacked.  I.E. in Epilogue the spacebar attacks the last monster you hit, or the nearest if the last one if not available.  Less key presses.

What if there are 2 enemies that are exactly 3 cells away from the player?

I think the best way is to have a single key binding, lets say ^T (throw). If there is no previous target, then the crosshair appears in the player position.

If the player was shooting to an empty cell, i.e. without monsters, then save those coords for the next shoot.
But if there is a monster, then save the monsterID and the next time the player press ^T then move the crosshair to the saved monster ID.

When the player move the corsshair, restart the saved crosshair possition to zero and the monster id to null.