[Plugin]Board, Layout2Board [Behavior] Grid Move

From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • rexrainbow

    SLGMovement Get Moving Path set to "nearest" seems to have quit working for destinations that are beyond a distance of Cost. It used to fill in the path up to cost even if the destination was out of range. This is probably related to the recent infinite size upgrade?

    Correction: never mind. It looks like I can't duplicate the problem. Sorry for the false alarm

    yours

    winkr7

  • Works fantastic rex but if you click and drag really fast you can bypass tiles.

    Also can i limit the amount of tiles that one can travel in each go by a variable? (in case equipment or whatever allows further travel, and will also allow me to consume food based on length travelled)

  • skrotar

    I am not sure what you want... sorry. Could you explain more detail or provide a simple capx?

  • I was talking about this - The drag to move on a hexagonal map. In your example there when you drag your finger really fast you can "skip" tiles (going along the top/bottom of the tiles instead of through them).... is it possible to fix this?. I did managed to figure how to limit how many tiles you can drag over in one go, but was wondering if there was a way to "count" what tiles are traversed and remove that from a resource variable? for example if you move over a forest tile (takes 2 "food" or whatever) and two grass tiles (each taking one food) for a total of 4 food to be removed from the "food" variable.

    https://onedrive.live.com/?authkey=%21A ... faultclick

  • skrotar

    1. Add "Condition:Are neighbors (UID)" (rex_board) to check next dragging tile is adjacent current dragging tile.

    2. Add instance variable to count the cost of moving.

  • Hello;

    I am wondering what to do with the z value of stacked chess, if I make them all z=1 then if I add another chess to x,y,1 I kick the chess that is already there. In the documentation it says

    "To avoid kicking, user could assign z-index of each chess by its uid (for example, "uid"+chess.uid), so that all z-index of chess will be different."

    should this read "(for example z=chess.uid)" ? so z is a number?

    Thanks for your time.

    yours

    winkr7

  • winkr7

    Z index could be number or string, the expression is "prefix + chess.uid", like

    "uid" & chess.uid[/code:zdmd3o8e]
  • rexrainbow

    That makes sense.

    thankyou for your time.

    yours

    Winkr7

  • Hi rexrainbow

    I'm using your Board, squareTX and GridMove plugin to make a isometric puzzle game. Thank you for such awesome plugins / behaviors!

    Now I have a few questions.

    GridMove

    Is it possible to let the player jump? So that you can jump over a obstacle on the board?

    Board

    I generate a board with a few missing tiles. So that the player can drag and drop the missing tiles on his own. Is there a proper way to check if the tile gets dropped over an empty spot on the board?

    I'm currently using something like this.

    But with this code you have to put it very exactly, otherwise it won't fit. Better would be to snap it to the grid if it overlays an empty cell in the board.

    Have you any code examples for using drag and drop to but tiles on the board?

    Here is a demo of the current state of the game.

    https://dl.dropboxusercontent.com/u/105 ... index.html

    Thank you!

    Regards

    Andy

  • AndreasR

    GridMove

    Set property "MoveTo" to "No" to disable built-in moveTo behavior. Therefor, you could control the movement by yourself.

    Board

    Uses condition: is empty to test empty is correct. Transfer PXY to LXY using

    • Board.PXY2LX( puzzle.X , puzzle.Y )
    • Board.PXY2LY( puzzle.X , puzzle.Y )

    Here is a sample capx which drag a chess between two boards.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AndreasR

    GridMove

    Set property "MoveTo" to "No" to disable built-in moveTo behavior. Therefor, you could control the movement by yourself.

    Board

    Uses condition: is empty to test empty is correct. Transfer PXY to LXY using

    - Board.PXY2LX( puzzle.X , puzzle.Y )

    - Board.PXY2LY( puzzle.X , puzzle.Y )

    Here is a sample capx which drag a chess between two boards.

    Hi rexrainbow

    Thank you for your fast reply. It works perfect with an orthogonal board, but not with an isometric board. Because you need to calcualte an offset to the drop position, then if you drop the tile above the hole, the actual empty cell is a little bit further down (due to the isometric)

    Hope it's understandable At the moment it works (not perfectly, but it works). But I thought there is a smoother method than mine above.

    Regards

    Andy

  • AndreasR

    Here is a demo of dragging tile on an isometric board. ( source capx )

    • drag tile from board to pull it
    • drop tile to an empty cell to push it on board.

    Is the hot spot of your tile/chess sprite not on the center?

  • AndreasR

    Here is a demo of dragging tile on an isometric board. ( source capx )

    - drag tile from board to pull it

    - drop tile to an empty cell to push it on board.

    Is the hot spot of your tile/chess sprite not on the center?

    Once again big thank you, rexrainbow

    I figured out that the problem is the "3D tile". It's not actually a square (64,64), that's why I needed an offset to detect the accurate LX,LY.

    Now I made a workaround to snap to the empty cell when the tile hovers above it. That's why the origin point of the tile is not in the center.

    Thank you!

    Regards

    Andy

  • AndreasR

    Yes, a position wrapping might be necessary in your case.

    One possible solution is put a tile under the "drag-able" sprite (3D tile), and pin to the the "drag-able" sprite. Then you could still use the position of tile to detect the logic position ( LXY ).

  • AndreasR

    I added the position alignment to the cell in the previous sample capx.

    See the event 9:

    Set position of tile to ( Board.PXY2NearestPX( tile.X , tile.Y ) , Board.PXY2NearestPY( tile.X , tile.Y ) )

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