Optimisation/Performance/Code efficiency question!

Hi there,

Does anyone know which is the better approach in terms of device performance if i want to make the full screen as a button for my shmup game? Note, by shmup, i have a lot of objects and stuff happening on the screen, such as transitions and my enterframe gameloop!..

Option 1 - draw a rectangle object and make it alpha=0.01, so it is effectively invisible but active on screen.

OR

Option 2 - display an image asset, whereby the image itself is simply transparent

I tend to use option 1 (haven’t tried option 2 before), but just wondering if the alpha=0.01 setting has an effect on performance when i have a load of other stuff happening on screen?

Also for scrolling parallax backgrounds, would it be better to use a function with transitions rather than in the gameloop (onenterframe)?

On iPhone4, sometimes the frame rate feels a little sluggish - as well as draining the battery! - so i’m looking for little things to try and improve performance. For eg, i also now using alpha=0 whenever i set an object to isVisible=false.

Cheers,

First of all, there is an attribute on display objects called .isHitTestable.  If that is true, an object can be invisible (alpha = 0, or isVisible = false) and still register touch events.

You can also add the touch handler to the stage which would cover the whole screen.

Rob

First of all, there is an attribute on display objects called .isHitTestable.  If that is true, an object can be invisible (alpha = 0, or isVisible = false) and still register touch events.

You can also add the touch handler to the stage which would cover the whole screen.

Rob