[Plugin] slg_movement

  • Vati-nyan

    Each tile/chess is an instance (sprite, usually) which has UID for registering (put into) board object. So that this slg_movement plugin could go thorough tiles to get cost by condition.

    Does that mean I have to manually set the cost of each tile after they have been placed on the board at start of layout? Since at first they are all the same. I'm not sure how to do this in practice.

  • Vati-nyan

    You might place a private variable "cost" (or something else) for each tile/chess.

  • Vati-nyan

    You might place a private variable "cost" (or something else) for each tile/chess.

    Instead of having the code set up the tiles automatically at the start, I tried drawing it manually and then include all tile objects in a family. Then use it like this instead of the tile sprite:

    Would that work then? As a way to have different terrain types.

    My own attempt didn't do much, but that is possibly because I tried doing it with the Tilemap object. Would I have to put in each square of the map as sprites? Or am I completely off the mark?

    Sorry for all the questions! I like this plugin a lot, and would love to understand it better.

  • Vati-nyan

    I thought Tilemap is a single object for all (virtual) tiles, you only could get 1 uid from tilemap, and I don't think that tilemap could assign private varialbes for each tile.

    To place tiles manually, you might try

    or

  • Vati-nyan

    I thought Tilemap is a single object for all (virtual) tiles, you only could get 1 uid from tilemap, and I don't think that tilemap could assign private varialbes for each tile.

    To place tiles manually, you might try

    - layout2board plugin , it could create orthogonal or isometric, or hexagonal board.

    or

    - txm importer v2 plugin for tiled map editor

    I used Layout2board, and it works nicely for making the board! I don't know why I missed that before, I must have mixed up the names.

    I have one last question for now though! I've made the board with that plugin, and moving around it while including all tiles in a family works just fine. I still haven't managed to get move costs to work properly though - for now the move cost function still looks like this:

    I guess it's not properly picking up what tiles it should?

    Thanks so far for being patient and helping out

  • Vati-nyan

    This slg_movement plugin will try to move to neighbors, it will ask the cost of target tile by "cond:on cost function" and pass exp:TileX, exp:TileY, or exp:TileUID to let user return cost by these info.

    You could dump the (exp:TileX, exp:TileY) under "cond:on cost function" by action:log in browser object, to see the trace of moving.

  • Vati-nyan

    BTW, be careful that the overlaping of tiles instances in layout editor, the overlaping tiles will be kicked out of board object, since there is only 1 tile/chess could be placed in a logical xyz position.

  • Alright, I will see if I can figure out how to get the target tile that way. And I will keep the point about the tiles in mind!

  • Vati-nyan

    The simplest way is Condition Pick by uid

  • It works now! Thank you very much, that last sentence managed to get it through to me I understand it all a little better now.

    Now it will hopefully take a long while until I have to ask something again, heh.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I've been playing around with this plugin and it's amazing.

    >

    > Is it possible to assign each individual its own movement cost? If so how?

    >

    > Ideally I want to make some tiles cost more to move through without being impassable or unable to be stopped on.

    >

    > Any hint of how to do this would be greatly appreciated.Harlequin2013-11-27 16:38:44

    >

    Hello again! I'd like to echo the question above. So far I see that movement can be affected with one cost and one filter, but how does one go about having different terrain costs on one map?

    I take it you need some way to register what objects the chess moves across? (If you use something like TiledBG or Tilemap together with the board)

    If your looking something like advance wars where a grass tile costs 1, a woods 2, mountain 3 and can't stop on rivers that otherwise cost 2 then yes its doable.

    Here is what I have so far.

    https://www.dropbox.com/s/z1bpovnm7jbsm ... mybad.capx

  • Harlequin

    Uh, your file is a *.caproj which is a folder structure, not capx (single file).

  • my mistake, link fixed

  • Update:

    Add A* path finding, recycle more objects after finding.

  • rexrainbow

    Hi, can you give this awesome plugin an option to count diagonal movement in a square grid?

    I mean right now the current option for square grid, unlike hexagonal grid is to create the movement nodes horizontally and vertically only, leading to result like the gif below, which is fine and I am pretty grateful for.

    Can you make an option to create the movement nodes diagonally too?

    So results like this can be achieved.

    Thanks in advance

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