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.

Changing zoom of pictures using Call Script?

Status
Not open for further replies.
I just wanted to check, is it possible to use Call Script to change the X zoom of pictures? I'm trying to make a simple common event-based HP bar, but "Move Picture" doesn't let you use a variable for the zoom, so I tried this:

Code:
$game_screen.pictures[6].zoom_x = $game_actors[1].hp / $game_actors[1].maxhp

. . . so that at 100% HP, zoom_x would be 1.0; but apparently zoom_x is an undefined method for $game_screen.pictures.

Anything else I can do or will I just have to bite the bullet and learn to script them as sprites?
 
did you try to debug?

print $game_screen.pictures[6]

What I think, is that $game_screen.pictures[6] does not exist.

note: picture 6 in event commands is probably $game_screen.pictures[5], because the index starts at 0, not at 1.
 
I would also like to figure out how to do this so I can replace a draw_bar command with an image, which causes frame skip when it updates. It would save me 36 spots in the common event list.

I just need to know how to say "$game_screen.pictures[6].zoom_x = HP %" with a health image of 100 pixel length.
 
uhm..

this to show it ( only one time ):
Code:
$hud = {
"hp" => $game_actors[1].hp * 100 / $game_actors[1].maxhp
"mp" => $game_actors[2].sp * 100 / $game_actors[2].maxsp
}
$game_screen.pictures[ID].show(origin, X, Y, $hud["hp"], height, opacity, blending)

and this paralell or in a paralell Script.. f.e. Scene_Map:
Code:
$hud = {
"hp" => $game_actors[1].hp * 100 / $game_actors[1].maxhp
"mp" => $game_actors[2].sp * 100 / $game_actors[2].maxsp
}
$game_screen.pictures[ID].move(frames, origin, X, Y, $hud["hp"], height, opacity, blending)


That?s all

Because you are able to setup the frames.. you can choose how long the animations running to complet.


To Stop a picture while it?s moving:

add this above Main:
Code:
class Game_Picture
  attr_accessor :duration
end

now you?re able to stop the move_picture via RGSS.. with this call_Script snibble:
Code:
$game_screen.pictures[ID].duration = 0

to erase a picture:
Code:
$game_screen.pictures[ID].erase
 
np.. i?m using this by myself too ^^

I don?t like Scripted HUDs...
Don?t forget to change the ID of the Game_actors to your Hero.. ( the sp calculation is ID 2.. change it to 1 too )
 
This topic has been resolved. If fortysixand2 or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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