Group, sprite, camera problems - Any genius around here?

Ok, down to the facts:

I am having a camera that follows my player around the game world.

In that game world he picks up gems and I am trying to position a particle effect around every gem he collects. But I can’t get the position…I have tried all I can think of, contentToLocal, LocalToContent, etc.

First is the camera :

 gameGroup.x = (ball.x \* -1)+240  
  
 if(ball.y\<220) then  
 if(ball.y\>-100) then  
 gameGroup.y = ((ball.y \* -1) +220)-5  
 ball.jumping = true  
 end  
 end  

As you see, i center my camera around the player straight in the middle of the screen. If he climbs upward I start to follow him in that direction.

Next code is where I am trying to place my particle effect…

 local x\_local, y\_local = gameGroup:contentToLocal(mySprite.x, mySprite.y)  
  
  
 Particles.CreateEmitter("E" .. particleCount, x\_local, y\_local, 0, false, false)  

Help! Any suggestion?

Best regards, Joakim [import]uid: 81188 topic_id: 20926 reply_id: 320926[/import]

are you using physics? [import]uid: 84637 topic_id: 20926 reply_id: 82593[/import]

Meh, I wouldn’t to that try this:
[lua]Particles.CreateEmitter(“E”…particleCount, 0, 0, 0, false, false)
Particles.AttachParticleType(blah, blah, blah)
Ex.Particles.SetEmitterTarget(emitter, mySprite, false)
yourDisplayGroup:insert(Particles.GetEmitter(emitter))
Ex.Particles.StartEmitter(emitter)[/lua]
That should work. Or you could try not using contentToLocal and be sure to insert the emitter into the display group you are using. [import]uid: 54716 topic_id: 20926 reply_id: 82631[/import]

Yes, that did work - I have forgotten to add it to the group!

Thanks, Joakim [import]uid: 81188 topic_id: 20926 reply_id: 82638[/import]

Genius :slight_smile: [import]uid: 54716 topic_id: 20926 reply_id: 82760[/import]