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

2019/11/12

How can i solve this lagging problem?

KiddoNow KiddoNow

2019/11/12

#
Cheers, i‘ve got this quick code for an enemy to move between two walls: {
if (!wallInfront()) { move(); } else { turn(180); }
But the problem is that the rest of the game (multiplayer game, WASD and arrow keys) starts to lag. The other players can‘t move smoothly, which means I have to e.g press W a couple of times for it to react. How can I avoid this problem? Thanks in advance and have a nice day guys!
danpost danpost

2019/11/12

#
Check your speed slider and make sure it is about in the middle of the bar. Make sure you are not using Greenfoot.delay unnecessarily. Check that you do not have an over-abundance of actors in your world. Those are usual reasons for lagging. Excessive image manipulation can also tax the CPU and cause lagging. If you feel none of these is the cause, you may need to show all your code (uploading the scenario with published source would be the easiest way to make the codes available to others).
KiddoNow KiddoNow

2019/11/12

#
danpost wrote...
Check your speed slider and make sure it is about in the middle of the bar. Make sure you are not using Greenfoot.delay unnecessarily. Check that you do not have an over-abundance of actors in your world. Those are usual reasons for lagging. Excessive image manipulation can also tax the CPU and cause lagging. If you feel none of these is the cause, you may need to show all your code (uploading the scenario with published source would be the easiest way to make the codes available to others).
Thank you so so so much! It was, indeed, because there were too many actors in my world. Btw, I‘ve been working on a schoolproject with Greenfoot and your tips and codes really helped me with that. I saw that you‘ve been very active on here for years now. I just wanted to take this opportunity to say thanks. I never really liked programming etc but with your help it’s quite fun. Thank you for helping me and many others. I hope you have a nice day!
You need to login to post a reply.