การอ้างอิงสคริปต์ RGSS

@ ในสคริปต์ RGSS คืออะไร

คำอธิบายของ @ Syntax ของสคริปต์ใน RGSS

กำหนดตัวแปรอินสแตนซ์สำหรับคลาส เพื่อให้สามารถอ่านและเขียนตัวแปรประเภทนี้ได้ คุณต้องสร้างเมธอด accessor สำหรับตัวแปรเหล่านี้ด้วย คุณยังสามารถใช้รหัสย่อ attr_reader, attr_writer หรือ attr_accessor เพื่อโหลดตัวดำเนินการที่เกี่ยวข้องโดยอัตโนมัติ

ตัวอย่างรหัส:

def initialize
  @battler_name = ""
  @battler_hue = 0
  @hp = 0
  @sp = 0
  @states = []
  @states_turn = {}
  @maxhp_plus = 0
  @maxsp_plus = 0
  @str_plus = 0
  @dex_plus = 0
  @agi_plus = 0
  @int_plus = 0
  @hidden = false
  @immortal = false
  @damage_pop = false
  @damage = nil
  @critical = false
  @animation_id = 0
  @animation_hit = false
  @white_flush = false
  @blink = false
  @current_action = Game_BattleAction.new
end

ทิ้งคำตอบไว้

อีเมล์ของคุณจะไม่ถูกเผยแพร่ ช่องที่ต้องการถูกทำเครื่องหมายด้วย *

ไซต์นี้ใช้ Akismet เพื่อลดสแปม เรียนรู้วิธีการประมวลผลข้อมูลความคิดเห็นของคุณ.