메뉴 건너뛰기

창작에 관련된 질문이나 간단한 팁, 예제를 올리는 곳

------------------------ stairs.lua ------------------------


Stairs = {}


function Stairs:new(x, y, floor, direction, locked)

local newStairs = {x = x, y = y, floor = floor, direction = direction, locked = locked}

self.__index = self

return setmetatable(newStairs, self)

end


function Stairs:draw()

print("Stairs - X:" .. self.x .. " Y:" .. self.y .. " floor: " .. self.floor .. " direction: " .. self.direction .. " locked: " .. tostring(self.locked))

end


------------------------ main.lua ------------------------


require "stairs"


game = {}

game.stairs = {}

table.insert(game.stairs, Stairs:new(2, 6, 1, "up", false))

table.insert(game.stairs, Stairs:new(18, 9, 1, "down", false))

table.insert(game.stairs, Stairs:new(6, 2, 2, "up", false))

table.insert(game.stairs, Stairs:new(7, 12, 2, "down", false))

table.insert(game.stairs, Stairs:new(5, 5, 1, "up", true))


for a = 1, #game.stairs do

game.stairs[a]:draw() --same with game.stairs[a].draw(game.stairs[a])

end


print("Is game.stairs[1] locked? - " .. tostring(game.stairs[1].locked))


------------------------

분류 :
팁
조회 수 :
655
등록일 :
2020.11.06
21:53:00 (*.127.102.18)
엮인글 :
게시글 주소 :
https://hondoom.com/xe/study/818619
List of Articles
번호 제목 글쓴이 조회 수 추천 수 날짜 최근 수정일
18 팁 certbot을 이용한 HTTPS 인증서 발급 및 적용 노루발 687   2021-01-12 2021-01-12 16:57
 
17 팁 자동화된 Lua 스크립트의 문서화 - LDoc 노루발 44088   2021-01-11 2021-01-11 11:53
 
16 팁 리캡챠 적용 [1] 노루발 699   2021-01-08 2021-01-11 12:15
 
15 팁 Oracle cloud에 Nginx/MariaDB 설치하기 노루발 691   2020-12-06 2020-12-06 20:19
 
14 팁 Love2d로 만든 로그라이크 예제 노루발 979   2020-11-30 2020-11-30 22:54
 
13 팁 Love2d 이미지 하얗게 그리기 노루발 658   2020-11-23 2020-11-23 04:11
 
12 팁 루아 스타일 가이드 노루발 708   2020-11-19 2020-11-19 00:58
 
11 팁 턴 기반 시스템 구현에 대한 글 [4] 노루발 1267   2020-11-14 2020-11-18 05:49
 
10 팁 이쁜 눈나가 유니티 개발 알려주는 재생목록 노루발 668   2020-11-12 2020-11-12 05:59
 
9 팁 love2d에서 안드로이드 터치 제스처 인식하기 노루발 645   2020-11-12 2020-11-12 00:38
 
8 팁 특정좌표를 기준으로 zoom in/zoom out하기 노루발 721   2020-11-11 2020-11-11 01:22
 
» 팁 Lua 클래스 만들고 활용하기 노루발 655   2020-11-06 2020-11-06 22:43
------------------------ stairs.lua ------------------------ Stairs = {} function Stairs:new(x, y, floor, direction, locked) local newStairs = {x = x, y = y, floor = floor, direction = direction, locked = locked} self.__index = self return s...  
6 팁 Lua 테이블 안에 함수 저장하기 노루발 652   2020-11-06 2020-11-06 21:07
 
5 팁 Lua 인수로 nil값이 들어왔을 경우 처리하기 노루발 698   2020-11-06 2020-11-06 20:29
 
4 팁 Windows To Go와 R-Studio를 이용한 손실된 데이터 복구하기 노루발 631   2020-01-30 2020-01-30 19:52
 
3 팁 Love2d DPI 이슈 해결 [3] 노루발 2359   2019-06-29 2019-07-01 06:34
 
2 팁 Love2d 게임 중간에 광고 표시 [1] 노루발 813   2015-11-12 2015-11-17 00:16
 
1 팁 문D라이브 2008년 5월 19일 버전 [2] 혼돈 4162   2008-06-02 2015-12-09 08:06
휴가루 웍휴2를 개발하면서 조금씩 수정 중이지만, 미스릴님의 요청이 있어서 올립니다. 대화창에 관련되서 완성되었다는 것과 흥크립트 부분이 많이 변했다는 것이 주요 변경점입니다. 대화창의 경우 기본은 대화창이 없는 상태로 MakeDlgBox를 사용하면 크기...