I’ve been having a go at this for almost 48 hours.
Can someone help me out here please?

# Model - player
# setup a collision solid for Mod1
self.Mod1Col = self.initCollisionSphere(self.Mod1, True)
# set up bitmasks Mod1 can only collide into things
# Mod1 will only collide with objects with this bitmask
# add Mod1 to the traverser
base.cTrav.addCollider(self.Mod1Col[0] , self.tileColHandEvent001)

# Model 001
# setup a collision solid for tile model
self.tileCol001 = self.initCollisionSphere(self.tile001, True)
# set up bitmasks tile model can only be collided into and will collide with the other object
# add tile model to the traverser
base.cTrav.addCollider(self.tileCol001[0], self.tileColHandEvent001)
# accept the events sent by the collisions
self.accept('into-' + self.tileCol001[1], self.collide1)
self.accept('outof-' + self.tileCol001[1], self.collide2)

def collide1(self, collEntry):
def collide2(self, collEntry):

This works fine.
However, I want the same thing to occur on different tile models the player collides with. Let’s say I have two more different tiles, and I want them to change color when the player collides with them. How might I go about this?

I wonder why no one is replying to my questions.
I hope I didn’t ask a really backward question.
Could someone help me out please.

You could modify your code so that the tile is passed into the function as an argument, then accept events for each tile.

Also, why did you add the tile to the collision traverser? Only from objects need to be added to the traverser.

Thanks for replying.

I followed the example to a ‘T’. You see, I don’t really understand collisions well. That’s why I don’t understand what to do with this:

If you could explain by example, I would greatly appreciate it. Thanks

Well, right now I don’t have Panda or Python installed on my computer, so I can’t really give you code to look at, but basically what I was trying to say is that you take the code that worked on the first tile and re-use it on all the other tiles in your game.

Exactly how you do that is probably a matter of personal preference, but what I would probably do is create a tile class that inherits from DirectObject and have each one listen for it’s own collision events.

Thank you so much for replying. I really appreciate it.

I had tried this before. The first and third tile responded fine, but when the character collided with the second tile, an event occurred on the third tile. I checked and tripled checked to make sure I had not made a mistake. All the codes seemed fine, but time and again the problem occurred.
However, I really appreciate your taking interest to respond. I will keep trying till all efforts are exhausted. Thanks again.