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

2021/1/26

Scenario not working in web site

1
2
3
danpost danpost

2021/1/29

#
Change line 41 in ScoreBoard class to:
if (users.get(0) == null || ((UserInfo)users.get(0)).getUserName() == null || UserInfo.getMyInfo() == null) {
Roshan123 Roshan123

2021/1/30

#
The problem was in world in line 33 and 34 I added the similar line again in line 159,160,201,202 After removing line 33 and 34 its working properly but now also I need some improvement in RedText class If u will click solo then u will get to know that the scenario still lags Its becaz the RedText class is going on getting name of the user continuously Even if the text is not removed after its health =0
Roshan123 Roshan123

2021/1/31

#
How will i improve RedText class to stop lag??? Is their any way? If yes then how?
danpost danpost

2021/1/31

#
Try this for RedText class:
import greenfoot.*;

public class RedText extends Actor
{
    private B rTank;
    
    public RedText(B tank)
    {
        rTank = tank;
    }
    
    protected void addedToWorld(World world)
    {
        MyWorld myWorld = (MyWorld) world;
        if (rTank != null)
        {
            String name = myWorld.duo == 0 ? "P_1" : myWorld.getName();
            setImage(new GreenfootImage(name , 25, Color.RED, new Color(60,60,40,0)));
        }
    }
    
    public void act()
    {
        if (rTank.getWorld() == getWorld())
            setLocation(rTank.getX(), rTank.getY()-60);
    }
}
and in world, use
RedText redText = new RedText(bSpawn);
Roshan123 Roshan123

2021/1/31

#
not working(the 2nd condition of line 17 is always false) even if i think that their is no condition to remove text when its health = 0
danpost danpost

2021/1/31

#
Roshan123 wrote...
not working(the 2nd condition of line 17 is always false) even if i think that their is no condition to remove text when its health = 0
Move solo++; and duo++; to the beginning of their blocks.
Roshan123 Roshan123

2021/1/31

#
danpost wrote...
Move solo++; and duo++; to the beginning of their blocks.
Do u mean the code written in world. If not then plz mention the class and line number
danpost danpost

2021/1/31

#
Roshan123 wrote...
Do u mean the code written in world.
That is the only place you change their values.
i think that their is no condition to remove text when its health = 0
In RedText class act method, add:
else getWorld().removeObject(this);
Roshan123 Roshan123

2021/2/1

#
In RedText class act method, add:
else getWorld().removeObject(this);
But i will not add the RedText class again Play solo mode and u will get to know the problem I also tried this, but it was not working
if (rTank.getWorld() == getWorld())
            setLocation(rTank.getX(), rTank.getY()-60);
 else setImage(new GreenfootImage("" , 25, Color.RED, new Color(60,60,40,0)));
Roshan123 Roshan123

2021/2/1

#
I some how wrote and RedText class is added when B class is added again to world But it lags while its being added again to world becaz its getting the UserInfo so i preferred to use setImage(null....) But it was not working
danpost danpost

2021/2/1

#
In RedText class, remove String from beginning of line 17 and add the following field at line 6:
private String name;
Then insert as first line in addedToWorld method:
if (name != null) return;
Roshan123 Roshan123

2021/2/1

#
By the way, why r u teaching users for free from many years ago???(if its private, then i m sorry to asking such type of question) U don't even get anything except respect Sometimes I think that u r also a member of greenfoot And Thanks!!!! Finally it's working...
danpost danpost

2021/2/1

#
Roshan123 wrote...
why r u teaching users for free from many years ago? ... U don't even get anything except respect
It is one of the things I do to keep my mind active ... and I enjoy helping others as well as the challenge it offers. You are right, however, that there is no material gain from it. I've had my paypal link on my member page for years with no activity whatsoever. Any and all donations are welcome and greatly appreciated. I do live a fairly simple life.
Sometimes I think that u r also a member of greenfoot
This should be sufficient evidence that I am not a member of the team.
Roshan123 Roshan123

2021/2/1

#
Feeling jealous after going through the link But u r insane in teaching and helping users. (Something like halley's commet. People like u r lacking) I guess why don't they call u to be a part of their team What ever it may be....plz note that, its what i have about u in my mind and its not a fake compliment Lastly i would like to challenge u that u can do most of the things in website except counting the total number of thanks greetings given by users
danpost danpost

2021/2/1

#
Roshan123 wrote...
i would like to challenge u that u can do most of the things in website except counting the total number of thanks greetings given by users
The total count is not important. I am aware that it is quite large, however. Challenge declined.
You need to login to post a reply.
1
2
3