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.

Short question about pictures

Ark

Member

Hi!

I have a pretty simple question.

I want to show a picture (from the event commands) and make its x-zoom to a certain number which is stored in a variable.

I couldn't find the appropriate thing in Move Picture...

Can you help me?
 
Try this, although I'm not sure if it works (put this anywhere above main).
Code:
class Game_Picture

  attr_reader   :target_zoom_x
  attr_reader   :target_zoom_y
  attr_reader   :duration

  def zoom_x(x, duration)
    @duration = duration
    @target_zoom_x = x.to_f
  end
  def zoom_y(y, duration)
    @duration = duration
    @target_zoom_y = y.to_f
  end
end

To use it, call script and have :

$game_screen.pictures[pictureidhere].zoom_x(number here, duration in frames here)

You can either put a number in "number here"  and "duration in frames here" or a variable, like $game_variables[yourvariableid]
 

Ark

Member

I do thank you for helping but it gives me an error...

When I want to use the "Show Picture" command I get this error:

Script 'Sprite Picture' line 64: ArgumentError occured.
wrong number of arguments(0 of 2)

And after this, it crashes.

Can you help me?
 
This should work now.
Code:
class Game_Picture

  attr_reader   :target_zoom_x
  attr_reader   :target_zoom_y
  attr_reader   :duration

  def zooming_x(x, duration)
    @duration = duration
    @target_zoom_x = x.to_f
  end
  def zooming_y(y, duration)
    @duration = duration
    @target_zoom_y = y.to_f
  end
en

and call with $game_screen.pictures[pictureid].zooming_x(1to50, time)
 

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