0
\$\begingroup\$

I'm trying to make a script on RPG Maker XP that needs the width and height of an image to do some calculations. I tried @picture.bitmap.widthand @picture.bitmap.height but it returned the width and height of the image that is being shown in the screen.

For instance, if the image is 800 pixels height, and the image takes 400 pixels in the screen, @picture.bitmap.height will only return 400. This is the code I'm using:

@picture = Sprite.new
@picture.bitmap = RPG::Cache.picture("picture")
@pictureWidth = @picture.bitmap.width
@pictureHeight = @picture.bitmap.height
\$\endgroup\$
  • \$\begingroup\$ What decides how many pixels it will take on the screen? \$\endgroup\$ – wolfdawn Mar 1 '14 at 9:43
  • \$\begingroup\$ The windows above it. Although I've realized what the problem was, as stated in my answer. Thank you so much for your attention, though. \$\endgroup\$ – Gus Mar 1 '14 at 20:21
1
\$\begingroup\$

I've realized what the problem was. I had made another picture, bigger than the screen size to test the script. But I forgot to import it to RMXP. Now that I've done that, it prints the correct value to the screen. Apologies for my lack of attention.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.