Nspired Lua クラス入門非公式訳
--[[ 「任意のオブジェクトを複製する」 クリックしたオブジェクトが複製される。 どれかオブジェクトが選択状態にあるときに enter キーを押すとそのオブジェクトが複製される。 参考: http://compasstech.com.au/TNS_Authoring/Scripting/script_tut11.htm…
-- 任意のオブジェクトをマウスで動かす。 -- 参考: http://compasstech.com.au/TNS_Authoring/Scripting/script_tut11.html ~ tut14.html require "color" W = platform.window:width() H = platform.window:height() TrackedObject = nil TrackOffsetx = …
-- 任意のオブジェクトをクリックして選択する -- 参考: http://compasstech.com.au/TNS_Authoring/Scripting/script_tut11.html ~ tut15.html require "color" W = platform.window:width() H = platform.window:height() TrackedObject = nil TrackOffset…
-- 注目オブジェクトを矢印キーで動かす -- 参考: -- 全体については http://compasstech.com.au/TNS_Authoring/Scripting/script_tut11.html ~ tut15.html -- 下の move メソッドについては https://inspired-lua.org/index.php/2011/05/5-object-classes/…
-- 複数のオブジェクトを tab キーで巡廻する。 -- 参考: http://compasstech.com.au/TNS_Authoring/Scripting/script_tut14.html require "color" TrackedObject = nil Square = class() function Square:init(x, y, sideLen, color) self.x = x self.y = y…
-- 包含判定をする。 -- 参考: http://compasstech.com.au/TNS_Authoring/Scripting/script_tut11.html require "color" Square = class() -- Square クラスを作る。 function Square:init(x, y, width, height) self.x = x self.y = y self.width = width s…
box = class() -- 何も継承せずに box クラスを作る。 function box:init(x, y, w, h, color) -- box クラスを初期化する。 self.x = x self.y = y self.w = w self.h = h self.color = color end function box:paint(gc) -- box クラスの描画メソッドを作る…