Questions about the Pin behavior...

0 favourites
  • 11 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I have a game to learn English grammar. When you type in the word "he" and hit return the game turns it into a sprite, changes the color of the box, and adds a certain connector to it depending on it's part of speech. I'm having trouble with the connectors and pinning them to the new object....

    How do I pin a newly created object to another newly created object? Right now when I pin the connector to the sprite it is pinning it to the original one and not the newly created one.

    Sorry for the explanation, it is difficult to describe. Below is my capx and I've organized it hopefully so that you can see what is going on. I want the end result to be you typing in a sentence, the game turns each word into little puzzle pieces so that you can see if those words fit together and the sentence is grammatically correct

    https://drive.google.com/file/d/0B5nxe9 ... sp=sharing

    Any help is much appreciated, Thanks.

  • The object who you want to pin on need to be created first in the same event, or, you need to tag this object with something to know it's the right object.

    Learn more from my tutorial games with commented codes or Tutorials on the scirra.com/tutorials

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ahh okay thank you I see now. How do I tag a newly created object as something specific?

    Much appreciated

  • You can setup an instance variable inside it and while creating it, use in the subsequent action another action to setup this variable.

    If you called this instance variable as ID, it should be something like this:

    Condition meet;

    ------------------------ Action:--System.Create SpriteA at Later B on X,Y;

    -------------------------------------Set instance variable SpriteA.ID to 1;

    Now, when you want this item, you can check its SpriteA.ID and make anything with it after this check, because you filtered it and included it to the event, else, any SpriteA on the screen could be picked.

    Another way is filtering by its SpriteA.UID, but this way you'll not be able to know where it was created and keep tracking it's order, etc.

  • TELLES0808 I have it so that each newly created object gets it's own instance variable. So the first object created is 1 and the next one is 2 and so on. But when I go to pin something to it it won't let me use expressions for the pin. It only lets me choose from a drop down list of objects that are already created. So my new objects haven't been created so I can't pin to them.

    Any ideas? "set position to object" and "pin to object" only let me choose from a dropdown box of already created objects. They don't let me use expressions

  • Got make a 'mental switch' here.

    You select (pick) the objects with conditions, the actions work only on the selected objects.

    So, say you have a sprite 'ship' and a sprite 'sail'.

    Give both a instance variable 'PinID'.

    Create the ships, and assign a number to its PinID.

    Create the sails, and assign a number to its PinID.

    Now all is set up. Now we gonna pin them. Starting with selecting those we want with conditions.

    System > conditions > For each > 'ship' ( this picks each ship one by one)

    in the same event > 'sail' > compare instance variable ... dropdown = PinID ... comparison = equal to .. value = sail.PinID (this ads the sail with the same PinID to the selected objects list.

    Now the actions ........ Set position sail to ship

    .....................................Sail > pin to ... ship (the action has no choice then to use only those 2 selected objects)

    Alternative:

    Use containers.

    https://www.scirra.com/manual/150/containers

    If you have no intention to destroy 1 of the pinned objects while keeping the other in play, you are better of using containers.

    Why ? You only need to create the ships. The sails are auto created on the moment that you create a ship.

    Want to pin them ?

    When you select a ship, the sail is auto selected to.

    So pinning goes like ...

    For each > 'ship'

    ........ sail Set position to ship

    ..........Sail > pin to ... ship

    Also later on in the game. When you select a sail, its companion ship gets selected.

    Say, when a sail gets hit by a button, you want the ship to lose speed.

    On 'bullet' collision with 'sail'

    ..... Set speed of ship to lower (ship is autoselected because you selected a sail)

    Hope this helps.

  • 99Instances2Go I see what you're saying. I got all of it and then when I get to the end it doesn't add the "sail" with the same PinID to the selected objects list. So I can't select it as the thing I want to pin it to

    I'm super close though I can feel it! They are all set up with their instance variables and I ran it in debug mode and the two objects I want to pin have equal PinIDs but that last part is tripping me up. I can't get them together

  • In my game I am pinning different objects. So for example, I have 3 different kinds of sails and I want to pin them onto the boats. So I am still not getting it.... maybe I'm missing something

    Here's my .capx

    https://www.dropbox.com/s/jmop016tu57lj ... .capx?dl=0

    The instance variables are set. It's the pin function that im not getting.

  • I want to choose which sail to pin based on some other info and then pin the correct sail accordingly to the boat.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)