Changed image changes EVERY instance of that image?

● ARCHIVED · READ-ONLY
Started by Yin 6 posts View original ↗
  1. So I changed a battler's image to include some blur for a scene, but when I go into battle that enemy in a regular battle, the blur is still on him.

    My code:

    enemy_image = Sprite_Base.new enemy_image.visible = false enemy_image.bitmap = Cache.battler(enemy.battler_name, 0) if $game_system.enemykillcount[enemy.id][0] == false enemy_image.bitmap.blur <----- This line is still applied when I go into battle with this enemy. rect = Rect.new(1, 0, enemy_image.bitmap.width, enemy_image.bitmap.height) target = Rect.new(122, (line_height * 2) + 2, 218, 143 - 2) contents.stretch_blt(target, enemy_image.bitmap, rect, 160)Don't know what I'm doing wrong though. How am I changing every instance of this image?
  2. You're changing the cached version, so whatever changes you make there will persist until you reload the image from disk.
  3. Code:
    enemy_image.bitmap = Cache.battler(enemy.battler_name, 0).clone
    will give you a COPY of the image to manipulate as you wish, without affecting the original.
  4. Perfect Shaz, thanks. That worked like a charm!

    I missed your response Tsukihime, that is exactly what I was doing. I didn't know it would effect all of them  :o
  5. There is only one copy of it.


    When you say "myPic = someOtherPic", you still only have one pic: it's just that you're using a new name to reference the same pic.


    Both myPic and someOtherPic would still be referring to the same picture.
  6. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.