【问题标题】:Uncaught TypeError: undefined is not a function when using ig.AnimationSheetUncaught TypeError: undefined is not a function when using ig.AnimationSheet
【发布时间】:2013-10-20 01:27:04
【问题描述】:

我现在正在用 Impactjs 编写一个游戏,我一直在努力解决这个问题。在我的 player.js 文件中,当我尝试初始化动画表时出现 Uncaught TypeError。错误位于最后一行。

EntityPlayer = ig.Entity.extend({   
    size: {x:32,y:48},  
    health: 200,
    animSheet: new ig.AnimationSheet( 'media/player.png', 32 , 48 ),

我的 .requires 看起来像这样:

.requires(  
    'impact.entity',    
    'impact.animation' 
 )

由于构造函数 ig.AnimationSheet 是该行中唯一的函数,我认为它无法被识别。但这让我很困惑,因为我认为 Impact.animation 是正确的位置。

【问题讨论】:

  • 粘贴整个js文件调试真正的问题

标签: javascript impactjs


【解决方案1】:

你不需要导入'impact.animation'它包含在实体中

【讨论】: