Creating Maximum Movement Indicators on a Board

  • EDIT: No longer relevant. Problem pinpointed.

    Kyatric, feel free to delete this post.

  • EDIT: No longer relevant. Problem pinpointed.

    Kyatric, feel free to delete this post.

  • EDIT: No longer relevant. Problem pinpointed.

    Kyatric, feel free to delete this post.

  • vee41

    Just now saw your comment about setting taken to false for the square the program is sitting on. Definitely is a hacky way to do it, but if it works then it works. Would this be a hacky way to 'reset' it?

    <img src="http://i.imgur.com/P37IfOe.png" border="0" />

    Thanks for all your help on this man. Now on to modifying your movement function so the program moves across the squares one at a time instead of instantly jumping to location ;)

  • vee41

    Just now saw your comment about setting taken to false for the square the program is sitting on. Definitely is a hacky way to do it, but if it works then it works. Would this be a hacky way to 'reset' it?

    Probably depends on whom you ask. :) I'd use a different event that resets the variable whenever token overlaps it. That way there would be no need to reset it that way, depends on your event structure and preference really.

    Pleasure to help, your game is looking good!

  • I'm going to have to bring this up again.

    vee41, are there restrictions or situations where the movement highlighting does not work? It seems to only work 'forward' and not account for spaces behind the object.

    For example, I am implementing highlighting of squares a program can attack. It uses essentially the same function.

    <img src="http://i.imgur.com/VccStqs.png" border="0">

    However, only squares that are 'forward' seem to be highlighted, with some to the side completely ignored.

    <img src="http://i.imgur.com/uyyLPlV.png" border="0">

    The same applies for program movement, although I've largely ignored it up til now because it seemed to 'fix' itself if you moved toward a square you should be able to move toward anyway. Here's an example of squares not being highlighted for movement.

    <img src="http://i.imgur.com/pisYOCd.png" border="0">

    The .capx in case you want to run and fire up the debugger to take a look:

    BoardGame.capx

    UPDATE: I've determined that the function doesn't check for spaces around corners. vee41, do you know how to accommodate for that?

  • Taking vee41's .capx and changing the moves for each token to 4 yields a similar result.

    <img src="http://i.imgur.com/iqyFp1C.png" border="0" />

  • Bumping. I'm still not exactly sure why the recursive function that vee uses seems to miss sometimes.

  • R0J0hound, if you have time, I'm curious as to how you would handle grid movement highlighting. vee41 has a working implementation that works 90% of the time, but there are some issues sometimes.

    Just looking for ideas on another approach.

  • Been busy with other things, I'll look into it when I got some time :)

  • Glad to hear it!

    I'm the kind of person who doesn't like letting problems "go" so I can move on to other aspects of a project. Eventually the problems add up and a big headache will follow, so I will wait and try to decipher why some squares aren't being highlighted.

    EDIT: Here's an idea.

    Ignore walls initially, and highlight all possible squares a program can move to. Then remove the highlighting for squares that overlap a wall, and also remove highlighted squares that are not next to another highlighted square or the original program or one of its parts.

    The last part is needed to prevent a single square beyond a wall from being highlighted simply because it is in range (but is not overlapping a wall).

  • cvp, how close is vee41's implementation to what you had in mind?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • vee41, do you have skype? I'm going to go insane...

  • I've discovered something peculiar. There is a definite problem for the space to the right of another square, and I don't exactly know why.

    <img src="http://i.imgur.com/wmOCt54.png" border="0" />

    <img src="http://i.imgur.com/0P7KsBj.png" border="0" />

    <img src="http://i.imgur.com/Rtz48d6.png" border="0" />

    This is the relevant code:

    <img src="http://i.imgur.com/C3fI0qL.png" border="0" />

    Time to figure out why...

  • Remove the Animation frame != 3 line and it should work. Thanks for spotting the bug out :)

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