草庐IT

playerCtx

全部标签

javascript - 使用 2d html5Canvas 和 ctx.rotate 函数沿其面向的方向移动对象

标题说明了一切,我正在尝试根据物体所在的Angular向前移动物体。这是我的相关代码:xView=this.x-this.width/2;yView=this.y-this.height/2;playerCtx.drawImage(imgSprite,0,0,this.width,this.height,xView,yView,this.width,this.height);playerCtx.save();playerCtx.clearRect(0,0,game.width,game.height);playerCtx.translate(xView,yView);playerCtx