Field

์†Œ๊ฐœ

ํ”Œ๋ ˆ์ด์–ด์™€ ๊ด€๋ จ๋œ ์†์„ฑ ๊ฐ’๋“ค ์ž…๋‹ˆ๋‹ค.

ํ”Œ๋ ˆ์ด์–ด์˜ ๋‹‰๋„ค์ž„(name), ์œ„์น˜(tileX / tileY) ๋“ฑ์„ ์กฐํšŒํ•˜๊ฑฐ๋‚˜ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ŠคํŒŸ๋ผ์ดํŠธ(spotlight), ์•ˆ๋ณด์ž„(hidden) ๊ธฐ๋Šฅ์„ ํ™œ์„ฑํ™” ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์บ๋ฆญํ„ฐ์˜ ์ด๋™์†๋„(moveSpeed), ์ด๋ฏธ์ง€(sprite)๋ฅผ ๋ณ€๊ฒฝํ•˜๊ฑฐ๋‚˜ ํ”Œ๋ ˆ์ด์–ด์˜ ์ €์žฅ๊ณต๊ฐ„(storage)์„ ํ™œ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”’ ์•„์ด์ฝ˜์ด ์žˆ๋Š” ํ•„๋“œ๋Š” ์ˆ˜์ •์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ฝ๊ธฐ ์ „์šฉ ํ•„๋“œ์ž…๋‹ˆ๋‹ค.

์ด๋ฆ„์„ค๋ช…

๐Ÿ”’ id

ํ”Œ๋ ˆ์ด์–ด์˜ id ๊ฐ’

name

ํ”Œ๋ ˆ์ด์–ด์˜ ๋‹‰๋„ค์ž„ ๊ฐ’

title

์•„๋ฐ”ํƒ€ ๋‹‰๋„ค์ž„ ์œ„์— ๋…ธ๋ž€์ƒ‰์œผ๋กœ ๋…ธ์ถœ๋˜๋Š” ํ…์ŠคํŠธ

๐Ÿ”’ role

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ถŒํ•œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆซ์ž ๊ฐ’

๐Ÿ”’ tileX / tileY

์•„๋ฐ”ํƒ€๊ฐ€ ์„œ์žˆ๋Š” X ์ขŒํ‘œ ๊ฐ’๊ณผ Y ์ขŒํ‘œ ๊ฐ’

๐Ÿ”’ dir

์•„๋ฐ”ํƒ€๊ฐ€ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ๋Š” ๋ฐฉํ–ฅ ๊ฐ’

moveSpeed

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋™์†๋„ ๊ฐ’

sprite

์•„๋ฐ”ํƒ€์˜ ์Šคํ”„๋ผ์ดํŠธ ์ด๋ฏธ์ง€ ๊ฐ’

tag

ํ•„์š”ํ•œ ์†์„ฑ ๊ฐ’์„ ๋ถ€์—ฌ ๊ฐ€๋Šฅํ•œ ๊ฐ’ ์ €์žฅ ๊ณต๊ฐ„

hidden

๊ฐ’์ด true ์ด๋ฉด, ๋‹ค๋ฅธ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

spotlight

ํ”Œ๋ ˆ์ด์–ด์˜ ์ŠคํŒŸ๋ผ์ดํŠธ ๊ธฐ๋Šฅ ํ™œ์„ฑํ™” ์—ฌ๋ถ€

attackType

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ณต๊ฒฉ(Zํ‚ค) ํƒ€์ž…

attackSprite

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ณต๊ฒฉ(Zํ‚ค) ์ด๋ฏธ์ง€ ๊ฐ’

attackParam1

๊ณต๊ฒฉ ์ด๋ฏธ์ง€๊ฐ€ ๋‚ ์•„๊ฐ€๋Š” ๊ฑฐ๋ฆฌ ๊ฐ’

attackParam2

๊ณต๊ฒฉ ๊ฐ€๋Šฅ ๊ฑฐ๋ฆฌ ๊ฐ’ attackType์ด 2(์›๊ฑฐ๋ฆฌ ๊ณต๊ฒฉ)์œผ๋กœ ์„ค์ • ๋œ ๊ฒฝ์šฐ์—๋งŒ ์œ ํšจ

๐Ÿ”’ walletAddress

ํ”Œ๋ ˆ์ด์–ด์˜ ์ „์ž์ง€๊ฐ‘ ์ฃผ์†Œ ๊ฐ’

storage

์ŠคํŽ˜์ด์Šค ๋‚ด์˜ Player ๊ฐ’ ์ €์žฅ ๊ณต๊ฐ„(์ŠคํŽ˜์ด์Šค ํ•œ์ •)

๐Ÿ”’ isMobile

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ชจ๋ฐ”์ผ ์ ‘์†์—ฌ๋ถ€

๐Ÿ”’ isMoving

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์›€์ง์ด๊ณ  ์žˆ์œผ๋ฉด True, ์•„๋‹ˆ๋ฉด False๋ฅผ ๋ฐ˜ํ™˜

๐Ÿ”’ isJumping

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ ํ”„ํ•˜๊ณ  ์žˆ์œผ๋ฉด True, ์•„๋‹ˆ๋ฉด False๋ฅผ ๋ฐ˜ํ™˜

๐Ÿ”’ customData

URL ์ฟผ๋ฆฌ ์ŠคํŠธ๋ง์„ ์ฝ์–ด ๊ฐ’์„ ์ €์žฅ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

displayRatio

ํ”Œ๋ ˆ์ด์–ด์˜ ํ™”๋ฉด ์คŒ ๋น„์œจ์„ ์กฐ์ ˆ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

titleColor

ํ”Œ๋ ˆ์ด์–ด์˜ ํƒ€์ดํ‹€ ์ƒ‰์ƒ

๐Ÿ”’ emailHash

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ Hash ๊ฐ’

๐Ÿ”’ isGuest

๋น„๋กœ๊ทธ์ธ ํ”Œ๋ ˆ์ด์–ด์ธ ๊ฒฝ์šฐ true ๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

๐Ÿ”’ language

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์–ธ์–ด ์„ค์ • ๊ฐ’

๐Ÿ”’ away

5๋ถ„ ์ด์ƒ ๋น„ํ™œ์„ฑํ™”๋œ ์œ ์ €์ธ ๊ฒฝ์šฐ true๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

enableFreeView

๋งต ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“š API ์„ค๋ช… ๋ฐ ์˜ˆ์ œ

id , name

player.id : Number player.name : String

ํ”Œ๋ ˆ์ด์–ด์˜ id, ๋‹‰๋„ค์ž„ ๊ฐ’์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅ ํ•  ๋•Œ ํ”Œ๋ ˆ์ด์–ด์˜ id, name ๊ฐ’ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){
  App.sayToAll(`id: ${player.id} name: ${player.name}`);
})

title

player.title : String

title์€ ์บ๋ฆญํ„ฐ ๋‹‰๋„ค์ž„ ์œ„์— ๋…ธ๋ž€์ƒ‰์œผ๋กœ ๋…ธ์ถœ๋˜๋Š” ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅ ํ•  ๋•Œ title ์„ค์ •ํ•ด๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){
	player.title = "ํƒ€์ดํ‹€";
	player.sendUpdated();
})

role

player.role : Number

role์€ ํ”Œ๋ ˆ์ด์–ด์˜ ๊ถŒํ•œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆซ์ž ๊ฐ’ ์ž…๋‹ˆ๋‹ค.

ํ”Œ๋ ˆ์ด์–ด์˜ role์— ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐ’์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

์ผ๋ฐ˜/๋น„๋กœ๊ทธ์ธ์œ ์ €-1์Šคํƒœํ”„2000

๋ฉค๋ฒ„

0

๊ด€๋ฆฌ์ž

3000

์—๋””ํ„ฐ

1000

๋งต์†Œ์œ ์ž

3001

์˜ˆ์ œ

๊ถŒํ•œ ๊ฐ’์„ ์ฑ„ํŒ… ์ฐฝ์— ํ‘œ์‹œํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	App.sayToAll(`${player.name}๋‹˜์˜ ๊ถŒํ•œ: ${player.role}`)
})

tileX, tileY

player.tileX: Number player.tileY: Number

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๊ฐ€ ์„œ์žˆ๋Š” X ์ขŒํ‘œ ๊ฐ’๊ณผ Y ์ขŒํ‘œ ๊ฐ’์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

๋‚ด ์บ๋ฆญํ„ฐ์˜ x, y ์ขŒํ‘œ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	App.sayToAll(`ํ˜„์žฌ ์ขŒํ‘œ: (${player.tileX}, ${player.tileY})`)
})

dir

player.dir : Number

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๊ฐ€ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ๋Š” ๋ฐฉํ–ฅ์ž…๋‹ˆ๋‹ค.

์บ๋ฆญํ„ฐ๊ฐ€ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ๋Š” ๋ฐฉํ–ฅ์— ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐ’์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

์บ๋ฆญํ„ฐ๊ฐ€ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ๋Š” ๋ฐฉํ–ฅ์„ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	App.sayToAll(`๋ฐ”๋ผ๋ณด๊ณ  ์žˆ๋Š” ๋ฐฉํ–ฅ: ${player.dir}`)
})

moveSpeed

player.moveSpeed : Number

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋™์†๋„ ๊ฐ’์ž…๋‹ˆ๋‹ค.( ๊ธฐ๋ณธ ๊ฐ’: 80 )

์ด๋™์†๋„ ๊ฐ’์ด 0์ด๋ฉด ์›€์ง์ผ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ด๋™์†๋„๊ฐ€ ๋นจ๋ผ์ง€๋Š” ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	player.moveSpeed = 150;
	player.sendUpdated();
})

sprite

player.sprite : ScriptDynamicResource

ํ”Œ๋ ˆ์ด์–ด ์บ๋ฆญํ„ฐ์˜ ์Šคํ”„๋ผ์ดํŠธ ์ด๋ฏธ์ง€์ž…๋‹ˆ๋‹ค. ( null ์ž…๋ ฅ ์‹œ ๊ธฐ๋ณธ ์•„๋ฐ”ํƒ€ ์ด๋ฏธ์ง€๋กœ ์ดˆ๊ธฐํ™” )

์Šคํ”„๋ผ์ดํŠธ ์ด๋ฏธ์ง€๋ฅผ ์ฒ˜์Œ ๋“ค์–ด๋ณด์‹ ๋‹ค๋ฉด ์Šคํ”„๋ผ์ดํŠธ์‹œํŠธ ์ดํ•ดํ•˜๊ธฐ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!

์˜ˆ์ œ

ํŽ˜์ธํŠธ๋งจ - ๋ธ”๋ฃจ๋งจ ์ด๋ฏธ์ง€๋ฅผ ์บ๋ฆญํ„ฐ ์ด๋ฏธ์ง€๋กœ ์ ์šฉํ•ด๋ณด๊ธฐ

// ํ•œ ํ”„๋ ˆ์ž„์˜ ์‚ฌ์ด์ฆˆ 48x64
let blueman = App.loadSpritesheet('blueman.png', 48, 64, {
    left: [5, 6, 7, 8, 9], // ์ขŒ๋ฐฉํ–ฅ ์ด๋™ ์ด๋ฏธ์ง€
    up: [15, 16, 17, 18, 19],
    down: [0, 1, 2, 3, 4],
    right: [10, 11, 12, 13, 14],
		dance: [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],
		down_jump: [38],
		left_jump: [39],
		right_jump: [40],
		up_jump: [41],
}, 8);
// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•˜๋ฉด ์บ๋ฆญํ„ฐ ์ด๋ฏธ์ง€๊ฐ€ ๋ฐ”๋€œ
App.onJoinPlayer.Add(function(player){
	player.sprite = blueman;
	player.sendUpdated();
});

tag

player.tag: Any

tag๋ฅผ ์‚ฌ์šฉํ•ด ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ•„์š”ํ•œ ์†์„ฑ ๊ฐ’์„ ๋ถ€์—ฌ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ โ€˜aliveโ€™ ์†์„ฑ ๊ฐ’ ๋ถ€์—ฌํ•ด๋ณด๊ธฐ. โ€˜aliveโ€™ ์†์„ฑ ๊ฐ’์€ ์ž„์˜๋กœ ์ƒ์„ฑํ•œ ์†์„ฑ ์ž…๋‹ˆ๋‹ค.

์“ฐ์ด์ง€ ์•Š๋Š”๋‹ค๋ฉด ์•„๋ฌด ์˜๋ฏธ ์—†๋Š” ์†์„ฑ ๊ฐ’ ์ด์ง€๋งŒ, ๊ฒŒ์ž„์„ ๋งŒ๋“ค ๋•Œ ํ”Œ๋ ˆ์ด์–ด์˜ ์ƒ์กด ์—ฌ๋ถ€๋ฅผ ์ฒดํฌํ•˜๋Š” ์ค‘์š”ํ•œ ์†์„ฑ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function (player) {
	player.tag = {
		alive: true,
	};
	player.sendUpdated();

	App.sayToAll(`alive: ${player.tag.alive}`);
});

hidden

player.hidden: Boolean

hidden ๊ฐ’์ด true ์ด๋ฉด, ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด๋Š” ๋‹ค๋ฅธ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

โš ๏ธ hidden์ธ ์ƒํƒœ์—์„œ ๋ชจ์Šต์€ ๋ณด์ด์ง€ ์•Š์ง€๋งŒ, ์˜ค๋””์˜ค์™€ ๋น„๋””์˜ค ์—ฐ๊ฒฐ์€ ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

์บ๋ฆญํ„ฐ์—๊ฒŒ hidden ์†์„ฑ์„ ๋ถ€์—ฌํ•ด์„œ ๋‹ค๋ฅธ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์•ˆ ๋ณด์ด๊ฒŒ ํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	player.hidden = true;
	player.sendUpdated();
});

spotlight

player.spotlight: Boolean

ํ”Œ๋ ˆ์ด์–ด์˜ ์ŠคํŒŸ ๋ผ์ดํŠธ ๊ธฐ๋Šฅ ํ™œ์„ฑํ™” ์—ฌ๋ถ€์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ŠคํŒŸ ๋ผ์ดํŠธ ๊ธฐ๋Šฅ์„ ON/OFF ํ•˜๋Š” ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	if(player.spotlight){
		player.spotlight = false;
	}
	else{
		player.spotlight = true;
	}
	player.sendUpdated();
});

attackType

player.attackType : Number

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ณต๊ฒฉ(Zํ‚ค) ํƒ€์ž…์ž…๋‹ˆ๋‹ค. ( ๊ธฐ๋ณธ: 0 )

attackType์„ค๋ช…

0

attackType์„ ์„ค์ • ํ•˜์ง€ ์•Š์•˜์„ ๋•Œ ๊ธฐ๋ณธ ๊ณต๊ฒฉ ํƒ€์ž…์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

2

์›๊ฑฐ๋ฆฌ ๊ณต๊ฒฉ ํƒ€์ž…์ž…๋‹ˆ๋‹ค. attackParam2์™€ ํ•จ๊ป˜ ์„ค์ •ํ•  ๋•Œ ์œ ํšจํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

์บ๋ฆญํ„ฐ์˜ attackType ๋ณ€๊ฒฝํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	player.attackType = 0;
	App.sayToAll(`attackType: ${player.attackType}`);
	player.sendUpdated();
});

attackParam1

player.attackParam1: Number

๊ณต๊ฒฉ(Zํ‚ค) ์ด๋ฏธ์ง€๊ฐ€ ๋‚ ์•„๊ฐ€๋Š” ๊ฑฐ๋ฆฌ ์†์„ฑ์ž…๋‹ˆ๋‹ค. ๊ณต๊ฒฉ ๊ฐ€๋Šฅ ๊ฑฐ๋ฆฌ๋Š” ๋Š˜์–ด๋‚˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

attackParam1 ๋ณ€๊ฒฝํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	player.attackType = 0;
	player.attackParam1 = 10;
	App.sayToAll(`attackType: ${player.attackType}`);
	App.sayToAll(`attackParam1: ${player.attackParam1}`);
	player.sendUpdated();
});

attackParam2

player.attackParam2: Number

๊ณต๊ฒฉ ๊ฐ€๋Šฅ ๊ฑฐ๋ฆฌ ์†์„ฑ์ž…๋‹ˆ๋‹ค. attackType์ด ์›๊ฑฐ๋ฆฌ ๊ณต๊ฒฉ์œผ๋กœ ์„ค์ • ๋œ ๊ฒฝ์šฐ์—๋งŒ ์œ ํšจํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

attackParam2 ์ด์šฉํ•ด ์›๊ฑฐ๋ฆฌ ๊ณต๊ฒฉ ์„ค์ • ํ•ด๋ณด๊ธฐ.

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	player.attackType = 2;
	player.attackParam2 = 5;
	App.sayToAll(`attackType: ${player.attackType}`);
	App.sayToAll(`attackParam2: ${player.attackParam2}`);
	player.sendUpdated();
});

attackSprite

player.attackSprite : ScriptDynamicResource

๊ณต๊ฒฉ(Zํ‚ค) ์ด๋ฏธ์ง€๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

๊ณต๊ฒฉ ์ด๋ฏธ์ง€ ์ ์šฉํ•ด๋ณด๊ธฐ

// ๋‹จ์ผ ์ด๋ฏธ์ง€์˜ ๊ฒฝ์šฐ
let redBoxing = App.loadSpritesheet("redBoxing.png");
App.onJoinPlayer.Add(function (player) {
	player.attackSprite = redBoxing;
	player.sendUpdated();
});
// ์—ฐ์†๋œ ์ด๋ฏธ์ง€์˜ ๊ฒฝ์šฐ
let attackSprite = App.loadSpritesheet("attack_sprite.png", 32, 32, [0, 1, 2], 3);
App.onJoinPlayer.Add(function (player) {
	player.attackSprite = attackSprite;
	player.sendUpdated();
});
// ๋ฐฉํ–ฅ๋ณ„ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•˜๋Š”๊ฒฝ์šฐ
let attackSprite = App.loadSpritesheet(
    "animation_sprite.png", // ์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช…
    48, 48, // ์ด๋ฏธ์ง€ ํ”„๋ ˆ์ž„ ์‚ฌ์ด์ฆˆ
    {
        left: [0, 1, 2, 3, 4, 5], // ์ขŒ์ธก์„ ๋ณด๊ณ  ๊ณต๊ฒฉํ•˜๋Š” ๊ฒฝ์šฐ
        right: [6, 7, 8, 9, 10, 11], // ์šฐ์ธก์„ ๋ณด๊ณ  ๊ณต๊ฒฉํ•˜๋Š” ๊ฒฝ์šฐ
        down: [12, 13, 14, 15, 16, 17], // ์œ„๋ฅผ ๋ณด๊ณ  ๊ณต๊ฒฉํ•˜๋Š” ๊ฒฝ์šฐ
        up: [18, 19, 20, 21, 22, 23], // ์•„๋ž˜๋ฅผ ๋ณด๊ณ  ๊ณต๊ฒฉํ•˜๋Š” ๊ฒฝ์šฐ
    },
    6
);
App.onJoinPlayer.Add(function (player) {
	player.attackSprite = attackSprite;
	player.sendUpdated();
});

walletAddress

player.walletAddress : String

ํ”Œ๋ ˆ์ด์–ด์˜ ์ „์ž์ง€๊ฐ‘ ์ฃผ์†Œ์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

์ „์ž์ง€๊ฐ‘ ์ฃผ์†Œ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ ( ์ „์ž์ง€๊ฐ‘ ์ฃผ์†Œ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ null์ด ์ถœ๋ ฅ )

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	App.sayToAll(`${player.walletAddress}`)
});

storage

player.storage : String

์ŠคํŽ˜์ด์Šค ๋‚ด์˜ Player ๊ฐ’ ์ €์žฅ ๊ณต๊ฐ„ ์ž…๋‹ˆ๋‹ค (์ŠคํŽ˜์ด์Šค ํ•œ์ •)

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด storage์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ , ํ™•์ธํ•ด๋ณด๊ธฐ

๐Ÿ’ก ์•ฑ์„ ์ข…๋ฃŒํ–ˆ๋‹ค๊ฐ€ ๋‹ค์‹œ ์ผœ๋„ ์ €์žฅ๋œ ๊ฐ’์ด ์‚ฌ๋ผ์ง€์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	player.storage = "data";
	player.save(); // storage์˜ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด player.save()๋กœ ๋ณ€๊ฒฝ๊ฐ’์„ ์ ์šฉ
})

// w ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(87,function(player){
	App.sayToAll(player.storage); // player storage์— ์ €์žฅ๋œ ๊ฐ’์„ ์ฑ„ํŒ…์ฐฝ์— ์ถœ๋ ฅ
})

isMobile

player.isMobile : Boolean

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ชจ๋ฐ”์ผ ์ ‘์† ์—ฌ๋ถ€๋ฅผ true/false ๋กœ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅ ํ•  ๋•Œ ์ž…์žฅ๋ฉ”์‹œ์ง€์— ๋ชจ๋ฐ”์ผ/PC ํ‘œ์‹œํ•ด๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){	
	if(player.isMobile){
		App.sayToAll(`${player.name}๋‹˜์ด ๋ชจ๋ฐ”์ผ์—์„œ ์ ‘์†ํ–ˆ์Šต๋‹ˆ๋‹ค.`)	
	} else{
		App.sayToAll(`${player.name}๋‹˜์ด PC์—์„œ ์ ‘์†ํ–ˆ์Šต๋‹ˆ๋‹ค.`)
	}
});

isMoving

player.isMoving : Boolean

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์›€์ง์ด๊ณ  ์žˆ์œผ๋ฉด True, ์•„๋‹ˆ๋ฉด False๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด์˜ ์›€์ง์ž„์„ ๊ฐ์ง€ํ•ด์„œ ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ.

App.onUpdate.Add(function (dt) {
	let _players = App.players;
	for (let i in _players) {
		let p = _players[i];
		if (p.isMoving) {
			App.sayToAll(`${p.name}๋‹˜์ด ์›€์ง์ด๋Š” ์ค‘..`);
		}
	}
});

isJumping

player.isJumping : Boolean

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ ํ”„ํ•˜๊ณ  ์žˆ์œผ๋ฉด True, ์•„๋‹ˆ๋ฉด False๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด์˜ ์ ํ”„๋ฅผ ๊ฐ์ง€ํ•ด์„œ ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ.

App.onUpdate.Add(function (dt) {
	let _players = App.players;
	for (let i in _players) {
		let p = _players[i];
		if (p.isJumping) {
			App.sayToAll(`[์‹œ์Šคํ…œ] ${p.name}๋‹˜์ด ์ ํ”„ ์ค‘..`);
		}
	}
});

customData

player.customData : String

URL ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์œผ๋กœ ์ „๋‹ฌ ๋ฐ›์€ ๊ฐ’์„ ์ €์žฅํ•˜๋Š” ํ•„๋“œ์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

๐Ÿ”ฅ URL ์ฟผ๋ฆฌ์ŠคํŠธ๋ง ํ™œ์šฉํ•˜๊ธฐ

displayRatio

player.displayRatio

ํ”Œ๋ ˆ์ด์–ดํ™”๋ฉด์˜ ์คŒ์„ ์ปจํŠธ๋กค ํ•˜๋Š” ๊ฐ’ ( ๊ธฐ๋ณธ ๊ฐ’: 1 )

์˜ˆ์ œ

ํ™”๋ฉด์˜ ์คŒ์„ ์ปจํŠธ๋กค ํ•˜๋Š” ํ‚ค ๋งŒ๋“ค์–ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// ํ•œ ๋ฒˆ ๋ˆ„๋ฅด๋ฉด ํ™”๋ฉด์˜ ์คŒ ๊ฐ’์ด ์ปค์ง€๊ณ , ํ•œ ๋ฒˆ ๋” ๋ˆ„๋ฅด๋ฉด ์›๋ž˜๋Œ€๋กœ ๋Œ์•„์˜ค๋Š” ํ‚ค ํ•จ์ˆ˜ 
App.addOnKeyDown(81,function(player){
	if(player.displayRatio == 1){
		player.displayRatio = 5;
	}else{
		player.displayRatio = 1;
	}
	player.sendUpdated(); //* player์˜ Field๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด player.sendUpdated()๋กœ ๋ณ€๊ฒฝ๊ฐ’์„ ์ ์šฉ
})

titleColor

player.titleColor

ํ”Œ๋ ˆ์ด์–ด์˜ ํƒ€์ดํ‹€ ์ƒ‰์ƒ์„ ์ฝ๊ฑฐ๋‚˜ ์ˆ˜์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Enum ๊ฐ’ ๋˜๋Š” ์ปฌ๋Ÿฌ Hex Code ๊ฐ’์„ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ Enum ColorType
{ WHITE, BLACK, RED, GREEN, BLUE, ORANGE, PURPLE, GRAY, YELLOW, MAGENTA, CYAN }

์˜ˆ์ œ

ํƒ€์ดํ‹€ ์ƒ‰์ƒ ๋ฐ”๊ฟ”๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	player.title = "๐Ÿ”ธTitle๐Ÿ”ธ";
	// Enum ๊ฐ’์œผ๋กœ ์ž…๋ ฅํ•˜๋Š” ๊ฒฝ์šฐ
	player.titleColor = ColorType.CYAN;
	
	// Hex Code๋กœ ์ž…๋ ฅํ•˜๋Š” ๊ฒฝ์šฐ (์ฃผ์„์„ ํ•ด์ œํ•ด์ฃผ์„ธ์š”)
	// player.titleColor = 0x00FFFF;
	
	player.sendUpdated(); //* player์˜ Field๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด player.sendUpdated()๋กœ ๋ณ€๊ฒฝ๊ฐ’์„ ์ ์šฉ
});

emailHash

player.emailHash

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ Hash ๊ฐ’์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ Hash ๊ฐ’ ์ถœ๋ ฅํ•˜๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){
  App.sayToAll(`name: ${player.name} emailHash: ${player.emailHash}`);
})

isGuest

player.isGuest

๋น„๋กœ๊ทธ์ธ ํ”Œ๋ ˆ์ด์–ด์ธ ๊ฒฝ์šฐ true ๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

์˜ˆ์ œ

๋น„๋กœ๊ทธ์ธ ์œ ์ € ์ž…์žฅ์‹œ ํƒ€์ดํ‹€์— "GUEST" ํ‘œ์‹œํ•˜๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){
  if(player.isGuest){
    player.title = "GUEST";
    player.sendUpdated();
  }
})

language

player.language

๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์–ธ์–ด ์„ค์ •๊ฐ’์— ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

ํ•œ๊ตญ์–ด "ko", ์ผ๋ณธ์–ด: "ja", ์˜์–ด: "en"

์˜ˆ์ œ

์œ ์ € ์ž…์žฅ์‹œ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉ ํ•˜๋Š” ์–ธ์–ด ์„ค์ • ๊ฐ’ ํ‘œ์‹œํ•˜๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.onJoinPlayer.Add(function(player){
  App.sayToAll(player.language);
})

away

player.away

์žฅ์‹œ๊ฐ„ ๋น„ํ™œ์„ฑํ™”๋œ ์œ ์ €์ธ ๊ฒฝ์šฐ true๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

enableFreeView

player.enableFreeView

ํ”Œ๋ ˆ์ด์–ด์˜ ๋งต ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

๋‹จ์ถ•ํ‚ค๋กœ ํ”Œ๋ ˆ์ด์–ด์˜ ๋งต ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ ์—ฌ๋ถ€ ์„ค์ •ํ•˜๊ธฐ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	if (player.enableFreeView) {
		player.enableFreeView = false;
	} else {
		player.enableFreeView = true;
	}
	player.sendUpdated();
	player.sendMessage(`player.enableFreeView = ${player.enableFreeView}`, 0x00ffff);
});

Last updated