想要少写代码,请用组件式开发吧。传统的oop,一直做着重复的事性.

先理解下概念

Entity            实体        An entity is just an ID

Component    组件       Components are just data

System          系统       Logic that runs on every entity that has a component of the system

 

选择组件

Crafty("2D DOM");    // select all entities with both 2D and DOM Crafty("2D DOM");

Crafty("2D, Canvas") // select entities with either DOM or Canvas Crafty("DOM, Canvas");

Crafty("*")               // select all entities Crafty("*");

 

相关文章:

  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2018-08-29
  • 2021-11-08
  • 2022-01-10
猜你喜欢
  • 2021-12-12
  • 2021-11-30
  • 2018-08-28
  • 2022-12-23
  • 2021-11-27
  • 2018-08-29
  • 2021-09-09
相关资源
相似解决方案