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.

Viewports Helps.

Ok I am trying to create a script that shows a part of the map, but by some reason the Events don't appear, I copied the Spriteset_Map class and edited it to do what I want but It doesn't show the events. What have I done Wrong?

This requires the SDK.

Code:
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================
 
class Scope < Spriteset_Map
  SPRITE = "SCOPE"
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x,y,width,height,caller,range = 0)
    #Sets the Scope Variables
    @x = x
    @y = y
    @width = width
    @height = height
    @caller = caller
    @caller_direction = @caller.direction
    @range = range
    #Sets the Sprite
=begin    
    bitmap1 = RPG::Cache.picture(SPRITE)
    @sprite = Sprite.new
    @sprite.bitmap = bitmap1
    @sprite.x = x - 16
    @sprite.y = y - 16
    #@sprite.z = 6000
=end    
    super()
  end
  #--------------------------------------------------------------------------
  # * Def x
  #--------------------------------------------------------------------------
  def x=(value)
    @x = value
  end
  #--------------------------------------------------------------------------
  # * Def x
  #--------------------------------------------------------------------------
  def y=(value)
    @y = value
  end
  #--------------------------------------------------------------------------
  # * Def z
  #--------------------------------------------------------------------------
  def z=(value)
    @viewport1.z += value
    @viewport2.z += value
    @viewport3.z += value
#    @sprite.z    += value
  end
  #--------------------------------------------------------------------------
  # * Def Dispose
  #--------------------------------------------------------------------------
  alias dispose_cg1 dispose
  def dispose
    dispose_cg1
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Viewport Initialization
  #--------------------------------------------------------------------------
  def init_viewports
    # Make viewports
    @viewport1 = Viewport.new(@x, @y,@width, @height)
    @viewport2 = Viewport.new(@x, @y,@width, @height)
    @viewport3 = Viewport.new(@x, @y,@width, @height)
    @viewport2.z = 200
    @viewport3.z = 5000
  end
  #--------------------------------------------------------------------------
  # * Update Tilemap
  #--------------------------------------------------------------------------
  def update_tilemap  
    #Checks The Directions of the Caller
    if @caller.direction != @caller_direction
      #Resets the Position
      @tilemap.ox = 9*32
      @tilemap.oy = 9*32
      @caller_direction  =  @caller.direction
    end
    #Checks Player Input
    if Input.triggerd?(Input::PGUP)
      #Cheks The caller Direction
      case @caller.direction
      when 2
        @tilemap.oy += 2
      when 8
        @tilemap.oy -= 2
      when 4
        @tilemap.ox -= 2
      when 6
        @tilemap.ox += 2
      end
    elsif Input.triggerd?(Input::PGDN)
      #Cheks The caller Direction
      case @caller.direction
      when 2
        @tilemap.oy -= 2
      when 8
        @tilemap.oy += 2
      when 4
        @tilemap.ox += 2
      when 6
        @tilemap.ox -= 2
      end
    end
    x =  (@caller.x -1) * 32
    y =  (@caller.y - 1) * 32
    @tilemap.ox =x
    @tilemap.oy =y  

    # Update tilemap   
    # Update tilemap
    @tilemap.update
  end
end

Any help would be Much Apreciated. :P
 
Could you tell me what you are trying to do?

I think this new class might not be needed, but I am not 100% sure on exactly what are you trying to do.


It looks like you are adding a sprite to the "caller" which would be better done by adding an instance variable (such as @_scope) in the Sprite_Character class.
 
I am trying to create a class that shows a part of the map exactly as it is, but I want it to be based in the @caller position. That means that when I call the class, it creates the tilemap where the @caller is and If I press pageup it move foward and IF I press Page down it move backwards. Like a Scoping ability, in the sniper rifles. Hope you understood.

Btw I added you on Msn.. :P

[OFFtopic]
Trickster was right when he said I should ask to you...
[/OFFtopic]
 

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