Planeshooter problem

trying to test few things before starting to make a game: (disable cookies)

Left/Right/Up/Down - movement
SHIFT - switch weapons
CTRL - fire

i have some problems getting some things 2 work properly…

quick overview:

  1. all hostile objects are generated using setInterval (comets every second, those small dots every half a second)
  2. all movement of hostile objects & firing objects is done via setInterval e.g.:

nInt = setInterval(moveObject, 30, this);
function moveObject(mc):Void{
 mc._y += 10;

which moves object +10 pixels every 30ms.

  1. speed of hostile Objs is generated/varies.
  2. firing speed can be increased/decreased (again done using setInterval)


  1. CPU exhaustive
    What can i do?
  • should i use some onEnterFrame function and remove all those setIntervals, which means as well: not use generated object speeds until i decide to skip some frames (on purpose…) to make it look like that Objects are actually slowing down… .
  • can i save some CPU removing movieTweens, making the movement choppy though?
  1. although framerate slows down a bit, this doesn’t affect setInterval, which causes screen to be filled with many more object slowing it down even more. For ex. firing speed is kept via setInterval.

Maybe this doesn’t have to concern me at all, and i should use onEnterFrame on firing, manually draw flight trails of hostile ships/objects without any AI in movement and make only their fire hav AI when hunting me to hit me :slight_smile:

Although before starting to “make the game” I would apprecciate ANY suggestions from your side on this topic.