Original Post
Hello, I wanted to post this in a existing thread.. however, figured that it was a different enough request that it might hijack the thread. I have been developing a PHP/dynamic table tile map display for a game, and would like to control the character with javascript: The map is based off a map array placed in a dynamically generated HTML table that loads a div in the cells. The background of the div is used for the map images while the foreground holds the character - if one exists in a particular cell at the time. It is array based, and each cell has two properties - Tile Position and Type. My issue is character movement. It is controlled with a PHP variable which places the character sprite and direction. I want to use javascript keyboard controls so that when someone hits the arrow keys, the character moves one tile in the related direction. Because the character is rendered in the same div as the tiles, but in the foreground, the character can't be moved by itself (The math related to movement is already worked out). For this to be effective in javascript, I need to grab two things - tile position, and tile type, both of which are stored in forms in the divs (or maybe variables, this isn't finalized yet). What should happen is this: Player hits arrow key. javascript code is triggered that changes the PHP movement variable. The tile type is read to determine what should happen, if anything. The player character sprite is moved, hopefully without a page reload.