Page 1 of 1

Moving Objects on top of an image

Posted: Sat Sep 12, 2009 3:08 pm
by PoulMM
Hi there.

I have a board game I am hoping to convert to a PHP based browser game. For this purpose I need the PHP script to be able to move objects (counters) on top of an image/background. When players make a move the counters will be moved to a new position. I have a script that gives the user details of XY coordinates, but it doesn't display objects.

It can be done with Java, but is it posible with PHP? I am not looking for finished code but for ideas and hopefully links to sites where I can read how to do it. I searched this forum but couldn't find threads dealing with this.

Thanks in advance.

Poul

Re: Moving Objects on top of an image

Posted: Sat Sep 12, 2009 4:50 pm
by requinix
PHP is server-side. It is not used to move objects on a board, or tell where they've been moved to. That's what you'd use JavaScript and AJAX for.

- PHP generates the page with the board and initial piece placement
- JavaScript is used to let the user move the pieces around
- AJAX sends a message to PHP telling which piece moved where

Re: Moving Objects on top of an image

Posted: Sun Sep 13, 2009 6:06 am
by PoulMM
Okay, thanks a lot. That makes sense...