Any way how to drag actor to predetermined position?

networnetwor Member Posts: 89
edited November -1 in Working with GS (Mac)
I still trying to make this:
I have scene with no gravity. I can drag actors whole the screen. It works great. I have actor "slot" --> if some actor, which I can drag collide with "slot" it interpolate his X and Y position to slot X and Y. It works great too. But now, I need a rule that will be control if some actor is "in" actor "slot"... I made an atribute "full" for checking collide...I tried this:

If actor "block01" collide with "slot01" and attribute full="false"
Then interpolate block01.x to slot01.x and block01.y to slot01.y
and change attribute full="true"

--> This can't work, because it change attribute "full" to true, and interpolate "block01" position work only if attribute full="false"...

So, How can I check if SLOT is "full" or not? Thanks for any help! I have trying this for a long time and I still can't get it worked :(
(I need about 18 "slots" for my game... Is that possible?)
P.S. Sorry for my English... :)
Thanks again.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    have a look at this

    http://gamesalad.com/game/3406

    search the title in the new section of the gamesalad creator to open the demo. And use the arrow keys to move
  • networnetwor Member Posts: 89
    Thank looks, great... But I think it can't solve my problems... Grid is probably not problem - I need to check if in some grid box is some actor, and if yes, you cant put there another...
  • TheGamerTheGamer Member Posts: 94
    Im very new to GS, but you would need to count the amount of slots that is full(using a counter), so if slot 1 is full then go to slot 2etc. Thats how I would solve it anyway, maybe someone has a better suggestion?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    A couple of things which might help: first, providing your attribute starts off as false, there is no need to include it, so now try:

    If actor "block01" collide with "slot01"
    Then interpolate block01.x to slot01.x and block01.y to slot01.y
    and change attribute full="true"

    Also, not fully understanding the gameplay without seeing your game, maybe each of the slots needs its own attribute, i.e S1full, S2full, etc.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • networnetwor Member Posts: 89
    Yes, you understand right, every "slot" need its own attribute. My biggest problem is when I will have for example 1 "slot" and 2 "blocks"... I put "block01" to "slot" and there is a problem I still can drag "block02" to "slot" so I get 2 "blocks" in 1 "slot"... I can't find solution how to fix it...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Maybe put the x and y starting coordinates of all your blocks into attributes.

    So now in the block's Rules (I'm guessing your Rules are in the blocks, not the slots):

    When actor "block01" collide with "slot01"

    ----then another Rule within that first Rule----

    When S01full is false
    Then interpolate block01.x to slot01.x and block01.y to slot01.y
    Change Attribute S01full="true"
    Otherwise
    Move To ---putting in the attributes with the x and y coordinates and speed

    By the sound of it, it doesn't matter which blocks go into which slots, is that right? If that's the case, you'll carry on:

    When actor "block01" collide with "slot02"

    ----then another Rule within that first Rule----

    When S02full is false
    Then interpolate block01.x to slot01.x and block01.y to slot01.y
    Change Attribute S02full="true"
    Otherwise
    Move To ---putting in the attributes with the x and y coordinates and speed

    ETC-------

    This is off the top of my head and untested but should work OK.

    If it does matter which block goes into which slot, then you only need one Rule within a Rule, changing "block01", "slot01" and "S01full" accordingly, depending on which block the Rules are in.

    Then add to each block's Rules (this first example is for block01)

    When touch is released

    --Rule within this one set to Any--
    When block01 collides with slot02
    When block02 collides with slot03
    ETC;

    then
    Move To attribute ---putting in the attributes with the x and y coordinates and speed

    Hope this helps; I'll do a little test now to see if what I've suggested actually works! Hope so.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Just thought, if on touch release and the slot is full, and you want the block to return to its starting position, you don't need attributes for the x and y coordinates in the Move To attribute. Just put in the actual positions.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • networnetwor Member Posts: 89
    Yes, thanks I do it almost same way... I hope it help me ;) I'll try it..

    EDIT: I works great if i drag "block to "slot" and can't move with this"block" anymore... But what about if I want to put "block01" to "slot01" and then drag "block01" again ad put in in "block02" - There is problem with checking "full" or not...
  • ozboybrianozboybrian PRO Posts: 2,102
    I think this would be fixable if you could show us a video. It's alot to picture.
  • networnetwor Member Posts: 89
    Total time i try it is about 30 hours!!!! I thinks it's impossible with game salad - too many things which wont work :(

    EDIT: I dont have video, but I think of game which use this system and only which I know is Farmville ( I dont wan make farmville or something like that sh*t...) But i need this grid placement which will be checking if some array of grid is full then it dont allow me to put there block... I think that every array of grid must be different actor, but I dont know to get it work :( ... I'm going crazy I stuck on it for a long time.... :(
  • ozboybrianozboybrian PRO Posts: 2,102
    Tried Tshirt booth or Tech support?
  • networnetwor Member Posts: 89
    Yes, probably I will try... but I dont want to pay much for this :D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    networ said:
    EDIT: I works great if i drag "block to "slot" and can't move with this"block" anymore... But what about if I want to put "block01" to "slot01" and then drag "block01" again ad put in in "block02" - There is problem with checking "full" or not...

    There's no straightforward way in GS to flag when something has collided but then doesn't anymore. Here's some stuff for you to experiment with though:

    Make text attributes, slot1status = empty, slot2status = empty, etc.

    Each of the slot actors will have to be separate actors so that the blocks can "access" them for overlap/collide

    then in the Rules of the blocks - changing parameters accordingly -

    when colliding with slot1
    when slot1status = empty
    change att. slot1status = block1Fill
    change x,y attributes to those of slot

    when colliding with slot2
    when slot1status = empty
    change att. slot2status = block1Fill
    change x,y attributes to those of slot

    ETC

    ---this below is when the block is dragged and released still within the slot's area:
    when colliding with slot1
    when slot1status = block1Fill
    change x,y attributes to those of slot

    when colliding with slot2
    when slot2status = block1Fill
    change x,y attributes to those of slot

    ETC

    ---and for if the slot is already full:

    when colliding with slot1
    --Rule within Rule:
    when ANY conditions are true:
    when slot1status = block2Fill
    when slot1status = block3Fill
    when slot1status = block4Fill
    ---ETC
    Move to --- x,y coordinates outside of all slots

    when colliding with slot2
    --Rule within Rule:
    when ANY conditions are true:
    when slot2status = block2Fill
    when slot2status = block3Fill
    when slot2status = block4Fill
    ---ETC
    Move to --- x,y coordinates outside of all slots

    ETC

    Now for the problem of flagging when a block is no longer overlapping/colliding with a slot (example where there are only 2 slots, 20pxls square, 10pxls apart - there's a lot of work here but I can't think of any other way):
    When all conditions are true:
    block.position.x > 0
    block.position.x < 11
    otherwise
    block.position.x > 20
    block.position.x < 31
    otherwise
    block.position.x > 50
    block.position.x < 61
    ETC

    then same for the y

    when slot1status = block1Fill
    change att. slot1status = empty
    when slot2status = block1Fill
    change att. slot2status = empty
    when slot3status = block1Fill
    change att. slot3status = empty
    ETC

    The above seems quite a lot to do for actions which appear so simple; if anyone else can simplify it that'd be great. Anyhow, hope it helps and works out for you.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ValanValan Member, BASIC Posts: 410
    You could destroy an invisible actor(iActor) in the slot when it is full. This sets up a physical boolean trigger.

    When the iActor is there then something happens and if it aint then it doesn't happen.

    Hope this helps

    Cheers
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Valan said:
    You could destroy an invisible actor(iActor) in the slot when it is full. This sets up a physical boolean trigger.

    When the iActor is there then something happens and if it aint then it doesn't happen.

    Hope this helps

    Cheers

    Hi Valan, there are quite a few slots it would seem, so you'd need more than one invisible actor, each with it's own switch. This would add even more work. Also it still leaves the problem of how to trigger the boolean to switch when the block leaves the slot.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi networ, don't know if you've abandoned this idea or not; certainly the problem was bugging me and I wanted to know the solution.

    I said a couple of times that there's no "when actor doesn't collide" to use but it seems I'm wrong. I've just made a small test, adding to the dragged block:

    When block1 overlaps/collides with actor of type slot1
    Display text IN
    otherwise
    Display text OUT

    And whaddayaknow, it works OK. So in place of the Display Text you'd have a boolean change attribute (or a text one as above so you know which block is in which slot).

    There's enough here now for you to get your system up and running now, I'm certain.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ValanValan Member, BASIC Posts: 410
    @networ
    Sorry. I didn't fully understand that you wanted single specific indicators for each slot.

    @ gyroscope
    For a general situation It only needs one actor and uses instances. The instances are spawned but are deleted on collision with another actor. So it works well for indicating which areas that are blocked and those that are free to use.The physical appearance of the instance is the boolean switch rather than setting it in code.

    The downside is that there is spawning and deleting, but these consumptions of time can be 'hidden' if the gameplay is slow at that moment. For instance I use it when the player is deciding which position to play from.

    Cheers
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Valan, good thinking but you can only spawn prototypes, not instances.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ValanValan Member, BASIC Posts: 410
    Correct gyroscope.

    Doh!
    I should have said that my game spawns four prototypes of the same actor. Instances were used as a quick way to get the correct coords of where to spawn the prototypes.
  • simo103simo103 Member, PRO Posts: 1,331
    there is a basic select and drop grid demo template that appears to do something like what is needed. Search 'Grid' and double click the "Basic .... one.
Sign In or Register to comment.