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

Super_Hippo's Comments

Back to Super_Hippo's profile

You mean a link to the original Pac-Man game in the gamasutra article I put into the description? Well, the original Pac-Man game was played into one of those "cabinet's" (there are also pictures of them in this article). There are a lot of emulators and copies of the game you can find, but I don't think that Namco published the original one in the internet.
I guess you changed the code of the class. You added at least four lines of code. The original one works without errors. What did you change (for example in the act method)? It would probably be the best to open a new discussion with a link to this scenario instead.
I only updated a typo in the description, there wasn't a real update here...
I noticed that it is like that in the original pac-man. However, it's much easier to control if you can stop when not pressing any key. At least that's my feeling. The only disadvantage is that if pac-man stops moving at a junction and you think that you can move in the next direction, but you can't because he is standing a few pixels next to it. That's why it is much easier to cut corners when pressing both arrow keys together, the direction you are moving right now and the next direction you want to move. If it somehow doesn't feel like pac-man with the movement code as it is right now, I could change it / have it as an alternative. I have never played the original version though so I am not 100 % sure how it works... If you are moving right and press the left key, are you changing the direction immediately or at the middle of the next tile? If you are moving right and press the up key and you can't go up, will you keep moving right or stop? And if you keep moving, will you go up when you reach the next junction (even if it is some tiles away) or do you have to press both keys together like it is here right now to make this happen?
It gives me a NullPointer Exception when trying to open it here on the site. (Because of the new API, the downloaded version is not working without changing a lot of things which I didn't try right now.) ---- java.lang.NullPointerException at TextImage.<init>(TextImage.java:153) at Level.drawCircText(Level.java:127) at Level.<init>(Level.java:49) ----
When do you get the exception?
I think the problem is that the calculated route is not something which can be pre-calculated because the target is unknown before it was chosen and the unit should instantly move after the target was chosen. And since this doesn't even work with one unit, what would happen if there are a lot more trying to move around? I guess either Java is not efficient, my code is not optimal or my computer is too slow.
Increasing the simulation speed won't change anything about the lag. The calculation of one act cycle is always at maximal speed. When it is not at speed = 100, it has a defined delay between the beginnings of the act cycles though. So if I increase the speed, the operations can't be executed faster. I am in fact not understanding what this code is doing. What I am doing is that whenever a new target for a unit is chosen (like moving a unit or unit automatically walks back to nearest town center / storage pit after collecting 10 wood from a tree), it calculates the route once. Then it will walk this route without calculating (unless the route gets blocked by a new building). If it would help, I could post the code used for the route calculation in a new discussion. If I get this right, I can't use this Timer class because the code is not executed once in a while but always when a unit gets a new target.
Added two points to the "Things which work" section. Hope this helps!