object:play problem ?

Hi,

how does object:play work?

all parameters between the curly brackets are ignored…
also object:remove() doesn’t work or is that the wrong way to remove a sprite object?

also how

function generateStarField()  
  
 for i = 1, Stars\_total do  
 local Star = {}  
 Star = display.newImage("Star",(i\*28)+(math.random(1,5)\*10),-55\*math.random(0,110)) --\> this doesn't work  
 Star = math.random(1,10)  
 Star = 20  
 Star = sprite.newAnim{"explosion001.png","explosion002.png","explosion003.png","explosion004.png","explosion005.png","explosion006.png","explosion007.png","explosion008.png","explosion009.png","explosion010.png"}  
 Star = 30  
 Star = 30  
 Stars[i] = Star  
 end  
end  
  
function collisionDetect()  
.  
.  
.  
 if ColCheck(Stars[j].object,ship) then   
  
 Stars[j].object.explosion:play{ startFrame=1, endFrame=10, loop=1, remove=true } --\> this doesn't work  
 -- Stars[j].object.isVisible = false  
 -- Stars[j].object.explosion:remove() --\> this doesn't work  
 -- print("hit")  
 Stars[j].object.explosion.x = Stars[j].object.x  
 Stars[j].object.explosion.y = Stars[j].object.y  
 end  
 end  
.  
.  
.  
end  

THX

M [import]uid: 6553 topic_id: 1083 reply_id: 301083[/import]

:slight_smile: I can see where you got the OBJECT from. But there is no such parameter/Property in corona.

Is this Actionscript code which you thought just runs in Corona? Or is this already something from the GameEdition?

And in your code sample, you overwrite
a variable with integer values.
When you do this, you just store the integer:

[lua]Star = sprite.newAnim{“explosion001.png”,“explosion002.png”,“explosion003.png”,“explosion004.png”,“explosion005.png”,“explosion006.png”,“explosion007.png”,“explosion008.png”,“explosion009.png”,“explosion010.png”}
– The next line overwrite the value of Star and so later you store just the integer.
Star = 30
Star = 30
Stars[i] = Star[/lua] [import]uid: 5712 topic_id: 1083 reply_id: 2722[/import]

copy past problem, should be

[code]
function generateStarField()

for i = 1, Stars_total do
local Star = {}
Star.object = display.newImage(“Star.png”,(i*28)+(math.random(1,5)*10),-55*math.random(0,110))
Star.object.speed = math.random(1,10)
Star.object.radius = 20
Star.object.explosion = sprite.newAnim{“explosion001.png”,“explosion002.png”,“explosion003.png”,“explosion004.png”,“explosion005.png”,“explosion006.png”,“explosion007.png”,“explosion008.png”,“explosion009.png”,“explosion010.png”}
Star.object.explosion.x = 40
Star.object.explosion.y = 40
Stars[i] = Star
end
end
[/code] [import]uid: 6553 topic_id: 1083 reply_id: 2727[/import]

Like I said, there is no OBJECT in Corona.

And if you are refering to the movieclip lib, the PLAY method has no parameters!

[import]uid: 5712 topic_id: 1083 reply_id: 2728[/import]

object:play{ startFrame=a, endFrame=b, loop=c, remove=shouldRemove }

page 13 of the 2.0 beta guide [import]uid: 6553 topic_id: 1083 reply_id: 2729[/import]

Hi M,

that document also said that the new movieclip library will be released after beta 4 was released. The parameters of PLAY are not in the old version.

So you have to wait till they releae this version or modify the old one for your needs.

Cheers
Michael

[import]uid: 5712 topic_id: 1083 reply_id: 2730[/import]

will be released after beta 4 was released

I missed that one :frowning:

THX

[import]uid: 6553 topic_id: 1083 reply_id: 2735[/import]