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.

Evented cosmetic lighting for 40x15?

zchin

Sponsor

Cosmetic lighting is only for indoor maps that are 20x15 right? what if you were to make a character set with the cosmetic lighting and a put the event with the cosmetic character set in the middle of the 40x15 map and again with the other 20x15 to the right?
Is this possible?

Thank you and have a nice day!
 
Actually, there is a way to use pictures with cosmetic lighting, if you know how to anchor an image to the map. In fact, here's a small script I threw together a while back just to do that.

Code:
#==============================================================================

# ** Game_Picture

#------------------------------------------------------------------------------

#  This class handles the picture. It's used within the Game_Screen class

#  ($game_screen).

#==============================================================================

 

class Game_Picture

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor   :anchor                    # rotation angle

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  alias glitch_anchor_pic_game_picture_initialize initialize

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     number : picture number

  #--------------------------------------------------------------------------

  def initialize(number)

    @anchor = false

    glitch_anchor_pic_game_picture_initialize(number)

  end

end

 

#==============================================================================

# ** Sprite_Picture

#------------------------------------------------------------------------------

#  This sprite is used to display the picture.It observes the Game_Character

#  class and automatically changes sprite conditions.

#==============================================================================

 

class Sprite_Picture < Sprite

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  alias glitch_anchor_pic_sprite_picture_update update

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    glitch_anchor_pic_sprite_picture_update

    if @picture.anchor == true

      self.ox = $game_map.display_x / 4

      self.oy = $game_map.display_y / 4

    end

  end

end

All you have to do is insert this between the default scripts and main, and then use the following script call to anchor a picture you are displaying:

Code:
pic = $game_screen.pictures

pic[number].anchor = true

Just make sure that number is the number of the picture (as set up when you displayed the picture). Also, you can release the anchor by setti9ng it to false instead of true.

I especially like this method because it allows you to do something like make a large building with lights that can turn on and off. It also allows you to make two images, one for light, and one for shadow, and use them together. (The shadow one will be set to subtract, of course)
 

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