Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Can I access the Level width and height properties (eg. the map dimension)?
Started by santiagoluib3 Jun 03 2017 03:35 AM

5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

santiagoluib3

[GLOBAL: userInfoPane.html]
santiagoluib3
  • Contributor

  • 181 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

santiagoluib3

[GLOBAL: userInfoPane.html]
santiagoluib3
  • Contributor

  • 181 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

retrofitProductions

[GLOBAL: userInfoPane.html]
retrofitProductions
  • Contributor

  • 321 posts
  • Corona SDK

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

[TOPIC: post.html]
#4

santiagoluib3

[GLOBAL: userInfoPane.html]
santiagoluib3
  • Contributor

  • 181 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

retrofitProductions

[GLOBAL: userInfoPane.html]
retrofitProductions
  • Contributor

  • 321 posts
  • Corona SDK

Try .canvasWidth & .canvasHeight



[TOPIC: post.html]
#6

santiagoluib3

[GLOBAL: userInfoPane.html]
santiagoluib3
  • Contributor

  • 181 posts
  • Corona SDK

Alan,

 

.canvasWidth and .canvasHeight works perfectly!! 

 

Thanks!!




[topic_controls]
[/topic_controls]