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.

Move a picture

the-m

Member

Hello Everyone !

I wonder how to move a picture in RGSS.
Indeed I showed a picture with the Sprite method (@pic = Sprite.new, @pic.bitmap = Bitmap.new("mypicture.png")) and I'd want to move it.

I don't know how to do, I just know that the simple script (with the buttons) uses the Game_Picture#move method. I tried to show my picture with Game_Picture#show to move it after but it failed.

Any idea ?

Th@nks
 
Code:
@move_win_on = true
@move_win = @pic
@destinationy = 0 #destination y
@move_speed = 8

      if @move_win_on and @move_win != nil
        if @move_win.y > @destinationy
          @move_win.y -= @move_speed
          @move_win.y  = @destinationy if @move_win.y < @destinationy

        else
          @move_win.y += @move_speed
          @move_win.y = @destinationy if @move_win.y > @destinationy
        end
      else
        @move_win_on = false
      end

That's basically how to change the y position of a window/picture.
Put it in the update method you want it to use.
 

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