Level Tile creation based on scroll

0 favourites
  • 2 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I have a tile based game, and to save memory, I want to only render within a set area.

    For example, I have an array the level spawns tile locations from, and I only want to show the tiles between scrollx-12 and scrollx+12. I only want to spawn them when they are within the boundry and I want to have all other tiles destroyed outside of the boundry

    Currently I'm generating the entire level at layout start

    SYS>Start of layout

    foreground_array>for each XY element

    Sys:Creat object TILE at (background_array.CurY, background_array.CurX)

    While the size of tiles, each one is a sprite. The game should be lightweight even with the entire level generated at start, but I would like to do anything I can to make it optimized.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I tried to put what I learned since this post to create this, but I could not.

    What' I'm trying to do is whenever the player moves over 8 pixels floor(scrollx/8) that it destroys the tileset objects outside of a preset range. The tiles are 8x8 large



    and I've made some events that may reflect that.

    <img src="http://i.imgur.com/1GzFGrD.png" border="0" />

    Only problem is that it seems to generate duplicate tiles, and not properly delete them, along with taking too long to calculate everything.

    At the moment I have 683 objects total spawned on my layout, and it's a medium sized layout. I expect to reach 1000+ on a real level and I am worried if that might affect gameplay. In the spirit of optimizing what the game does, I want to see if there is a way to only create/use the tiles within a boundry (+/- 12) on the tilemap array efficiently. There has to be a way

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)