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.

[Resolved] Picture Flip

EOG

Member

Hello

I've got a problem(?) with pictures. What I mean is I need to flip them(so final game will need less disc space).

I've allredy tried force flipping by:
Code:
$game_screen.pictures[1].show("Picture", 0, 100, 100, -100, 100, 255, 0)
but it does not work.

Any Ideas/Scripts ?
 
How will flipping pictures cause the game to take less disk space? Just wondering, as by flipping sprites inside the game, the file the sprite is made from still exists in the game, and will in no way change its size.

Oh, and the only solution to actually flipping (mirroring a picture), you would have to do this using the bitmap of the picture. 'self.bitmap' does work within the Sprite_Picture class, so inside Spriteset_Map you can use the code:
Code:
@picture_sprites[number].mirror
Replace number with whatever the picture number is.

I hope this helps. If this was not what you meant, try to be more descriptive next time.

Cheers.
 

EOG

Member

FireRaven":1irayit4 said:
How will flipping pictures cause the game to take less disk space? Just wondering, as by flipping sprites inside the game, the file the sprite is made from still exists in the game, and will in no way change its size.
I am using same picture many times but in some places it needs to be flipped(mirrored) and if I do that(flip them by code) I do not need an extra(flipped) picture in game folder.

FireRaven":1irayit4 said:
Oh, and the only solution to actually flipping (mirroring a picture), you would have to do this using the bitmap of the picture. 'self.bitmap' does work within the Sprite_Picture class, so inside Spriteset_Map you can use the code:
Code:
@picture_sprites[number].mirror
Replace number with whatever the picture number is.
Tried it but did not work. What I did was add an extra line in Spriteset_Map
Code:
@picture_sprites[9].mirror
in initialize and(not in the same time) update but did not work(thought no error).

Maybe I am doing sth wrong so can you make a demo with one flipped picture using this method?

Or maybe sb has other idea.

Thx for help
 
It will not work unless the picture of ID 9 already is shown using Show Picture command.
Make a method inside Spriteset_Map that goes as follows:
Code:
def flip_picture(index)
  @picture_sprites[index].mirror
end
Oh, and you will need this little piece of code anywhere above Main:
Code:
class Scene_Map
  attr_reader :spriteset
end
Once that is added, use:
Code:
$scene.spriteset.flip_picture(9)
Make sure this is called when you're on the map in an event or inside Scene_Map (or whenever Scene_Map is the current scene). If you want to call this several places, you will need to add a check, use this code:
Code:
if $scene.is_a?(Scene_Map)
  $scene.spriteset.flip_picture(9)
end

Hope this helps.
 
Aha. I see what I forgot to add. Change the method into this:
Code:
def picture_flip(index)
  @picture_sprites[index].mirror = true
end
I just did that in your project and it worked just fine.

Cya around.
 

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