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.

HOW DO I OPEN A PICTURE FROM SCRIPT?

Help me here, please!
What's the command for opening a picture file from a script?
I still haven't found it in game_picture. Thanxs!!
 
If you look at the comments at the top of Game_Picture, "It's used within the Game_Screen class"

Look at the Game_Screen class, and you'll see on line 34 that 100 "Game_Pictures" get created.
And on line 144, each picture gets updated once per frame (on the map).

Game_Picture is only the object that holds the information about each picture. Not the picture (bitmap) itself.

So, back to Game_Picture...

Look at the 'show' method (line 60..) Notice that @name get set to the first parameter in the def line, "name"
By assigning a name to the Game_Picture object, the Sprite_Picture object (which loads the bitmap) knows to show the picture. (You can also set all the other parameters using this method too.) So, to load "MyPic.png" into the 1st picture, you use...

Game_Screen.pictures[1].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)

of course, replacing all the arguments with values...

Game_Screen.pictures[1].show("MyPic", 0, 120, 60, 100, 100, 255, 0)

Or, to create a picture using all the default values...

Game_Screen.pictures[1].name = "MyPic"

Be Well
 

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