我需要创建一个 Orc 对象
class Orc extends new Entity(){
constructor(){
super();
this.lifetime = 100;
this.move_x = 0;
this.move_y = -1;
this.speed = 1;
}}
继承自Entity类
class Entity{
constructor(){
this.pos_x = 0;
this.pos_y = 0;
this.size_x = 0;
this.size_y = 0;
}}
当我尝试这样做时
let obj = null;
obj = new Orc();
我抛出一个异常:Class extends value # < Entity > is not a constructor or null
有人请帮我解决这个问题
运算符
new和括号是多余的。需要这样: