Created
September 4, 2020 19:55
-
-
Save cremno/f5254e7507711dd297f28f415b3e24eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ★ Additional Blend Types | |
# ★★★★★★★★★★★★★★★★★ | |
# | |
# Author/s : cremno | |
# RGSS ver : 1 to 3 | |
# old: 0 = normal, 1 = addition, 2 = subtract | |
# new: 3 = multiply, 4 = screen, 5 = lighten, 6 = darken | |
class Blend_Type | |
def initialize(blend_type) | |
@blend_type = blend_type.to_i | |
@checked = false | |
end | |
def to_int | |
if @checked | |
@checked = false | |
@blend_type | |
else | |
@checked = true | |
@blend_type.between?(0, 6) ? 0 : @blend_type | |
end | |
end | |
end | |
[Plane, Sprite].each do |e| | |
e.class_eval do | |
alias cremno_blend_type= blend_type= unless $@ | |
def blend_type=(blend_type) | |
self.cremno_blend_type = Blend_Type.new(blend_type) | |
rescue => e | |
raise e.class, e.message, e.backtrace[2..-1] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment