Game Development Community

Random NPC

by Chris · in Torque Game Engine · 02/28/2004 (11:12 am) · 3 replies

I'm building a Platformer with torque. However, looking at platformers in general, I've noticed that they usaully have several different NPC, but that each class of NPC look the same. EG: all turtles look the same. I want to be able to make each NPC have a randomly assigned skin, so that there is more variety. I'm a bit of a novice, so I was hoping someone might point me in the right direction....

- Xtencilate

#1
02/28/2004 (4:22 pm)
Look in ShapeBase::onAdd and modify the texture loading code to append a random number to the base texture name, say between 1 and 5. Provide 5 variants of the texture and poof, you've got random looking guys.

Increase 5 and structure of the number generator as needed for realistic effect.
#2
02/28/2004 (4:28 pm)
Thanks Ben. Sounds good.
#3
02/28/2004 (6:13 pm)
Glad to help.