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

2020/12/18

Problem with visualising multiple times during one act()

00swinter 00swinter

2020/12/18

#
I programed a visualiser for sorting algorithms and everything worked just fine in blueJ where i used text to display it but when i implemented it in greenfoot to use fillRect to display, it i got some problems: - In the act method i ckeck is a objekt is clicked and that objekt then calls a sort method which sorts a mixed array of int. Every single time the algorithm does a comparison of two int it calls my "render" method (my "render" method works just fine becaus it can display the sortedn and then the mixed array but without steps) to display the changed array on screen. BUT i only see the mixed array and then 10 seconds later the endresult. So no step visualisation. and i cant find the error. - every time i start the algorithm a terminal wondor pops up displaying the int of the array but i dont even have a single System.out.print in my code. thx in advance. if u have an idea here is a drive link to my project: https://drive.google.com/drive/folders/1UF2Ro9fVCyaJWduiHFuqsHz0oVa5f0wA?usp=sharing
nccb nccb

2020/12/18

#
You may want to try calling repaint() on the world after each step. By default Greenfoot only repaints after each act() round.
You need to login to post a reply.