Located a problem causing lag, but how to fix it.?
![app-etite](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hi guys.
In my game my character picks up objects off the ground. When I preview this on my device it hits a slight pause when the objects are picked up. In the objects actor I have behaviours....
when this and this is true... then...
destroy
Play sound
change attribute score
save attribute score
that must be to many things to do at once because if I turn off change attribute and save attribute off then there is no pause or lag when picking up the objects.
Ive tried a timer.. so for example after 0.5 seconds change attributes. But the timer doesn't work in this case.
I need the score to change, so how can I have all four behaviours executed without it lagging??
Thanks
www.twitter.com/appetitegames
https://www.facebook.com/pages/Appetite-Games/203583699676600
In my game my character picks up objects off the ground. When I preview this on my device it hits a slight pause when the objects are picked up. In the objects actor I have behaviours....
when this and this is true... then...
destroy
Play sound
change attribute score
save attribute score
that must be to many things to do at once because if I turn off change attribute and save attribute off then there is no pause or lag when picking up the objects.
Ive tried a timer.. so for example after 0.5 seconds change attributes. But the timer doesn't work in this case.
I need the score to change, so how can I have all four behaviours executed without it lagging??
Thanks
www.twitter.com/appetitegames
https://www.facebook.com/pages/Appetite-Games/203583699676600
Comments
Maybe try changing the order in which it executes. Change the score first, then play sound, then interpolate actor off the screen, then save attribute.
Ive tried loads of different variations now.. and the only thing that works is if I turn off the score.. with that off its smoother than ice cream. destroy doesn't seem to be causing the problem.
I do have custom fonts on my score.. but I followed tshirtbooths tutorials exactly so it should be ok.
ggggrrrrr.. what now?
Check the forum for tips on how you can make stuff more effective.
The UFO in Air Supply did the same thing till I tried this!
Hope that helps!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Quantumsheep, not sure I completely understand your method. so in this new actor, every sound in my game plays at the start of my level but with no volume, but can you explain why that would help with my lag issue?
Thanks
if this conflicts with how the game should look (the item disappearing), you can add another change color (alpha) behavior and set the alpha to 0 while it completes the other actions/behaviors.
like john suggested I have the sounds loaded in at 0 volume when the scene begins.
When I collect the items on the floor I use alpha 0 not destroy.
I have my scrolling actors laid out on a 2000 wide screen, is there a better way to do this or???
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/tClVNlTeQ3g?hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/tClVNlTeQ3g?hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>