How do I make magnets?

Hi, I’m brand new to Corona, LUA, and had very limited programming experience prior. And in the game I’m trying to make I want to make magnets that have individual pull, so far no tutorial has worked out. How would I do this?

You may want to look into Particle Candy and its “FX Fields”. You can create magnetic attraction in certain “zones” (around your magnets).

I’ve got some samples, libraries and tutorials you might find useful:

http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html

In Corona the method would be creating a physics sensor object around the magnet. When something magnetic enters the sensor you would either create a touch joint on it and pull it towards the magnet or use applyForce to push it towards the magnet.

You might find the “elastic physics joint” sample to be what you want, but test it out first properly.

@naveen, thanks, I’ll look into it.

@horacebury, the “elastic physics joint” didn’t end up being what I want. I already used the radial gravity tutorial, but for some reason it just hasn’t worked for me. It doesn’t pull the object in.

You may want to look into Particle Candy and its “FX Fields”. You can create magnetic attraction in certain “zones” (around your magnets).

I’ve got some samples, libraries and tutorials you might find useful:

http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html

In Corona the method would be creating a physics sensor object around the magnet. When something magnetic enters the sensor you would either create a touch joint on it and pull it towards the magnet or use applyForce to push it towards the magnet.

You might find the “elastic physics joint” sample to be what you want, but test it out first properly.

@naveen, thanks, I’ll look into it.

@horacebury, the “elastic physics joint” didn’t end up being what I want. I already used the radial gravity tutorial, but for some reason it just hasn’t worked for me. It doesn’t pull the object in.