Hello, i have been playing around with object groups lately. Mainly to test character attachment points like a character with equipments/shirts/hair, etc.
Currently this is a sample of what i am doing:
local head = display.newImage( "head.png" )
local body = display.newImage( "body.png" )
local shirt = display.newImage( "shirt.png" )
local character = display.newGroup()
-- set head, body, shirt positions
character:insert( head )
character:insert( body )
character:insert( shirt )
-- Some codes
-- character movement example
local function charMove()
character.x = character.x + 1
end
-- a function is called when character is dead
local function removeCharacter()
character:removeSelf()
end
-
I was wondering if this is the correct way to do it. Is there a better way to handle a character (or objectS within object)?
-
does removeSelf actually remove all images i inserted into character?
-
If i implement this with storyboard, do i need insert all images (head,shirt, hair) separately into the scene’s group or just the character itself?
-
Do i have to manually remove this object like widgets when working with storyboard?
Thanks for your time!
- Jeff [import]uid: 74723 topic_id: 26045 reply_id: 326045[/import]
