Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

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

- - - - -
1 reply to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Enthusiast

  • 84 posts
  • Corona SDK

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.


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.



[TOPIC: post.html]

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,376 posts
  • Enterprise

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.