This site requires JavaScript, please enable it in your browser!
Greenfoot back
imshuenn
imshuenn wrote ...

2021/9/8

PLS HELP ME ;( work fine in greenfoot but unable to run with browser

imshuenn imshuenn

2021/9/8

#
This is my first time trying on java and greenfoot. I created a mini-game mygame and it works fines on my computer but when I publish it online, it can't work and all I already searched through the internet but can find the solution TT It shows this: "Exception instantiating world class: java.lang.RuntimeException - (JavaScript) Error: Invalid recorded state" I've shared my source code, anyone please help me ;(
danpost danpost

2021/9/8

#
I do not think javascript likes to pre-assign Object type static fields. Try assigning their objects in your world constructor, rather than in their declaration lines.
imshuenn imshuenn

2021/9/10

#
danpost wrote...
I do not think javascript likes to pre-assign Object type static fields. Try assigning their objects in your world constructor, rather than in their declaration lines.
Sorry for asking, but how can I assign them in world constructor rather than in their declaration lines? I have no idea about it :(
danpost danpost

2021/9/10

#
imshuenn wrote...
how can I assign them in world constructor rather than in their declaration lines? I have no idea about it :(
ObjectType givenName;
declares an Object reference field (w/o modifiers -- like public, static, etc).
givenName = new ObjectType(...);
assigns a new Object instance of declared type to the field.
imshuenn imshuenn

2021/9/11

#
danpost wrote...
imshuenn wrote...
how can I assign them in world constructor rather than in their declaration lines? I have no idea about it :(
ObjectType givenName;
declares an Object reference field (w/o modifiers -- like public, static, etc).
givenName = new ObjectType(...);
assigns a new Object instance of declared type to the field.
Thank you so much! I'll try it out :)
You need to login to post a reply.