Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7089649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:56:52+00:00 2026-05-28T07:56:52+00:00

I am coding a web based game in which the player moves around on

  • 0

I am coding a web based game in which the player moves around on a 7×7 grid.
Currently, the move buttons call a ../action/move/up style PHP url that updates the database and then reloads the game page to reflect the new player position.

I want to be able to have the player click move and use JQuery tweens to move the player token without a page refresh. The part I’m unsure about is, I want this to update the server and then lock the move buttons. The JS would then call a URL or two that would return new values for a few variables on the page, as well as a flag checking if the move was successful. If it was, the move buttons would then unlock and allow the player to move again.

The pseudocode I’m imagining:

On Click (Move Up)  
{  
if(ReadyToMove)
    {
    Tween(ship, old position, new position)
    ReadyToMove = 0
    Call MoveDone
    }
}

MoveDone
{
ReadyToMove = Url('../movecheck/movement/' . current position .)
/* this url would return either 1 or 0 depending on if db xy matches given xy */    

if(!ReadyToMove)
{ current position = old position; display error(movefail) }

}

How do I actually do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:56:53+00:00Added an answer on May 28, 2026 at 7:56 am

    Have a look at $.ajax():

    $.ajax({
        method: 'POST',
        url: ':./movecheck/movement/'
        data: /* an object containing data key/value pairs */,
        dataType: 'json',
        success: function(resp) {
            /* do stuff after the response from the server has been received */
        }
    });
    

    To get a proper resp object, simply echo json_encode(...); with ... being an associative array or stdClass object containing your data, e.g. array('canMove' => true)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an entity which looks something like this: (I'm coding to the web
I am currently trying to stream content out to the web after a trans-coding
I am coding a web based exam application in PHP. The examinee has to
I have a web based program which chooses some records from a database using
I've read about phonegap which enables users to write web-based apps for android and
i am coding a pretty large intranet based web system that needs to support
I'm coding up a small Vista/7 sidebar gadget for our web based employee schedule
I am currently refining my design process for developing websites, scripts, and web-based applications.
Hi I am coding a web-crawler which will crawl the websites and selectively parse
Based on reading around the web, stack overflow, and mostly these articles about db

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.