How to - Different behaviors for different clones of an object

This is giving me trouble. In my game, I have a level select screen that allows you to move to different levels and see how many “medals” you have per level.

As an example, each “level button” is a clone of the same object, but clicking each one should bring you to a different level, they each need to move to different positions, and they each have their own animation.

Another example is the medals display. Each display is a clone of one object, but they each need to move to different positions and they each have their own animations.

The level buttons seem to work fine, but the medals display keeps giving me goofy bugs. What is the best way to have per-clone behaviors? I’m currently sending messages to each clone then a reader outputs which number the clone is. That goes into filters to determine which behaviors should happen with each clone. However, I think maybe the way messages work is causing issues. Does anyone have any input here?

I looked at @JR01 “1” game, but I can’t find anything that would help in my situation. Maybe I just need to look harder, idk

Welp I made a stupid mistake and that was it :sweat_smile:

1 Like

I’m not sure whether to be upset that I spent an hour and a half trying to figure out why my code was broken, only for it to be one tiny thing that I just forgot to do, or to be happy that it only was just a little thing rather than a huge complicated mess. I think I’ll be both haha

If you want to use different behaviors in cloned objects, you need to indicate what clone uses what behavior. This can be done many ways, such as using location, starting values, or an (advance) ID messaging system.

3 Likes

I am doing a message system, which actually seems to be working great once I worked out the dumb little mistakes I had.

1 Like