Question about BGT

Hi.
As the title says, I have a question about coding in BGT.
Is there any ways to substitute different types of class handles in one array? I think I can't.
I would like to handle many different types of objects in the game. For example, the game has robots, dragons, and demons as enemies, and pits, mines as obstacles, and other objects like items, switches.
In this case, the only way I know is declaring multiple classes for each type of the object, and check them for each loop like this.
for loop
//enemies actions
//obstacles actions
//other objects actions
for loop end
Though I can use switch structure for coding different moves or strategies for each type of the enemy, that's very complicated I think.
I thought it would be helpful if I could declare a array called objects, and place all class handles in it.
If it can be written, I can do like this.
for loop
if(objects(i).condition==active) objects (i).act();
for loop end
(note:some characters were changed because they were blocked as errors by this forum)
By doing this, each object runs its particular act function like robot.act, dragon.act, or elevater.act.
Is it actually possible? And if not, how do you control multiple types of objects with simple and high-performance way? Just switch?

URL: http://forum.audiogames.net/viewtopic.php?pid=176088#p176088

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Off-topic room : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : keyIsFull via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : keyIsFull via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : Dark via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector
    • ... AudioGames . net Forum — General Game Discussion : yukionozawa via Audiogames-reflector

Reply via email to