ChrisNeedham24 / microcosm

A little 4X game written using Pyxel.
GNU General Public License v3.0
11 stars 8 forks source link

Allow iteration through only movable units #77

Closed ChrisNeedham24 closed 1 year ago

ChrisNeedham24 commented 1 year ago

Currently, the space key iterates through all of the player's units. In cases where a player may have upwards of 20 units, it would be better if they could iterate specifically through the units that still have stamina.

The M key makes the most sense for this. Would need to be added to the controls page.

When there are no movable units, the key does nothing.

ChrisNeedham24 commented 1 year ago

The logic for this can be mostly borrowed from lines 385-402 of game.py, where the space key iterates through units. Except for this, the list of units will need to be filtered to only those that have remaining stamina and are not laying siege to a settlement.

langstof825 commented 1 year ago

@ChrisNeedham24 Can you assign me to this issue?

ChrisNeedham24 commented 1 year ago

Worth noting that there probably won't be room to add this to the controls page post #92, so you may need to implement something like the boundaries that are defined in a few places and scrolling.

langstof825 commented 1 year ago

Alright, cool. I will look into that.

ChrisNeedham24 commented 1 year ago

save-2022-10-16T20.26.44.txt This save should work for what you need @langstof825, has multiple settlements and many units. (You will need to change the file extension from .txt back to .json though, not sure why GitHub doesn't support JSON files.

langstof825 commented 1 year ago

Worth noting that there probably won't be room to add this to the controls page post #92, so you may need to implement something like the boundaries that are defined in a few places and scroll

Do you get scrolling for free when using boundaries? I am trying to extend the controls page, but i cannot seem to find the area where we enable the scroll. I noticed when you move around the map using the arrow keys it pans through the map. Is that similar to what i need here?

ChrisNeedham24 commented 1 year ago

Having thought a little more about this one, I don't think we'll need 'scrolling' per se. You might just be able to have two 'pages' of controls and the down arrow key sets the page to 2 and the up sets it to 1. Then you'd just need a conditional when displaying the controls, and probably some sort of arrow to denote that you can do it (maybe similar to how the settlements work in the status overlay).

langstof825 commented 1 year ago

Hmm, alright. That sounds pretty reasonable. I'll give that a go.