The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Soliah on February 05, 2014, 06:49:47 PM

Title: [Question] [ACE] Fixed picture in a script
Post by: Soliah on February 05, 2014, 06:49:47 PM
Hi!
I'm new here, and I don't know how everything works around, so please tell me if I'm mistaken somehow! (and I'm french, so I'll probably use a weird english... ;))

Well, I have a problem with a script I'm trying to create for a puzzle game, working on ACE.
I want to create a picture over an event which is moving thanks to the script. I mean: the event is created, the script is called, the event move thanks to the script (not "move route" nor "autonomous movement"), and everytime the script moves, I want to create a picture over it.
But, I want this picture to be fixed from the map point of view. So, I've tried to use the script of modern algebra http://rmrk.net/index.php?topic=39052.0 (http://rmrk.net/index.php?topic=39052.0), which is wonderful, but doesn't work with my piece of code (the event is calling this code):
class Game_Character < Game_CharacterBase
# some codes
  sprite = Sprite.new($spriteset_vp1)
  sprite.bitmap = Cache.picture(filename)
  sprite.x = @x * 32
  sprite.y = @y * 32
# some codes
end


I've also tried something like that, inspired from another script (and I have renamed the file.):
class Sprite_Character < Sprite_Base
  def update
    super
    update_bitmap
    update_src_rect
    if @character.character_name.include?("[FIXED]")
      self.x -= $game_map.display_x * 32
      self.y -= $game_map.display_y * 32
    else
      update_position
    end
    update_other
    update_balloon
    setup_new_effect
  end
end


Everything seems to be allright, his script is above mine. But it just doesn't work :(
If anybody know how I can't fix that, I would be eternally thankful! And If you need anything else, just tell me!
Title: Re: [Question] [ACE] Fixed picture in a script
Post by: Soliah on February 08, 2014, 07:11:34 AM
If someone wonders, you just have to add the Game_Picture (called "current_picture" in my code) to the always existing Game_Pictures "$game_map.screen.pictures" array. Then you show it. I also overcharged the class Game_Pictures to get its current size, I don't know if you can get this somehow else.

class Game_Pictures
  def size
    return @data.size
  end
end

current_picture = $game_map.screen.pictures[$game_map.screen.pictures.size]
current_picture.show(filename, 0, pos_x, pos_y, 100, 100, 255, 0)