Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Recycling tiles using RenderTexture.


SlimTim
 Share

Recommended Posts

I have some trouble using the RenderTexture. I'm making a side scrolling game with procedural map generation. At this point I've got a working prototype of the map rendering, but it keeps adding new images, thus clogging the memory. Ideally I want to kill any image that reaches a negative x-value and revive new map tiles just outside the canvas (in the positive direction). At this point I'm wokring with my images via a group.

 

Why RenderTexture? Well, since the map generation is randomized, I need to change the (sheet) frame of the image upon revival in order to change the map, RenderTexture seems perfect for this using loadTexture([image], [random frame]) Is it?

 

How exactly do I initialize a RenderTexture with an arbitrary amount of frames? Do I ned to initialize an Image first (which references the tilesheet), then pass it to RenderTexture?

 

How do I identify which individual Image is placed in the negative x-values

 

Honestly, I'm not even sure if you people can decipher what I'm asking for, so to make it really short and concise:
I need to kill images in the negative x-space, revive them in the positive x-space (just outside the canvas) and then change their frame.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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