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

2020/9/14

Lag

1
2
Roshan123 Roshan123

2020/9/14

#
can anyone tell me the reason why my scenario is lagging(plz explain me in the most easiest words) Laggggggggggg Its less then 2 mb
danpost danpost

2020/9/14

#
Roshan123 wrote...
can anyone tell me the reason why my scenario is lagging(plz explain me in the most easiest words) << Link Omitted >> Its less then 2 mb
You will need to update (re-upload) the scenario to include the source code.
Roshan123 Roshan123

2020/9/14

#
ok now download it as soon as possible so that i can remove the source code
Roshan123 Roshan123

2020/9/14

#
reply anything after u downloaded the source code
Roshan123 Roshan123

2020/9/14

#
sorry, now its worknig
danpost danpost

2020/9/14

#
Roshan123 wrote...
reply anything after u downloaded the source code
anything
Roshan123 Roshan123

2020/9/15

#
Oh again sorry i marked that sometime(not always) my scenario is lagging while it touches the crate(unity symbol) so plz can u fix it
danpost danpost

2020/9/15

#
Roshan123 wrote...
Oh again sorry i marked that sometime(not always) my scenario is lagging while it touches the crate(unity symbol) so plz can u fix it
The only issue I see is the excess amount of imaging code. The shields and stones can be done every 2 to 3 act frames. The counter only needs to be re-imaged when there is a change in the score or when sec/60 changes. Something else that would help is not to create smoke every act frame. Using a static image for smoke would also help (by not having to create the image every time you create smoke). That, at least, are a few things you could do to reduce what the cpu has to do every act frame.
Roshan123 Roshan123

2020/9/15

#
I don't want to remove sheild,smoke Will it be done by removing stones,lettuce and adding static color in sheild(no random color) If not then is their any other way
danpost danpost

2020/9/15

#
Roshan123 wrote...
I don't want to remove sheild,smoke
I was not suggesting removing them -- just cutting back on how often their images are updated (shield/stone) and cutting back on the how often you create them (smoke)
Roshan123 Roshan123

2020/9/15

#
Do u mean this:- i should use static image{stone(no random color), sheild(no random color), smoke{static image)} Am i correct or not
danpost danpost

2020/9/15

#
Roshan123 wrote...
Do u mean this:- i should use static image{stone(no random color), sheild(no random color), smoke{static image)} Am i correct or not
Smoke: correct (static image) Stone/Shied: incorrect (use random color; but do not change every frame; change every other frame or every 3rd frame).
Roshan123 Roshan123

2020/9/15

#
so how will i change stone and sheild frame plz share the code which u have(after changing it)
Roshan123 Roshan123

2020/9/15

#
int frame;
setImage(new GreenfootImage(127,127));
     getImage().drawOval(0,0,128,128);
    if(++frame % 4==0)
    {
     getImage().setColor(new Color(Greenfoot.getRandomNumber(255)+1,Greenfoot.getRandomNumber(255),Greenfoot.getRandomNumber(255)));
     getImage().fillOval(1,1,100-50,100-50); 
     frame =0;
    }
do u mean this
Roshan123 Roshan123

2020/9/15

#
i tried the above code but its still lagging in the website
There are more replies on the next page.
1
2