I’ve made a few other posts about my grand strategy game pretty recently. I’ve worked on the game quite a bit constantly, and I present my next issue:
For those who don’t know what a grand strategy is/what my game is: Here is an image and an explanation.
It is a game where you select a country (I selected Castile in this image) and do stuff. Currently there’s barely anything to do.
(The map is very unfinished, the whole world will be made eventually but this is what I have made so far.)
A VERY important thing about this game:
The map is divided into “provinces” which you can see in the image. Each province has a variable on what country it belongs to, and they are colored accordingly. Each province is a DIFFERENT OBJECT in the same group, not different instances of the same object.
Now, objects that ARE created with code are the armies (the little numbers.)
You only see the ones of the country you selected.
Now, each province also has a variable on how many armies are created there at the start of the game. This variable is only useful right when the game loads and becomes obsolete after.
The armies are text objects, and they are instances of the same object. They all have the armyTroops variable which indicates how many troops are in them, and that number is displayed on them.
Now, army movement. I created a simple movement thing before this but realized the armies could move anywhere on your country instantly so yeah, it got deleted.
How I want armies to move is you left click on one to select it, and right click where you want it to move.
There are two ways this can go:
- Armies move from province to province, their movement is defined by provinces.
- (This might be easier to do) Armies move freely and can go anywhere, not fixed position by provinces.
For both of these, they shouldn’t be able to go in water. One of the downsides to #2 is that it’ll probably be harder to enforce the water rule for it.
Here is all the code for the armies (trust me, there isn’t any other code which is useful for this issue. I barely have 3 screens worth of code.)
If you really want more of my code, I’ll post more of my code in a reply, but I don’t think it’ll be necessary.
1 more thing, time elapses in this game, and you can pause and unpause it with SPACE, there is a variable TimeSpeed which can be 0.1 or 0, when it is 0.1 time elapses, when 0 it doesn’t. Armies should freeze what they’re doing when TimeSpeed is 0.
Anyway, I think that is all I wanted to say, I hope I didn’t forget something important.