[JS]unable to get property 'getGame'

I’m trying to do basic things in JS, to get used to it and this time the error message I get is pointing to ‘runtimeobject.js’ instead of my script, and I think it because the problem is there and not in my code but I’m not sure. :laughing:

So, what I’m trying to do is to move an object to the right if the cursor is over the object.

This is the code I’m using.

var speed = 10; for(var i = 0;i<objects.length;++i){ if(objects[i].cursorOnObject()){ objects[i].setX(objects[i].getX()+speed); } }

And when I run the preview I get this error in the console:

Here is an example:
example.zip (2.16 KB)

Anybody could help?
Thanks :slight_smile:

This error says that runtimeScene is not defined (exactly says that it can get the property getGame of an undefined object).
So, you probably forgot the pass the runtime scene to the function :


Thanks Victor :slight_smile: