SirTuffy Posted March 23, 2017 Share Posted March 23, 2017 Hello, I am pretty new to Phaser and also to JavaScript and while coding a game I keep on getting this error " TypeError: Argument 1 of CanvasRenderingContext2D.drawImage could not be converted to any of: HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap." I have been stuck on it for a day or so and I would like to see if someone could help me find where the problem is. I have been following a few tutorials i find on the web on how to work with Phaser and js here is a pastebin of the code. http://pastebin.com/2CScJnH6 Link to comment Share on other sites More sharing options...
FakeWizard Posted March 24, 2017 Share Posted March 24, 2017 Just noticed that the player variable is commented , any reason for that? You're then trying to apply physics to it and stuff..so maybe that's causing the errors /// player = game.add.sprite(7 * 63, 13 * 64, 'character'); If that's not the issue, can you upload your assets somewhere so I can test it properly? Link to comment Share on other sites More sharing options...
SirTuffy Posted March 24, 2017 Author Share Posted March 24, 2017 Yes I was trying to see if that was where the problem was starting but i just forgot to take it out of "//" in the pastebin. newlevelone.json Link to comment Share on other sites More sharing options...
SirTuffy Posted March 28, 2017 Author Share Posted March 28, 2017 Just wondering if anyone could help I am still stuck without finding a solution to the problem. Link to comment Share on other sites More sharing options...
samme Posted March 28, 2017 Share Posted March 28, 2017 On 3/23/2017 at 0:29 PM, SirTuffy said: TypeError: Argument 1 of CanvasRenderingContext2D.drawImage could not be converted to any of: HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap." https://developers.google.com/web/tools/chrome-devtools/console/track-exceptions#view_exception_stack_trace Link to comment Share on other sites More sharing options...
SirTuffy Posted March 28, 2017 Author Share Posted March 28, 2017 Thank you I am pretty sure the errors are just coming from my assets not the code. Link to comment Share on other sites More sharing options...
samme Posted March 28, 2017 Share Posted March 28, 2017 Yes, they are. Link to comment Share on other sites More sharing options...
SirTuffy Posted March 30, 2017 Author Share Posted March 30, 2017 Thank you for your help! Link to comment Share on other sites More sharing options...
Recommended Posts