Discord
Login
Community
DARK THEME

reset map changes?

I have a script with a var defined like this: this.map=global.maps.levelone and later I change it with this.map.set(1,1,"tileset:3,1")

and now I want that when I reassign it with this.map=global.maps.levelone, it's the map but without the change in code?

myMap = maps["level_1"]
mapClone = myMap.clone()

You can to create Map obect in code - e.g. when program is running to generate terrain .

 dynamicMap = new Map( number of tiles in a row , number of tiles in a column, block width, block height )
 dynamicMap.set( x, y, "rock" )

and how do I draw the clone map?

screen.drawMap function - accepts a first parameter type of string and an object created from the Map() class.

   screen.drawMap( mapClone, ....... )

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community