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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:54:25+00:00 2026-05-26T12:54:25+00:00

I create image in this way: var orc = new Image(); orc.src = ./orc.png;

  • 0

I create image in this way:

var orc = new Image();
        orc.src = "./orc.png";

I use image in objects like this:

function Character(hp, image){
    this.hp = hp;
    this.image = image;
};

I call it in several times, like:

unit245 = new Character(100, orc);

And I draw it in this way, for example:

ctx.drawImage(unit245.image, 15, 55, 100, 100);

How I can get mouse click or move above my unit245 on canvas?

I need something like this http://easeljs.com/examples/dragAndDrop.html but without any frameworks (except jquery)

  • 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-26T12:54:26+00:00Added an answer on May 26, 2026 at 12:54 pm
    function Item(img, x, y){
        this.image = img;
        this.x = x;
        this.y = y;
        this.canv = document.createElement("canvas");
        this.canv.width = this.image.width;
        this.canv.height = this.image.height;
        this.ctx = this.canv.getContext('2d');
        this.ctx.drawImage(this.image, 0, 0, CELL_SIZE, CELL_SIZE);     
        this.hit = function  (mx, my) {
            var clr;
            clr = this.ctx.getImageData(mx - this.x, my - this.y, 1, 1).data;
            if (clr[3] > 250) {
                //On object
                this.image = gold_glow;
            } else {
                //Leave object
                this.image = gold;
            }  
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display in image on the view this way <img src =
Is it possible to create dynamic embed function in ActionScript3 for example like this
According to this question I succeeded to create upload image, but now I need
I have this code which should create a splash image with either no animation
Trying to create a background-image slideshow and am getting this error... This is the
I have this: Create Proc CrearNuevoImagen @imagen image AS INSERT INTO Imagenes(imagen) VALUES( @imagen
i want create image animation , i have 50 images with png format now
Is there a way to create an imagemap on an image when the image
Can anyone help me understand why this line doesn't create an image with a
I'm using html5 to create drag and drop image upload functionality. This works great

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.