Unable to call the function multiple times inside block function using phaser js game framework

40 views
Skip to first unread message

Vihang Kale

unread,
May 4, 2021, 5:16:16 AM5/4/21
to Blockly
I am unable to call the update function multiple times inside block function. Please refer the images for the code.2021-05-04 14_44_55-Snowman Blockly and 7 more pages - Personal - Microsoft​ Edge.png
2021-05-04 09_04_26-C__Users_Vihang_Downloads_game.js • - Sublime Text (UNREGISTERED).png
2021-05-04 09_03_26-C__Users_Vihang_Downloads_blocks_JS.js - Sublime Text (UNREGISTERED).png
2021-05-04 09_07_54-C__Users_Vihang_Downloads_game.js • - Sublime Text (UNREGISTERED).png
2021-05-04 09_04_03-C__Users_Vihang_Downloads_game.js - Sublime Text (UNREGISTERED).png
2021-05-04 09_05_08-C__Users_Vihang_Downloads_game.js • - Sublime Text (UNREGISTERED).png

koz...@google.com

unread,
May 4, 2021, 5:00:09 PM5/4/21
to Blockly
Looking at the error code that you get "Uncaught TypeError: Cannot read property 'setVelocityX' of undefined" and your implementation of the update function (from the screenshot), the variable "player" is undefined when you call the update function, so an error is thrown and it is only called once.
I don't know where "player" is supposed to be defined based on the code you've shared, so I can't tell much else. This could be an issue with how you set up your interpreter or your implementation of update.
~ Monica

Reply all
Reply to author
Forward
0 new messages