GameSalad

Word with Friends Type Grid

Hey I am fairly new to gamesalad and I have been searching a lot for this answer but most of the links that can help me with this process seems to be broken. I wanted to how do I start in making a grid like word with friends but only 10X10.

Comments

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    Welcome! You'll want to use tables so if you're not familiar with their use, start by Googling tables GameSalad and watching/reading the tutorials. Tables are a lot like spreadsheets and are arranged in a grid (rows & columns) format so they are a natural fit for word games.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang ok thanks I am researching that now. I'm really using objects not the words per say but I know tables will help also. Do I have to make different actors for each square in the grid or is their a shorter way to make a hundred square grid. Sorry for all these newbie questions also. Once I get the grid down I should be fine.

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    Objects? Is this more of a match 3 game than a word game?

    @TomTomGames said:
    Do I have to make different actors for each square in the grid or is their a shorter way to make a hundred square grid.

    It's hard to answer that without knowing more details. You can spawn actors using a loop and then have instances of a single prototype at each grid spot. But there are other methods, too, depending on what you're trying to achieve.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang yes sorry for the wording. I meant to say symbols. But it is more of a match game. Basically I wanted to make 10 x10 grid where I would be able to drag and drop different color symbols into each square . Once it is in that square it becomes closed and a new symbol in a certain order is spawned at bottom of the grid for me to drag and drop again into the next square and so forth.

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    So probably you don't need to make separate actors for the grid squares themselves. The grid could just be a single actor with an image of the background grid. As for the actors that get spawned and dragged, you would need a rule that forces their position to "snap to grid" when the mouse button/touch is released.

    That looks something like this:

    When Touch is Released
         Change self.Position.Y to round(self.Position.Y/80)*80

    I used 80 to illustrate the concept but you'd replace that with the size of your grid squares, in pixels.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang Thanks a lot got it working . My final question is how do you now make it unmovable. It snapped to the grid but I don't want that grid to be able to put anything else in and the object can not be dragged after. I know it might have to something with a booleen attribute I'm guessing.

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    @TomTomGames said:
    My final question is how do you now make it unmovable.
    I know it might have to something with a booleen attribute I'm guessing.

    Yep, the basic logic would be:

    When [snapping to grid] AND attribute self.placed=false
       [snap to grid]
       change attribute self.placed to true

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    Hey @tatiang the first object snaps to grid and becomes undraggable but when I try to drop the next object in another square it either snaps to the one previous or moves the previous symbol to another square grid. How do I make it that it stay in that square and don't move anymore. Is it because my grid squares is one single actor?

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    I'm not sure... ideally the grid "square" is just a location on the scene that each actor snaps to. But if you're having problems with actors snapping to other squares, you might need to make sure you're using actor attributes (e.g. self.______) not game attributes that are global and accessible to all actors.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang Hey here is what I put for my grid actor. The problem I'm having is once that objects snaps I don't want the next one to able to over lap it and snap to that same grid square. I used a boolean attribute as stated.

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef
    edited May 19

    Ah, well, it's going to be difficult to prevent two actors from correctly snapping to the same position. I'll have to give that some thought. Where would you want the second actor to snap to if the normal position is occupied?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang The actor should snap to whatever grid square I drag and drop it on the grid which is a 10x10 board. this part is working . The issue I'm having is I don't want a symbol to be able to snap on a grid square that is already occupied. Like lets say someone tried to drag drop and in the square grid again with a item already inside. I want to destroy the actor and spawn it back to the original location to drag and drop again basically saying invalid move.

  • tatiangtatiang Posts: 11,085Member, Sous Chef, PRO, Senior Sous-Chef

    Okay, then you'll need a table that stores occupation data (e.g. a boolean for each grid square). And yes, that means 100 cells to keep track of in your table. Then when you are about to snap to grid, you'd check the table for occupation. If not occupied, you'd snap the actor and set the boolean to true for that grid.

    This is complex stuff!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,899Member

    First make a tag for all your squares, call them squares then add a self Boolean attribute to the square actors call it can snap.

    Add a rule. When actor overlaps and collides with actor with tag squares

    Change attribute can snap false.

    Otherwise

    Change attribute can snap to true.

    Add the self attribute to your rule shown.

    When self attribute can snap is true.

  • JapsterJapster Posts: 381Member, PRO
    edited May 22

    @The_Gamesalad_Guru said:
    First make a tag for all your squares, call them squares then add a self Boolean attribute to the square actors call it can snap.

    Add a rule. When actor overlaps and collides with actor with tag squares

    Change attribute can snap false.

    Otherwise

    Change attribute can snap to true.

    Add the self attribute to your rule shown.

    When self attribute can snap is true.

    @The_Gamesalad_Guru - Sounds a good method too! - But, @TomTomGames - Might be worth making SMALLER custom square/circle colliders for your pieces, if the pieces are almost as large as the squares, so you end up with a bit of dead space you can use as valid placement criteria - will remove frustration trying to line up the pieces - ie.:-

    In this rough 'n' ready example the PIECE 1 (placed) and PIECE 2 are actually 'colliding' if using standard colliders that are the same size as the actors, but the smaller custom colliders (in RED) are NOT colliding, which gives a bit of leeway in deciding if an action is valid... :wink: PS - Custom colliders that are circular or standard rectangles don't seem to affect performance in my limited experience...

    Also, obviously you can use calculations to work out which square of the board you're on, but alternatively, if you used the same custom colliders on the board pieces too, and each board had it's own X/Y attribs (and whether something is already placed there, using tables etc), it could broadcast which cell the piece has been dropped onto, and set Game Attributes.

    If the colliders are made the right size, you could also make it so that any piece dragged over the grid is (physically) ONLY able to touch 1 cell collider at once, which would further simplify logic for valid placement? - i.e. the piece could even change image/dim/change opacity if not touching any, and be fully visible etc if colliding with a valid square (Though you might be better off using rectangular colliders to make this work easily)

    One further point if using this method/logic, is that it's easy to swap out an 'active' / tagged cell actor for an 'inactive' / tagged cell actor once placed (perhaps even with the piece as part of the new image / occupied cell (could then remove the 2 actors, replace with one), and reduce even more overhead on the GS system... :smiley:

    The second benefit to this, would be that if a piece being placed is then colliding with ANY active cell, you ALREADY know that it's a valid move, and where it's attempting to be placed (as the colliding cell will broadcast it)... :smiley: (Of course, updating a table as well, is still great practice - that data can be interrogated much more easily than getting the info from actors!...)

  • TomTomGamesTomTomGames Posts: 8Member

    @tatiang @Japster @The_Gamesalad_Guru Sorry for the late reply but thanks and I greatly appreciate the help. I will try each method and see which one will work best for me. Thanks again.

Sign In or Register to comment.