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

2021/1/16

I cannot figure out why I have an error

Rich11 Rich11

2021/1/16

#
countLength++; if(countLength>15 && isTouching(Player.class)) { getWorld().addObject(new YouLose(), getWorld().getWidth()/2, getWorld().getHeight()/2); Greenfoot.stop(); } This error says "cannot find symbol- class YouLose"
Super_Hippo Super_Hippo

2021/1/16

#
Do you have a class with the name “YouLose”?
Rich11 Rich11

2021/1/17

#
No I do not believe so, how do I create one and where should I put it? Sorry I am new to this.
danpost danpost

2021/1/17

#
Rich11 wrote...
No I do not believe so, how do I create one and where should I put it? Sorry I am new to this.
Right click on Actor class and select "new subclass ...". Use "YouLose" for the name.
Rich11 Rich11

2021/1/17

#
Okay I have done that
Rich11 Rich11

2021/1/17

#
I still have the error... What codes should I use in the new subclass?
danpost danpost

2021/1/17

#
Rich11 wrote...
Okay I have done that
You should not have that error, now.
This error says "cannot find symbol- class YouLose"
danpost danpost

2021/1/17

#
Rich11 wrote...
I still have the error... What codes should I use in the new subclass?
Depends on what you want to happen when the player loses. You could simply stop the scenario or wait for keyboard or mouse action to either restart or stop. First, however, is providing an image -- something saying or indicating you lost. This can be done by setting a default image to the class or programmatically creating the image. Instructions on what action, if any, the user can take would also be helpful.
danpost danpost

2021/1/17

#
Rich11 wrote...
I still have the error... What codes should I use in the new subclass?
Same error? Show current YouLose class codes (entire page).
You need to login to post a reply.