Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[Resoved] Problem about sprite groups on map
Started by jospic May 01 2015 01:39 AM

1 reply to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jospic

[GLOBAL: userInfoPane.html]
jospic
  • Enthusiast

  • 44 posts
  • Corona SDK

Hi,

I have an issue with displaying a group of sprites. I need to put a group of objects on the map and, after create them, I need move each one independently from others.

It seems that the setting kind = "group" considers the group as a single sprite then the command "moveSpriteTo" works on the entire group, so for my needs I can not use it.

The following code has some problems: correctly adds the sprites on the map but does not inserts the elements in the table "parts".

local locX=44
local locY=29
local pieces = 5

for i = 1, npieces do

local setup = {layer = 3, kind = "sprite", locX = locX - i * 0.5, locY = locY, levelWidth = 16, levelHeight = 16} 
local parte = display.newImage("ball.png", 16, 16)
        
parts.insert(parts, parte)  -- statement 1
mte.addSprite(parte, setup) -- statement 2

end

If I swap the two statements (1 and 2), however , the table is ok but inserts a single sprite instance on the map .

Any suggestions?

Thanks in advance.

-jospic

 



[TOPIC: post.html]
#2

jospic

[GLOBAL: userInfoPane.html]
jospic
  • Enthusiast

  • 44 posts
  • Corona SDK

I used a table instead of a display group...




[topic_controls]
[/topic_controls]