Problem with self.Tags

fogartyfogarty Member, PRO Posts: 181
edited October 2012 in Working with GS (Mac)
I have some blindingly simple code that isn't working (and I've already searched the forum and scanned all the available video tutorials), so I'm hoping someone here can help.

I have three actors in my test scene.

Block 1: A block I drag around. It makes a sound when it collides with actors that are tagged art1
Block 2: A block that has no rules. I created it with the tag art1.
Block 3: A block that has only these rules:
constrain attribute --> self.Tags ---> art1
display text ---> self.Tags

The block I drag around makes the noise when it collides with Block 2, but it doesn't when it collides with Block 3. Because I have the "display text" rule, I know that self.Tag does = art1 in Block 3, but I can't for the life of me figure out why it isn't acting like the block that was created with the art1 tag.

Does anyone have any ideas? Is there something I don't understand about changing the Tags attribute? (I tried both "change attribute" and "constrain attribute.")

Thanks!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Im pretty sure its not an attribute you can change on the fly. There are a handful of those in the actors that cannot be changed once the app is running. What is it you are trying to do with Tags? Do you just not know where to set them originally?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
  • fogartyfogarty Member, PRO Posts: 181
    Thanks, @tenrdrmer.

    I'm generating a bunch of small puzzles from words and labels in a table. When you finish a puzzle, you click a button to randomly generate the next one. Each block has a different word each time, and the label associated with that word needs to change because your score is based on matching the word to the label.

    For example, let's say in puzzle 1, you have three words: cow, iron, carrot. The puzzle spawns blocks labeled animal, mineral, and vegetable, and the player has to drag the right block to the right word. I wanted to do it by tagging the "word" actor with "label" (after it's known which word has been randomly chosen, and therefore, its associated lable) and then using a rule that says "When the actor collides with a block tagged 'animal,' (for example) increase the score, destroy the "animal" block, and make the "cow" word sparkle.

    If I can't do it on the fly with tags, can you suggest another way or recommend a tutorial I can read or watch that shows how to do this?
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    give your blocks an unique id , can be anything from no. to text. Let's say cow.id = 1 , then animal block.id =1 when collided and conditions cow.id = animal block.id then destroy block etc... therefore you can have any kind of animals with id = 1 but you only need one animal block to collide inorder to destroy the block.
  • fogartyfogarty Member, PRO Posts: 181
    Thanks, @GLGAMES.

    I think I see how that will work.
Sign In or Register to comment.