That screenshot was from my system to show where the console is
:o
How are you running the project? Are you using the green triangle at the top in zerobrane?
This is the console output from your project:
Copyright © 2009-2019 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2019.3476
Loading project from: ~/Downloads/App
Project sandbox folder: ~/Library/Application Support/Corona Simulator/App-BC9C92993AB3FAB1782919163EC19C01
Platform: GenericAndroidDevice / x86_64 / 10.14.5 / Intel Iris OpenGL Engine / 2.1 INTEL-12.9.22 / 2019.3476 / en-GB | GB | en_GB | en
ERROR: /Users/nick/Downloads/App/menu2.lua:23: display.newImageRect() bad argument #2: width expected, but got no value
Hello
I downloaded it here, tested it on Zerobrane and it’s normal.
Yes does the background appear on your console?
It won’t, because the syntax is wrong, and even if you corrected that, “Sfondi/menu2.png” does not exist in the project.
local sfondo = display.newImageRect( “sfondonero.png”, device_width, device_height) is correct!
Can you try and put my code in between the switch scene templaye to se if it works?
device_width = display.contentWidth --larghezza in pixel dello schermo del tel
device_height = display.contentHeight --altezza in pixel dello schermo del tel
local coomposer = require (“composer”)
–impostazione sfondo
local sfondo = display.newImageRect( “sfondonero.png”,device_width,device_height)
sfondo.x= device_width/2
sfondo.y= device_height/2
–richiamo libreria per i widgets
local widget = require(“widget”)
–funzione che viene richiamata quando il bottone viene premuto quindi quando è nello stato “ended”
local function handleButtonEvent ( event )
local phase = event.phase
if “ended” == event.phase then
print (“Hello World”)
end
end
–creazione bottone numero 1
local button1 = widget.newButton
{
left = 35 ,
top = 400 ,
width = 22 ,
height = 54,
defaultFile = (“Sfondi/icons/1.png”),
overFile = (“Sfondi/icons/1.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 2
local button2 = widget.newButton
{
left = 120 ,
top = 400 ,
width = 22 ,
height = 54,
defaultFile = (“Sfondi/icons/2.png”),
overFile = (“Sfondi/icons/2.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 3
local button3 = widget.newButton
{
left = 205 ,
top = 400 ,
width = 22 ,
height = 54,
defaultFile = (“Sfondi/icons/3.png”),
overFile = (“Sfondi/icons/3.png”),
onEvent = handleButtonEvent
}
–creazione bottone addizione
local button_addizione = widget.newButton
{
left = 279,
top = 417 ,
width = 22 ,
height = 20,
defaultFile = (“Sfondi/icons/Group 57.png”),
overFile = (“Sfondi/icons/Group 57.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 0
local button0 = widget.newButton
{ left = 120,
top = 490 ,
width = 22,
height = 54,
defaultFile = (“Sfondi/icons/0.png”),
overFile = (“Sfondi/icons/0.png”),
onEvent = handleButtonEvent
}
–creazione bottone punto decimale
local button_decimale = widget.newButton
{ left = 210,
top = 523 ,
width = 11,
height = 11,
defaultFile = (“Sfondi/icons/Ellipse 14.png”),
overFile = (“Sfondi/icons/Ellipse 14.png”),
onEvent = handleButtonEvent
}
–creazione bottone uguale
local button_uguale = widget.newButton
{
left = 265,
top = 494,
width = 50,
height = 50 ,
defaultFile = (“Sfondi/icons/Group 55.png”),
overFile = (“Sfondi/icons/Group 55.png”),
onEvent = handleButtonEvent
}
– creazione bottone numero 4
local button4 = widget.newButton
{ left = 35 ,
top = 330 ,
width = 22,
height = 54 ,
defaultFile = (“Sfondi/icons/4.png”),
overFile = (“Sfondi/icons/4.png”),
onEvent = handleButtonEvent
}
– creazione bottone numero 5
local button5 = widget.newButton
{ left = 120,
top = 330 ,
width = 22 ,
height = 54 ,
defaultFile = (“Sfondi/icons/5.png”),
overFile = (“Sfondi/icons/4.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 6
local button6 = widget.newButton
{left = 205,
top = 330,
width = 22,
height = 54,
defaultFile = (“Sfondi/icons/6.png”),
overFile = (“Sfondi/icons/6.png”),
onEvent = handleButtonEvent
}
–creazione bottone sottrazzione
local button_sottrazione = widget.newButton
{
left = 277,
top = 348 ,
width = 27 ,
height = 4,
defaultFile = (“Sfondi/icons/Rectangle -2.png”),
overFile = (“Sfondi/icons/Rectangle -2.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 7
local button7 = widget.newButton
{ left = 35,
top = 260,
width = 22,
height = 54,
defaultFile = (“Sfondi/icons/7.png”),
overFile = (“Sfondi/icons/7.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 8
local button8= widget.newButton
{ left = 120,
top = 260,
width = 22 ,
height = 54,
defaultFile = (“Sfondi/icons/8.png”),
overFile = (“Sfondi/icons/8.png”),
onEvent = handleButtonEvent
}
–creazione bottone numero 9
local button9= widget.newButton
{
left = 205 ,
top = 260 ,
width = 22 ,
height = 54,
defaultFile = (“Sfondi/icons/9.png”),
overFile = (“Sfondi/icons/9.png”),
onEvent = handleButtonEvent
}
– creazione bottone moltiplicazione
local button_moltiplicazione = widget.newButton
{ left = 278,
top = 277 ,
width = 23.38 ,
height = 23.23,
defaultFile = (“Sfondi/icons/Group 51.png”),
overFile = (“Sfondi/icons/Group 51.png”),
onEvent = handleButtonEvent
}
–creazione bottone cancella
button_canc = widget.newButton
{ left = 265,
top = 207,
width = 39.51,
height = 26,
defaultFile = (“Sfondi/icons/Group 41.png”),
overFile = (“Sfondi/icons/Group 41.png”),
onEvent = handleButtonEvent
}
–creazione bottone percentuale
local button_percentuale = widget.newButton
{ left = 207 ,
top = 207 ,
width = 21.96 ,
height = 24.73 ,
defaultFile = (“Sfondi/icons/Group 49.png”),
overFile = (“Sfondi/icons/Group 49.png”),
onEvent = handleButtonEvent
}
–creazione bottone divisione
local button_divisione = widget.newButton
{ left = 119 ,
top = 208 ,
width = 25 ,
height = 20 ,
defaultFile = (“Sfondi/icons/Group 56.png”),
overFile = (“Sfondi/icons/Group 56.png”),
onEvent = handleButtonEvent
}
–creazione bottone AC
local button_ac = widget.newButton
{ left = 35 ,
top = 206 ,
width = 26 ,
height = 28 ,
defaultFile = (“Sfondi/icons/AC.png”),
overFile = (“Sfondi/icons/AC.png”),
onEvent = handleButtonEvent
}
–creazione linea di separazione
local button_linea = widget.newButton
{ left = -38,
top = 150 ,
width = 360 ,
height = 1 ,
defaultFile = (“Sfondi/icons/Line 33.png”),
overFile = (“Sfondi/icons/Line 33.png”),
}
–creazione bottone menu home (menu 1 )
local button_menuhome = widget.newButton
{ left = 105 ,
top = -55 ,
width = 27 ,
height = 22 ,
defaultFile = (“Sfondi/icons/Group 52.png”),
overFile = (“Sfondi/icons/Group 52.png”),
onEvent = handleButtonEvent
}
–creazione button menu 2
local button_menu2 = widget.newButton
{ left = 205 ,
top = -57 ,
width = 26 ,
height = 26 ,
defaultFile = (“Sfondi/icons/Group 54.png”),
overFile = (“Sfondi/icons/Group 54.png”),
onEvent = handleButtonEvent
}
sorry its not Sfondi/menu2.png but just menu2.png
The first issue is to sort out why your IDE environment isn’t working. If you can’t see the console output you’ve got no chance of ever getting anything working.
Ensure View > Output/Console window is checked.
I can see my output console it just doesn’t work when i type in print(“whatever”) in the lua file
Any chance you can take a video of exactly what you’re doing to run your program?
I just click the green triangle i may be wrong but i ran it with F6 once
I don’t really know what to suggest other than to try another IDE, if your console output is blank when you run the project then debugging is impossible.
Today it worked fine cause i didn’t switched scene i just wrote my whole code onto the main.lua and it display all my buttons/backgrounds… I tried Sublime Text but everytime it gives me an error on the first line saying there a nil value. I’ll try and ask my teacher about corona tmrw if theres not anything else we can try :(
Could try and see if my code works in between the create scene function inside the template? I posted my code before…
Can anyone help?