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.

How to set the blend type for pictures in a script for XP?

Hey guys, I downloaded a light script that creates a picture as a light, but the script doesn't set the blend type for the light picture, so its just on normal blending. I want it to be on add blend, so I was trying to figure out how to change the picture's blend type to add.

Here's what I tried:

def initialize(event, radius, tone, flicker, glow, brightness, filename)
super()
self.z = 1000
self.tone = tone
self.opacity = brightness
self.x = (event.real_x - radius * 2 - $game_map.display_x) / 4 + 12
self.y = (event.real_y - radius * 2 - $game_map.display_y) / 4 + 6
bmp = filename == nil ? RPG::Cache.picture(DEFAULT) : RPG::Cache.picture(filename)
self.bitmap = Bitmap.new(radius, radius)
self.bitmap.stretch_blt(Rect.new(0, 0, radius, radius), bmp, bmp.rect)
picture.blend_type = 1
@radius = radius
@brightness = brightness
@event = event
@flicker = flicker
@glow = glow
@step = 0.001
@flicker_count = -1
@count = 0
end

But it didn't work, I got an undefined method error. Any help would be greatly appreciated, thanks!
 
but what is 'picture'?
the script never sets a value to it. don't you get a nil error?
I would try :
@blend_type = 1
or: self.blend_type = 1
sorry I can't help more, I've never worked with the Sprite class before.
 

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