Sorry if this is basic, but I spent a couple of hours looking and still couldn't find the answer.
I want to have a car moving along and going off the screen, and of course it came from off screen into play. Just like traffic passing by. I used MovieClip to get the tweening but that's for animation within the frame, how to get the continuous traffic coming into the screen and going off the screen?
I don't want to use some kind of endless moving background, as my other characters are static within my frame.
Thanks
Comments
http://appcodingeasy.com/Gideros-Mobile/Gideros-GTween-with-easing
In short if you set your objects position off screen first and then set up a tween to a position on the other side of the screen this should work fine.
Ultimate Games on Appstore
Ultimate Games on Google Play
My current problem is I want to loop thru and randomly generate a new car, trying to detect when a car has gone off the frame before spawning a new car. I either only spawn 1 car or too many cars at the same time.
It's a simple game with random car traffic running pass and the hero has to avoid collision, but I want no more than 2 cars (or max # of cars) in the frame.
@kredor7: Thanks, I'll take a look at Gtween, may use it for something else.
@thanhquan1512: I like your simple logic, will try it, detecting car going off frame when X coord is beyond the display frame. Then randomly spawn another car.
Thanks
Phi
Here are some articles I had written long long ago on starting out with game development
http://howto.oz-apps.com/2011/08/designing-game-movement.html
http://howto.oz-apps.com/2011/09/referencing-multiple-objects-of-same.html
http://howto.oz-apps.com/2011/09/creating-dynamic-variables.html
Some more that could help (written for another Lua Framework, but principles are the same)
http://howto.oz-apps.com/2011/09/scopes-for-functions.html
http://howto.oz-apps.com/2011/09/function-scope-answers.html
http://howto.oz-apps.com/2011/09/how-to-change-event-handlers-without.html
Plus there are many more articles if you scroll down on the page.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Ultimate Games on Appstore
Ultimate Games on Google Play
Many thanks for your help.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps