Quote:
Originally Posted by jediaction
Does anyone know how to increase frame rates in large code games?
|
Yes, use less infinite loops that have durations of 0 seconds. How about instead of looking to see if a bullet it within a range of a person, don't have it run all the time, have it run only for the first second that the bullet leaves the gun (loop it in the shoot method maybe 50-100 times). So then it will only lag the second you shoot, but the rest of the time it will be lag-free.
Also if there are tons of items, make the items isShowing = false when you are not looking at them. This is easy by making every item in your world into a list, and then make a method that is looping infinitely every 1 second or so saying (if items-from-allObjects is behind camera, show item-from-allObjects isShowing = false). You also have to have another if saying the opposite, so that if they are in front of camera they turn to true. Also if you have really faster turning in the game, make it loop like every 0.25 seconds.
Check out my best projects so far and please comment:
Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301