Skip to content

Instantly share code, notes, and snippets.

@cremno
Created September 4, 2020 19:55
Show Gist options
  • Save cremno/f5254e7507711dd297f28f415b3e24eb to your computer and use it in GitHub Desktop.
Save cremno/f5254e7507711dd297f28f415b3e24eb to your computer and use it in GitHub Desktop.
# ★ 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