Jump to content

Dynamic image loading for 1 view


Lukeout
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...