Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Script call to get the width of a picture

Status
Not open for further replies.
Hi all,

I'd like to know if there is a script call that can be used inside an event that will return the width of a picture currently on screen by passing it the number of the picture that is set with the Show Picture command?

Thanks for looking, any help is appreciated
 

eivl

Local Hero
Xy$
0.00
I am pretty sure that you can not do this in MV since you are only using the corner of the image for anything.
To get the width you would need a plugin that returns the width.
 
Hi

Yeah I found out that the picture doesn't have a width property and therefore can call what it doesn't have. I found a different solution to the problem anyway but thanks for your reply :D
 
Oh sorry I meant I changed the way I was doing things instead of getting to a point when I needed to use a script call. What I wanted to do was show a picture, then based on a variable show another picture that would be shown at the right hand side of the picture dynamically based on the 1st pictures width. But I found that I didn't need to do this and did something else not related to the 1st picture to solve my issue
 

eivl

Local Hero
Xy$
0.00
oh, yeah! =) great that you got it working!

For anyone else reading this in the future, you would have to write a sub class to add the width and height property, you would need methods to get and set those properties and the you would need methods to output them so you can access it via script calls! ;)
 
ImageManager.loadPicture($gameScreen._pictures[x].name()).width

Someone on a other forums said to use this and it worked, but I don't believe it's very efficient and by that time I had already figured out something else which I preferred.
 

eivl

Local Hero
Xy$
0.00
Ofc, i feel stupid now you can access it via

JavaScript:
ImageManager.loadPicture = function(filename, hue) {
    return this.loadBitmap('img/pictures/', filename, hue, true);
};
I actually just used this in another project ;)
This would be a very efficient solution to your original problem ;)
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Closing thread due to being addressed & solved, if for any reason you would like it re-opened please report the post or contact a moderator.
 
Status
Not open for further replies.
Top