保留并获取所有在libgdx中的游戏对象。

huangapple 未分类评论44阅读模式
英文:

Keeping and getting all game objects in libgdx

问题

我正在使用libgdx在场景2d中创建游戏。我需要保留所有游戏对象的列表。我有一个GameObject类,所有游戏对象都是从这个类继承的。问题是,如果你只是将它们存储在GameObject数组中,那么继承类的字段和方法会丢失,这对我来说是不可接受的。你能否建议如何解决这个问题,以及如何最好地保留所有游戏对象的列表?

英文:

I am creating a game on libgdx, using only scene2d. I need to keep a list of all game objects. I have a GameObject class from which all game objects are inherited. The problem is that if you simply store them in array of GameObject , then the fields and methods of the heir classes are lost, which is unacceptable to me. Can you advise how you can solve this problem and how best to keep a list of all game objects?

huangapple
  • 本文由 发表于 2020年4月11日 00:10:46
  • 转载请务必保留本文链接:https://java.coder-hub.com/61144188.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定