Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Optimisation/Performance/Code efficiency question!
Started by Appvism Dec 09 2013 09:11 AM

- - - - -
1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Appvism

[GLOBAL: userInfoPane.html]
Appvism
  • Pro
  • PipPipPipPipPipPip
  • 84 posts
  • Jedi

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,



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 7,094 posts
  • Jedi

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




[topic_controls]
[/topic_controls]