Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Can't switch scenes
Started by filippo66627 Jan 16 2020 10:42 AM

8 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 42 posts
  • Corona SDK

Hi, im new to corona lua and i can't switch between two scenes pops up an error saying there a nil value at the 2 line in my main..

Main :

local composer = require ("composer")
Composer.gotoScene ("menu2")
 

 

And on the menu2.lua theres just a print hello world.. 



[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 400 posts
  • Corona SDK

Hi @filippo66627,

 

Use

composer.gotoScene ("menu2")

Have a nice day:)

ldurniat



[TOPIC: post.html]
#3

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 42 posts
  • Corona SDK

ye did that but doesnt work :(

[TOPIC: post.html]
#4

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,913 posts
  • Corona SDK

As discussed on the other thread, a couple of us were able to run your project (albeit a stripped back version). The error about the nil value is because the menu2.lua file is not properly setup for Composer. That is the only way this error can occur. You can't just have a composer file that has print ("hello world"), it needs all the composer functions too. 

 

1.png



[TOPIC: post.html]
#5

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 42 posts
  • Corona SDK

As discussed on the other thread, a couple of us were able to run your project (albeit a stripped back version). The error about the nil value is because the menu2.lua file is not properly setup for Composer. That is the only way this error can occur. You can't just have a composer file that has print ("hello world"), it needs all the composer functions too.

1.png

Yea but even if i add the composers funcyion in the new scene anda just add a background it wont show up

[TOPIC: post.html]
#6

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,913 posts
  • Corona SDK

Let's go back to the beginning. If you run a Corona sample app, do those work?



[TOPIC: post.html]
#7

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 400 posts
  • Corona SDK

Here you have scene template.



[TOPIC: post.html]
#8

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,103 posts
  • Corona SDK

You could also simply start your simulator, then select New Project and then select "Physics Based Game" or "eBook" and Corona will generate a project for you that properly utilises composer. Then you can learn or copy from there.



[TOPIC: post.html]
#9

filippo66627

[GLOBAL: userInfoPane.html]
filippo66627
  • Enthusiast

  • 42 posts
  • Corona SDK

Thank you all guys i fugered out how to switch scenes


[topic_controls]
[/topic_controls]