Lukeout Posted August 15, 2016 Share Posted August 15, 2016 I am trying to create a game where random objects fall out of the sky in intervals, I have 400 objects to choose from. It's just random which one falls. But I dont' want to pre-load all of those images and don't want to create 400 variables at the top of my javascript file.... I would rather load them as they are generated in the sky - how can I do this. I have a function called loadObject() in here it loads an object. But when I try to use that function in a loop or in setInterval I get an error saying that the variable for the item already exists, so it will only load 1 object on my stage. Is there a way to do this so I do not have to declare 400 variables? ... Please let me know I am just a beginner with Pixi. I guess basically I am trying to dynamically load things and dynamically add them to the stage. They will fall down to the bottom of the page and then disappear. Quote Link to comment Share on other sites More sharing options...
carlosnufe Posted August 15, 2016 Share Posted August 15, 2016 There are specific software which allows you to join your images in one. Then, you could load only in one object and change the frames dynamically. It is an easy option. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 15, 2016 Share Posted August 15, 2016 https://github.com/kittykatattack/learningPixi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.