Any way how to drag actor to predetermined position?
![networ](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
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![:( :(](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/frown.png)
(I need about 18 "slots" for my game... Is that possible?)
P.S. Sorry for my English...![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Thanks again.
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
![:( :(](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/frown.png)
(I need about 18 "slots" for my game... Is that possible?)
P.S. Sorry for my English...
![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Thanks again.
Comments
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
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
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
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
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...
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
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
When the iActor is there then something happens and if it aint then it doesn't happen.
Hope this helps
Cheers
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
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
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
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
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.