I can't constrain two objects!
chrisstoyanovworks
Member Posts: 23
Hi,I know this is probably a stupid question but I am new to GS so can you tell me how to make 4 actors staying together and spawning randomly as 1 actor on the scene.Here is an example picturehttps://c1.staticflickr.com/5/4509/24154255608_d85c0d637b_b.jpg
Thanks in advance
Comments
Hello.
In short. You need to choose a main actor. This actor will need to constrain its X and Y values to game.attributes (real).
For each actor that is not the main and needs to be connected, you need to work out the difference in X and Y values from the main actor. So each actor will constrain their own X and Y positions to the value of the Game Attributes, Plus or Minus, the distance between them.
Not sure if that is explained very well, so attached is a demo. Touch and move the white actor. The pink actor will constrain to it.
Hope it helps.
Two.E
GSLearn.com | Templates | Free Demos | Udemy Course
@Two.E I appreciate it, but can you tell me how to spawn them randomly when they are constrained
I know it is currently implementable, but wanting to spawn a group of actors to act as one (mainly for more complex collision types) is a hassle. If I were able to have actors grouped together under a single actor (even if with position being relative to that single actor), that would save some time.Please help.
Thanks in advance
Ah to have Graphene...
Yeah, it's a lot of work to set that up.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang ok can you explain it to me or can you give me link to go and find the info
Much appreciated
"wanting to spawn a group of actors to act as one"
What does 'act as one' mean ?
@Socks I mean when they spawn randomly on the scene they will stay together and spawn as they were 1 actor and not separate
What is the difference between the actors being 'separate' and them being '1 actor' (I am trying to understand your question) ?
Hi, I am 99% sure I provided a demo that should do the trick in your other thread. I assume this is the same problem.
The demo showed you how to constrain to a main actor when they are placed on screen. Which means you already know, before the game starts, the distance difference between the main actor, and the one that needs to spawn.
Which means, when it spawns, it will automatically constrain itself to that positioned.
You just have to know where you want it constrained and add that into the constrain behaviours.
Best,
Two.E
GSLearn.com | Templates | Free Demos | Udemy Course
You created three separate threads for the same issue. Please only create one thread for an issue. If you have more details to add or additional questions, add a new post to an existing thread.
/merged two threads
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@Two.E I was struggling to constrain when I have 4 actors, can you tell me how to do it with more than 2 actors
Thanks
Hi,
Attached is another demo. Touch the white actor to move around. The first time you touch it, it will spawn 4 other actors that will be "Attached" to it.
Hope it helps.
Best,
GSLearn.com | Templates | Free Demos | Udemy Course
@Two.E Thank you so much I appreciate the help and I will try and see if it works for me
Thanks for the help but one last question,I managed to constrain them but now I want to spawn them randomly on the scene but not when actor is touched but with a set timer for spawning.
Thanks for the help
@Two.E
Glad to hear!
I really would suggest to have a play around with the demo. Take a look what is happening. If the colour actors are spawning when the white actor is pressed, then you need to find a rule where the actor is pressed.
Now you know what happens when it is pressed. So if you want same thing to happen after a timer. You would copy those spawn behaviours, and place them inside a timer instead. (Not in a rule).
I don't think I can do too much more if you don't understand the very basics of GS.
Hope it helps.
Best,
GSLearn.com | Templates | Free Demos | Udemy Course
@Two.E I fully understand thanks for the support.
Hi,Can someone tell what am I doing wrong because I want to spawn 3 constrained objects on the scene with a timer but everything that I am trying to do to spawn them for example( to use when touch is pressed or when actor collides)isn't working.Please help thanks in advance.Here is a link to an image of the project. https://flic.kr/p/ZZKodV
It will take three seconds before the actors are spawned, are you waiting three seconds to see if it works ?
Do the spawned actors - once spawned - move around the scene ?
Are you - at the time of spawning - looking at an area of the scene that shows Y=6,500 ?
I figured out the problem by setting another actor on the scene and using him as a spawner actor but the problem now is that when the actors spawn the layering isn't working as I set it.Please help
The actors being spawned will either be placed "In Front" or "Behind" the actor that is spawning them. Or, at the "Front" or "Back" of the layer.
Hopefully that makes sense.
However, logic runs from the top of the actor, downwards. Which means if you have more than one Spawn Actor behaviour: (And we choose "In front of Actor"
The first actor spawned is going to be at the top of the layer, since the only other actor is the one that spawned it.
The second actor spawned is going to be in the middle of the layer. Because it will be spawned "In Front" of the actor that is spawning it. But, that doesn't mean it will go in front of the previous actor spawned. Therefore this second actor spawned will be behind the first actor.
This will continue throughout. Therefore, you need to structure the behaviours to suit your needs.
Not sure if that helps.
Best,
GSLearn.com | Templates | Free Demos | Udemy Course
Thanks but that doesn't solves the problem the other actors still stay "behind'' the main actor,I mean they spawn in front of the main actor in the scene but when the main actor collides with them they are underneath him.I hope someone knows the answer to this dilemma.Thanks in advance