Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RMXP] problem with Game_picture.new

cobo3

Member

First of all, i'm new in this forum so ill introduce myself! I'm a experienced maker except in scripts, ive just started learning. I also want to say that I'm spanish and i can manage to understand and speak english, but i'm not native hehe. Ive come to this forum bcos no one answers my qestions in soanish forums.. i hope you all are kinder :)

I am doing a cms, and after creating windows and scenes and whatever, everything works ok, but i want to put an picture that gets bigger and smaller at my will . The problem is that if I create the icon with the RPG::Cache etc type, i can't put the .zoom_x/.zoom_y that i want. So I decided to copy the picture (/icon/"picture_name") to the /Picture folder. Afterward, i write the following lines:

@picture = Game_Picture.new(1)
@picture.show("picture_name",0,14,14,100,100,255,0)

And after this i put the @picture.update in the correct place, but the problem shows when I try to open the menu, that, in fact, opens, but there is no picture. To prove that it is not a "jump the line command" (to name it somehow xd) error I changed the origin value (which is the second propiety, one first 0) into a string and actually it returns me an error. So I also tried to change the "picture name" propiety (not the name of the picture, but the picture_name) to some nosense name, and it does not return me any error. The fact is that I don't know what kind of error i am doing. I'd be thankful if someone could help me.

PD: I am really sorry about my english, excuse me. I try to do my bests
 
You need a Sprite to display the picture. There are already 50 sprites with linked picture objects waiting for you to use them. (Look at Spriteset_Map & Sprite_Picture to see how they are set up.)
You should be able to just use...

$game_screen.pictures[1].show("picture_name",0,14,14,100,100,255,0)

to display your picture

$game_screen.pictures[1].move() # see the move method in Game_Picture for arguments

to zoom in, etc..

$game_screen.pictures[1].erase

to stop showing the picture
 
IMO, it's not really advantegeous to use $game_screen.pictures for script operations, as one doesn't need to go the extra way around... Just use something like the following:

[rgss]@zoom_picture = Sprite.new
@zoom_picture.bitmap = # your image path reference here - and yeah, from RPG::Cache!
@zoom_picture.zoom_x = ... # or '@zoom_picture.bitmap.zoom_x = ...' if that zoom stuff is part of the Bitmap class
[/rgss]

That's the way any sprite is drawn, so doing it over $game_screen.pictures is unnecessarily complicated and resource-exhausting. And while we're at resource-exhausting: Remember to dispose the sprite!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top