Can I access the Level width and height properties (eg. the map dimension)?

Hi Alan,

Is there a way for me to access the Width and Height of my Level map within code?   

Also, is there a way to create User Properties for each Level?  

For example:  I want specific game behaviors and ‘rules’ on every level, depending on some values I set in the Level User Properties (if that is even possible).

Cheers,

Santi

Please ignore the second question re: Level User Properties… i figured it out  ;) 

Hi Santi Yes, it is possible to access the level dimensions, although I do not have the source to hand, but from memory it is something like myLevel.level.width, I’ll check this tomorrow. Thanks Alan

Thanks Alan.

Yes I did try to reference  myLevel.level.width but it returns nil.

In the meantime, I just created a User Property named Width and Height with the same values as the Level width/height and it works.  

It would be much more convenient if I can access these value directly from somewhere .

Cheers

Santi

Try .canvasWidth & .canvasHeight

Alan,

.canvasWidth and .canvasHeight works perfectly!! 

Thanks!!

Please ignore the second question re: Level User Properties… i figured it out  ;) 

Hi Santi Yes, it is possible to access the level dimensions, although I do not have the source to hand, but from memory it is something like myLevel.level.width, I’ll check this tomorrow. Thanks Alan

Thanks Alan.

Yes I did try to reference  myLevel.level.width but it returns nil.

In the meantime, I just created a User Property named Width and Height with the same values as the Level width/height and it works.  

It would be much more convenient if I can access these value directly from somewhere .

Cheers

Santi

Try .canvasWidth & .canvasHeight

Alan,

.canvasWidth and .canvasHeight works perfectly!! 

Thanks!!