I have the following function
"use strict";
function Player
{
this.width;
this.height;
this.framesA = 5;
this.image = new Image();
this.image.onload = function ()
{
width = this.width;
height = this.height / framesA;
}
this.image.src = "Images/angel.png";
}
How can I make this code to work?
I want the width and height in the Player function be inalized with the width and the height of the image when the onload function is called.
I need this to work with strict mode (A must).
If this should be accomplished another way feel free to teach.
EDIT: I updated the code to reflect a more realistic situation(I didn't know this will be so complicated)
EDIT 2: Another update to the code. I didn't notice that I wrote var insted of this. Sorry.
Thanks in advance
Comments
Post a Comment