Smoothly moving objects with a grid-coordinate layout

Hi,

I was interested in making a game similar to Bejewled, with the exception of allowing the user to move the actual jewel more than one position over. I was wondering how I could accomplish moving the gem smoothly, while still having a fixed position.

This is my current code to make the objects have a fixed position, but anytime I put the object within the boundries of any of the coordinates, it instantly locks to that location instead of smoothly moving to it. Would a physics engine of some sort be required?

[lua]           
            – This is the current code to force the fixed positions.
            if(x <= 160 and y <= 240) then
                x = 80
                y = 120
            elseif(x >= 160 and y <= 240) then
                x = 240
                y = 120
            elseif(x<= 160 and y >= 240) then
                x = 80
                y = 360
            elseif(x>= 160 and y >= 240) then
                x = 240
                y = 360
            end

[/lua]

Thanks,

Matt

Hi Matt,

The transition library should help you accomplish this easily. Here’s a guide on it:

http://docs.coronalabs.com/guide/media/transitionLib/index.html

Take care,

Brent Sorrentino

Hi Brent,

Thanks for the quick response. I’ll look into that once i get a chance. I appreciate the quick response!

Thanks,

Matt

This may help
http://forums.coronalabs.com/topic/37232-need-help/

Thank you, jstrahan. That post helps guide me along the right path.

Hi Matt,

The transition library should help you accomplish this easily. Here’s a guide on it:

http://docs.coronalabs.com/guide/media/transitionLib/index.html

Take care,

Brent Sorrentino

Hi Brent,

Thanks for the quick response. I’ll look into that once i get a chance. I appreciate the quick response!

Thanks,

Matt

This may help
http://forums.coronalabs.com/topic/37232-need-help/

Thank you, jstrahan. That post helps guide me along the right path.