How do I have enemies move to an unoccupied tile in a hex-based game?

0 favourites
  • 8 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • I am building a hex-based action game with chain attacks. I currently have two powers configured (the left two electric icons): one that chains across all m-type (mechanical) units (Zs and Ss), and another that chains straight through a whole lane.

    My new problem that I can't figure out is how to then get the unit behind an empty tile to move forward and occupy that empty tile. So when an enemy is killed, how do I have the enemy behind it recognize this and move forward (well, down)?

    I have attempted something unsuccessfully in the event sheet under the bottom group.

    Each hex has several image points to detect adjacency.

    Let me know if I can provide any info that might be helpful -- I appreciate help from anyone willing. dop2000 helped me on this project on my post 'HOW DO I CHAIN ATTACKS IN A HEX-BASED GAME?' (thanks again!) Any help from anyone is appreciated.

    Thank you all!

    Link to the cp3 file: https://drive.google.com/drive/folders/105X6atSPvtSDtg291ZYKjWd6cAfbcPrC?usp=sharing

  • I'm not sure if the is the BEST way to do this because I have never taken the time to build a hex-based game in Construct but since I noticed this topic has been here for a while without an answer, I figured I would try my hand at it. The attached example uses a dummy object with the path finding behavior to set the path of the red character. The hexagon object has the solid behavior but it is disabled where the player is allowed to travel. To Ensure the character can only land on empty spots, you need to enable the solid behavior of occupied spots and regenerate the obstacle map.

    Also, you will notice a bunch of disabled events/actions. If you enable them, the player movement will be restricted to a set number of moves.

    drive.google.com/file/d/1N3yvrCkc3uxw74kD5VYxARlXavN7sUqE/view

  • Thank you InDWrekt. After extracting your files though I wasn't able to open the c3proj in Construct (?). Were you able to open mine? The *player* won't be moving anywhere; only enemies.

    I appreciate you taking a crack at it as yes I'd gotten no responses yet.

    Thanks!

  • I built the project in the current stable release (r218) of C3. Is that what you are using to try to open it? There are no plugins so there shouldn't be anything preventing you from opening it.

    Yes, I was able to open yours but I didn't really take any time examining it. I wanted a clean example so the code would be clear.

    I understand that you want the "Enemy" to move but that doesn't change anything. "Player" or "Enemy" are just semantics and the code is all the same.

  • Also, if you could post the error message you are getting when trying to open the project I might be able to figure out how to solve it.

  • InDWrekt okay was just making sure my premise made sense :-) No specific error — in C3 (most current version) I’m going Cloud Open and navigating to the folder with the c3proj file that I extracted from what you sent. But the c3proj file doesn’t show up there. It’s like it isn’t readable in that form? I believe mine show up as cp3 files but I don’t see a cp3 file in the file you sent. Sorry for my confusion.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Don't extract the the file. it should stay as a single file. When you download it, it should have a .c3p file extension. If it downloads as a .zip, just change the .zip to .c3p. In Construct, use the open local file option.

  • InDWrekt ah got it. Thank you, this will be a huge help. I hadn't thought of using pathfinding. I will take a crack at this. I truly appreciate your help with this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)