Question for firemaplegame : Snap to grid demo

beaudoin_nbeaudoin_n Member Posts: 184
edited November -1 in Working with GS (Mac)
Hi Joe,

Thanks for your demo, i have a question however

How would you go about having several objects not being able to be set on top of each other... right now if i add other balls on the left they will behave correcty until i drag one on top of the other.. they then become 1 inseperable object :(

What would be the best way to actually skip over the objects (ie instead of moving to one right, it will move to 2 right becsause 1 is occupied)...
Or simply prevent overlapping, but that could be tricky because it would limit the user too much...

Thanks for your advice.. Meanwhile i'll try on my own to see if i can get anything done.

Thanks :)

Comments

  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Use touch pressed instead of Mouse down and inside. Worked for me
  • firemaplegamesfiremaplegames Member Posts: 3,211
    hey,

    yeah, that's going to be a little rough with gameSalad...

    first, you would need to keep track of every single grid intersection as global game attributes, the would all be booleans like this: point_1_occupied,point_2_occupied,point_3_occupied...etc..

    If you just have a few points, it might be manageable, but you can see how miserable that is...

    When you drop an actor, switch the appropriate attribute to TRUE.

    Then you would have to constantly check whether that point is occupied, and if it isn't allow the player to drop a new actor in that spot.

    Another "feature" of GameSalad is the ability to click on every single object that is under the cursor at once. Which is why in your above example, the two actors move as a unit. For example if you had a deck of cards on the stage, and you click on the top card, EVERY card gets clicked on.

    It definitely takes some creativity to get around that one...

    You COULD try to use "When actor collides or overlaps another actor" don't allow a new to be dropped, but you would have to test it out. it would be easier than keeping track of all the points... but I'm not sure off the top of my head if it would work or not...

    Joe
  • firemaplegamesfiremaplegames Member Posts: 3,211
    oh, that's a great point maralfer! that should solve the through-clicking if it works!
  • beaudoin_nbeaudoin_n Member Posts: 184
    I only want a 3 by 3 grid.. so maybe it is easier ?
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    I had the same problem and when I changed to touch pressed it went away.

    But that was before 0.8, I haven't tested it on the new version yet
  • firemaplegamesfiremaplegames Member Posts: 3,211
    rats...i just tested Touch is Pressed... it still registers on every object under your mouse/finger...
    was so hopeful for a second...
  • beaudoin_nbeaudoin_n Member Posts: 184
    Ok i still have only 0.7.x because with the threads i read about 0.8 i wasn't sure if i should install it yet... although since it is a new game maybe i should use the newest version ??!?

    Anyways let me see this through...
    I set 9 global vars to tell if my position is occupied or not
    then whenever i release a ball i will try and figure out where i am and attribute the global var to occupied.
    then if i want to release somewhere where it is occupied i'll return the ball to the left of the screen ?

    Sounds right ?
  • beaudoin_nbeaudoin_n Member Posts: 184
    I tried with some collide or overlap events and somehow these don't work :(
  • beaudoin_nbeaudoin_n Member Posts: 184
    Argh... the run to completion wasn't checked :(

    Looks like it can work with just the collide/overlap...

    I'll keep you posted ;)
  • firemaplegamesfiremaplegames Member Posts: 3,211
    yes, with the 9 attributes, that is what i would do.

    and update to the latest version. they won't be going back to 0.7.
    0.82 is way faster, especially on older devices.

    and when you publish a game, they will return a 0.82 app to you anyway.
  • beaudoin_nbeaudoin_n Member Posts: 184
    Hmmmm ... i have the grid working, the logic to not collide them over... but now to validate if they are in the right position... invisible actors on each spot with target value ?
    When target value = my value set global= correct =1
    when click confirm choice and global.correct = 9 then hurray otherwise let them know how many errors ?

    I'll update...crossing my fingers ;)
  • beaudoin_nbeaudoin_n Member Posts: 184
    Hi again Joe,

    I am trying to setup the grid in the middle of the play area, I managed to constraint the objects but depending on where i move from it seems i always get an extra column/row :(
    I set up a minX maxX minY maxY for the constraint rule

    I end up with a 4X4 instead of a 3X3 :(

    Thanks
Sign In or Register to comment.