Đây là một mini games , giống như FF8 , nhưng cách đánh bài của nó khác , các bạn tự tìm hiểu cách chơi nhé .
Tạo script trên main , đặt tên Card
Đây chỉ là khuôn mẫu của một lá bài , nếu ai hiểu về script , hãy chỉnh sửa thành nhiều lá bài , rồi tạo hiệu ứng , có thể download bản demo tại đây :
HERE
Tạo script trên main , đặt tên Card
Mã:
# Parent card, used to give card global properties.
# For simplicity, the card effects are merged with the card displayement.
class Card < RPG::Sprite
attr_accessor :name
def initialize
super
@name = "unnamed card"
# The backside of the card when facing up
@front_pic = RPG::Cache.picture("cardfront")
# The backside of the card when facing down
@front_pic = RPG::Cache.picture("cardback")
# The displayement when facing up, such as monsters.
@contents = Bitmap.new(90,120)
# The merging of the contents and the front_pic
@card_pic = Bitmap.new(90,120)
update_contents
# Make card face down.
@upside = false
self.bitmap = @back_pic
end
# Merge layers when card is facing upwards.
def update_contents
@card_pic.clear
@card_pic.blt(0,0,@front_pic,@front_pic.rect)
@card_pic.blt(0,0,@contents_pic,@contents_pic.rect)
end
def flip
@upside = !@upside
@upside ? self.bitmap = @card_pic : self.bitmap = @back_pic
end
def play(user)
@user = user
end
def target
@targets = []
end
def effect
#
end
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
end
# Makes a card that allows you to attack twice.
class Card_OdenStrike < Card
def initialize
# Calls the initialize function of the Card class.
super
@name = "Oden strike"
@contents_pic.dispose
@contents_pic = RPG::Cache.picture("oden_card")
update_contents
end
# Function run when the card is first selected.
def play(user)
super(user)
flip
target
end
# Function for targetting.
def target
super
# Select an enemy
@target_arrow = Arrow_Enemy.new
Input.update
while not Input.trigger?(Input::C)
@target_arrow.update
Graphics.update
Input.update
end
@targets.push @target_arrow.enemy
effect
end
# Function which handles the effects.
def effect
super
# Perform two strikes
@targets.first.attack_effect(@user)
@targets.first.attack_effect(@user)
end
def dispose
super
end
end
Đây chỉ là khuôn mẫu của một lá bài , nếu ai hiểu về script , hãy chỉnh sửa thành nhiều lá bài , rồi tạo hiệu ứng , có thể download bản demo tại đây :
HERE