Why would a guy act hot and cold but when he sees you talking to another guy act really nice and back on again?

A guy seemed to l really like me, then he backed off for a bit and became slightly cold.
i was talking to another male friend the other day and this guy saw this and as soon as I finished talking, the guy was really nice and attentive again trying to get my attention. He was sitting close, leaning in, which he hasn’t done before. I really don’t get the mood swings. Does it even like me or not really? I thought we had good chemistry both physically and mentally.

Why would a guy act hot and cold but when he sees you talking to another guy act really nice and back on again?
Post Opinion