Assigning Actor Tags

okkleokkle Member Posts: 32
edited November -1 in Working with GS (Mac)
Hi everyone,

I have a quick question regarding Actor Tags. I've set up a tile-based game and I'm wanting an easy way to change the type of tile for new levels and I was wondering if I could do this with actor tags?

Basically I have a solid block actor and another character actor that can move around until it hits one of these solid block at which point it stops, so the solid blocks are a wall basically. I'd like to add in some different block kinds like traps that when the character comes into contact with they will die. I can do this with separate actors in the library all ok, but I was wondering if there is a way I can do it by setting the Actor Tag in each of the blocks in the stage?

So for example, I set my character to if it collides with an actor with tag 'Death' it destroys itself, whilst if it collides with and actor with tag 'Solid' it bounces.

Then in the block actors on the stage I can double click each one and edit the instance, rather than the template, and say at the start `Change Attrribute, 'Actor tag' to 'Solid' or 'Death'` along with a bit of code that changes the image based on what the Actor tag is.

Or is this not how Actor tags work? I have tried it and it didn't seem to but I figured I might just be going about it the wrong way? It gives me the option to change their attribute so I figured there must be a way?

I can set it up with the different actors for the traps and blocks in the library, it's just lining them up is slow and tedious and sometimes the movement seems to go off (in that some decide to move slightly ahead of their identical copies on stage). So I'm trying to set up an easy template now to make level design smoother later :)

Thanks for any help!
-Olly

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Olly, for your collision example, that should work fine (and by the sound of it, it does); so When actor overlaps or collides with actor with tag Solid then your collide behavior, etc.

    As for rules for changing tags when the game is running, I'm not sure you can do that (although would be interested to know if I'm wrong on this point). I know we have Actor Tags as a Game attribute but the text value of that just seems to be all names of the tags; and it can't be changed. Can't see the point of it if it can't be changed; certainly if it could be changed then you would get what you're after.

    (Unless the value in the game attributes list can't be changed by hand but can be changed in-game with a change attribute behavior, then you'll get what you're after. I haven't tested this; couldn't gather whether or not you have to see if it works.)

    A workaround is to use a boolean. Roughly:

    When Choice is false
    When actor overlaps with actor with tag Solid
    --- your collision events
    otherwise
    ---your other events for "Death"

    Hope I've helped there and understood you correctly...

    As well for your interest, if you didn't know, you can use the tags to make the groups of actors easier to find as a type in the Scenes Editor window. THere's a popup menu at the bottom of the Inspector, that says All as the default. If you hold that down, you can select a particular tag to display only those actors with that tag in the Inspector. Really useful if you've got hundreds of actors.

    ----------------------------------------------
    http://davidgriffinapps.co.uk/
Sign In or Register to comment.