–globals.lua
CARD\_1 = "card\_1" --imageSheet graphic reference CARD\_2 = "card\_2" --imageSheet graphic reference
–playGUI.lua
–THESE DISPLAY GROUPS ARE THE HEART OF MY QUESTIONABLE “LOGIC” or POSSIBLE DILEMA!
–ADDED TO THE sceneGroup in function scene:create() BEFORE CONTENT IS ADDED TO THEM
local deck = display.newGroup() local hand = display.newGroup() local played = display.newGroup() local discard = display.newGroup()
–KNOWING OBJECTS ARE STACKED ONE ON TOP OF THE OTHER WHEN ADDED TO DISPLAY GROUPS,
–MY LOGIC IS:
–JUGGLE CARDS BETWEEN DISPLAY GROUPS DURING GAME PLAY, SINCE,
–AS CARDS ARE ADDED TO THE “played” DISPLAY-GROUP, ONE BY ONE, THROUGHOUT THE GAME,
–THE STACKING APPEARANCE WILL BE MANAGED
–NOTE:
–EACH CARD IS A DISPLAY GROUP TOO,
–JUGGLED BETWEEN ABOVE DISPLAY GROUPS
local card\_1 = display.newGroup() local card\_2 = display.newGroup()
–REDUNDANT?
–See “makeCards()” below for possible redundancy
–Variable holds a single card displayGroup created above
local card1 local card2
function makeCards()
--Card1 and Card2 are constructor functions in “aCard.lua”
--3 ARGUMENTS: imagesheet, graphicREF, and cardGROUP (not DECK or PLAYED groups)
card1 = Card1( cardImageSheet, CARD\_1, card\_1 ) card2 = Card2( cardImageSheet, CARD\_2, card\_2 )
--INSERT CARDS INTO THE “STARTING” DISPLAY GROUP “deck”
deck:insert(card1) deck:insert(card2) end function scene:create( event ) --cardImageSheet CREATED HERE --ADD DISPLAY GROUPS TO "sceneGroup" BEFORE ANY CONTENT IS ADDED TO THEM, --SEE makeCards() ABOVE sceneGroup:insert(deck) sceneGroup:insert(hand) end
–aCard.lua (child of class.lua)
aCard = Class() function aCard:new( imagesheet, thisgraphic, cardgroup ) end Card1 = Class( aCard ) --Card1 constructor function Card1:new( imagesheet, thisgraphic, cardgroup ) end Card2 = Class( aCard ) --Card2 constructor function Card2:new( imagesheet, thisgraphic, cardgroup ) end
Technically, the way I have the cards displayed on the screen,
the only display group where cards are ON TOP OF EACH OTHER,
and thus, must be managed either by toFront which “ACCESS” seems limited,
or by the cumbersome JUGGLING act I have induced.
Is my LOGIC completely in the dark?
If not, and if it is a bit cumbersome, can some one let me know if there is
light at the end of my logic tunnel?
The only soliution still unclear to me is,
“Listeners can be either functions or table/display objects.”
So, if I add the card display groups to LUA tables instead of DISPLAY GROUPS,
say, in the “tablePlayed{}” then, can a card, when being added to that table be told to “toFront(card1)”"
I am not trying to do things the hard way,I am just trying to do what programming languages allow,
A BILLION APPROACHES!
Any suggestions for either scenerio?
For those curious, I spent the first 45 minutes of my morning typing this.
This was not copied and pasted from my game.
This was designed to walk you through my logic, and I typed every letter, no copy/paste!
Ritalin does that to you!
I am commited to this Corona Buisness, and I look forward to being a CORONA FORUM CONTRIBUTER someday.
I appreciate anyone that reads my long winded mind!
I will learn to be more conscise; in the mean time, I must do my best to communicate.
I wish my language was as streamlined as LUA and CORONA.
PEACE
Chris:)