[SOLVED] Can I split a tilemap/grid in half?


(TaylorAnderson) #1

Hey all,

I have a game that has a two sided map (just an Ogmo map with a big line of solid tiles down the middle) and I want to be able to have these two sides move towards each other to form one big map at certain points in the game. Is there a way to do this that doesn’t require me splitting the two sides into different map files and then stitching them together in code? I would also want to do the same thing for the grid.

Thanks,

Taylor Anderson

EDIT: NEVERMIND, turns out theres a .getSubmap() that basically does exactly what I want it to for tiles, still wondering how I would manage the grid though. I know I could use .createGrid() from the tilemap class but it seems to be broken? I’m using an old Flashpunk, so if thats fixed in the new one I might just switch over right now


(TaylorAnderson) #2

Okay, finally managed to split the grid as well. Turns out I’m an idiot. For future reference: I kept around the full grid (as well as one copy), assigned the leftGrid to it and then cut out the right half, and then assigned rightGrid to the copy (this is because, when you cut out the grid with leftGrid, it copies that change over to the original grid), and then cut out the left hand side. All with clearRect.