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 8683833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:08:45+00:00 2026-06-12T22:08:45+00:00

I am working on one html5 game project. In this I have to control

  • 0

I am working on one html5 game project. In this I have to control my object direction through mouse. I have already control it from keyboard. But I want to implement Mouse controlling. So anybody can Help then reply me.

  • 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-06-12T22:08:46+00:00Added an answer on June 12, 2026 at 10:08 pm

    Assuming you’re using jQuery:

    $(document).bind('mousemove', function(e) {
        var refObj = $('#image-id');  // reference object selector
        var objPos = refObj.offset(); // get object's absolute position
        var objCenterPos = {          // get object's center absolute position
            x: objPos.left + refObj.width()  / 2,
            y: opjPos.top  + refObj.height() / 2
        };
        var refPos = { // compute mouse position relative to reference object
            x: e.pageX - objCenterPos.x,
            y: e.pageY - objCenterPos.y
        };
    
        updateDirectionVector(refPos); // refPos is also the direction vector
    });
    
    function updateDirectionVector(vector) {
        // do whatever you want here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an HTML5 game engine, and I want my Camera object to have
I'm working on an HTML5/JavaScript game engine, and I have started to encounter a
Yo everyone! I have been working on an Isometric Tile Game Engine in HTML5/Canvas
I have my html5 form working to upload multiple mp3 files with one submit
I am working on one product which requires extensive testing of emails. I have
I am working on one project where there is a functionality need to implement
I'm trying to get an html5 demo page working on Android 2.1, have tried
I have a HTML5 video, working fine, and i'm happily smiling whenever i start
Im working on a simple html/javascript multiplication game, in which I have a multiplication
I'm working with the HTML5 canvas element. Let's say I have 2 ImageData objects

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.