Update the normal/highlighted image for an object

Hello!

I’m trying to set a new object image when a player interacts with my object. I’m trying to use “mapSetObjects” with a new “normal” and “highlighted” property, but this seems to create a new object on top of the old one, even though it has the same id.

  game.engine.sendAction({
    $case: 'mapSetObjects',
    mapSetObjects: {
      mapId: MAP_ID,
      objects: {
        [objId]: {
          id: String(objId),
          normal: imgUrl,
          highlighted: imgUrl,
          x: X,
          y: Y,
          width: SIZE,
          height: SIZE,
          _tags: [],
      },
    },
  });

I’ve tried adding updatedAreOverwrites: true, but I’m getting the same result. Also, ideally I would just update normal and highlighted, but it seems to require x, y, width, and size as well. The object is type InteractionEnum_ENUM.EXTENSTION, btw.

Thank you!

Any particular reason you are using “game.engine.sendAction” instead of just using “game.setObject”?

1 Like

Didn’t see that function. Everything works now. Thank you!