you mean adding them to group. ah. woops.
I’ve been coding for about a week - bunch of new concepts. Thanks though I intend to do just that. I find I learn better by just jumping in and doing things usually.
Well I’m not sure this is the correct way to do it but it seems to be working.
Rather than define variables as global i did this
local storyboard = require “storyboard”
storyboard.state = {}
storyboard.state.health = 100
storyboard.state.mana = 10
storyboard.state.morale = 10
storyboard.state.gold = 0
Made quite a bit of progress. I am having some trouble with making a button unclickable if a state is less than a certain value. This is what I have for the button - Not sure what I am missing here - The error I get says unexpected symbol near ‘if’
local option1 = widget.newButton
{
width = display.contentWidth,
height = 59,
label = “minus mana plus gold”,
if storyboard.state.mana < 10 then option1:setEnabled (false)
onRelease = goBack,
onPress = function()storyboard.state.mana = storyboard.state.mana - 1; storyboard.state.gold = storyboard.state.gold + 10;
storyboard.gotoScene( “scene2”,“fade”,400 );end,
}
option1.x = display.contentWidth - option1.width/2
option1.y = sceneObject.contentHeight - option1.height/2
scrollView:insert( option1 )
You have to put the if statement within the onPress function
Oh wow :facepalm: thanks Jon that fixed it.
Im currently trying to figure out how to add text to the top of the NEXT scene based on what button you push. Any ideas? I assume i’d have to make a new text object but i’m not sure where to put it
ex.
local option1 = widget.newButton
{
width = display.contentWidth,
height = 59,
label = “Continue”,
onRelease = goBack,
onPress = function()
storyboard.gotoScene( “scene2”,“fade”,400 );
local sceneObject = display.newText( thisIsNewText, 0,20, 250,700, “Times New Roman”, 20)end,
}
Nevermind, got it