Hi guys, I'm Alexandre from France, it's my first time 'round here and I'm actually coding my first little game with actionscript and I need a little help .
My games is a kind of top down strategy/turn based game where you have 2 teams with some units each on a tilemap. When you click on a unit from your team there is a little menu that shows on screen. It's basically 2 icons around the unit, one to move it, one to aim and shoot. If we take the move mode, you would click on the icon, then some tiles turns red to show where you could go and then you would click on one of those red tiles to move here. My probleme is that every steps are coded and pretty ok but if you click on the icon the unit move directly on the tile that is under the icon on the menu.
My question is : do you have any idea on how I could separate those two actions with two clicks ? I tried to use differents vars or booleans to activate different states but it's calculated to quickly and it always end up that everything is done with one click.
I hope I've made myself clear (not sure about that ) and I all thank you in advance for reading and maybe help me.
Hi ! I forgot to mention one thing. I'm not coding within flash but with Flashdevelop and with FlashPunk. The two buttons are entities and they are checked with basic function that compare the mouse position with a rectangle. So they works, they both do the right action.
But they are displayed on top of everything near the player. Imagine I click on the move button, the click acts on the button and on the tilemap to move on the same time, that's what I want to break.
Hard to show you some code because it's a mess as I rework things a lot and it's spread across various entities. I had a chance to make it work before I reworked my selection code by putting the menu and the moving action in 2 separated functions which were called this way in an update function : - moving - menu. It wouldn't worked if it was inversed but I think it's a dirty fix and I still try to find a kind of method to make it work.