Methods

์†Œ๊ฐœ

Map์— ํƒ€์ผ ํšจ๊ณผ๋‚˜ ์˜ค๋ธŒ์ ํŠธ ์„ค์น˜ ๋“ฑ ๋งต๊ณผ ๊ด€๋ จ๋œ ํŽธ๋ฆฌํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ํ•จ์ˆ˜๋“ค ์ž…๋‹ˆ๋‹ค.

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

putTileEffect

์ง€์ •ํ•œ ์ขŒํ‘œ์— ํƒ€์ผ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค

putObject

์ง€์ •ํ•œ ์ขŒํ‘œ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

putObjectMultiple

์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐฐ์น˜ํ•  ์ขŒํ‘œ๋“ค์„ 2์ฐจ์› ๋ฐฐ์—ด๋กœ ์ž…๋ ฅํ•˜์—ฌ ํ•œ ๋ฒˆ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.

putObjectWithKey

์ง€์ •ํ•œ ์ขŒํ‘œ์— ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getObjectWithKey

ํ•ด๋‹น ํ‚ค ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

playObjectAnimation

ํ•ด๋‹น ์ขŒํ‘œ์— ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

playObjectAnimationWithKey

key ๊ฐ’์ด ์ผ์น˜ํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

moveObject

x, y ์ขŒํ‘œ์— ์œ„์น˜ํ•œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ง€์ •ํ•œ x, y ์ขŒํ‘œ๋กœ time ์ดˆ ๋™์•ˆ ์›€์ง์ด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

moveObjectWithKey

ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ง€์ •ํ•œ x,y ์ขŒํ‘œ๋กœ ์›€์ง์ด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

clearAllObjects

ZEP ์Šคํฌ๋ฆฝํŠธ๋กœ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getTile

ํ•ด๋‹นํ•˜๋Š” ๋ ˆ์ด์–ด์˜ x,y ์ขŒํ‘œ์— ์žˆ๋Š” ํƒ€์ผ์˜ enum ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

hasLocation

๋งต์— ํ•ด๋‹น ๋กœ์ผ€์ด์…˜์ด ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜์—ฌ true/false๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getObjectsByType

Type์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getTopObjectsByType

Type์— ํ•ด๋‹นํ•˜๋Š” ์ƒ๋‹จ ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

sayObjectWithKey

key ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ ์œ„์— ๋งํ’์„ ์„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getLocation

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•œ ๋กœ์ผ€์ด์…˜์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ๋กœ์ผ€์ด์…˜ ์„ค์น˜ ์ขŒํ‘œ๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

getLocationRandom

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•œ ๋กœ์ผ€์ด์…˜์ด 2๊ฐœ์ด์ƒ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ๋ฌด์ž‘์œ„๋กœ ์„ ํƒํ•˜์—ฌ ํ•ด๋‹น ๋กœ์ผ€์ด์…˜์˜ ์„ค์น˜ ์ขŒํ‘œ๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

getLocationList

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌ๋œ ๋กœ์ผ€์ด์…˜ ์ด๋ฆ„๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋กœ์ผ€์ด์…˜์˜ ์ •๋ณด๋ฅผ ๋ฐฐ์—ด ํ˜•ํƒœ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค

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

Methods ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ์ง€์ •๋œ ์ขŒํ‘œ์— ํƒ€์ผํšจ๊ณผ๋ฅผ ์ ์šฉ
Map.putTileEffect(x: number, y: number, tileID: TileEffectType)

// ์ง€์ •๋œ ์ขŒํ‘œ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“์Œ (๊ธฐ์ค€ ์ขŒํ‘œ : Left-Top)
Map.putObject(x: number, y: number, dynamicResource: ScriptDynamicResource)

// ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐฐ์น˜ํ•  ์ขŒํ‘œ๋“ค์„ 2์ฐจ์› ๋ฐฐ์—ด๋กœ ์ž…๋ ฅํ•˜์—ฌ ํ•œ ๋ฒˆ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.
Map.putObjectMultiple(tileArray: array, type: PutObjectType, dynamicResource: ScriptDynamicResource, option: object);

// ์ง€์ •๋œ ์ขŒํ‘œ์— ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“์Œ (๊ธฐ์ค€ ์ขŒํ‘œ : Left-Top)
Map.putObjectWithKey(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)

// ํ•ด๋‹น ์ขŒํ‘œ์— ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ด (putObject๊ฐ€ ์„ ํ–‰๋˜์–ด์•ผ ํ•จ)
Map.playObjectAnimation(x: number, y: number, name: string, loop: number)

// key ๊ฐ’์ด ์ผ์น˜ํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
Map.playObjectAnimationWithKey(key: string,) animName: string, repeatCount: number)

// ZEP ์Šคํฌ๋ฆฝํŠธ๋กœ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ œ๊ฑฐ
Map.clearAllObjects()

// ํ•ด๋‹น ์ขŒํ‘œ์˜ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ํƒ€๊ฒŸ ์ขŒํ‘œ๋กœ time(์ดˆ) ๋™์•ˆ ์ด๋™
Map.moveObject(x: number, y: number, targetX: number, targetY: number, time: number)

// ํ•ด๋‹น ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ํƒ€๊ฒŸ ์ขŒํ‘œ๋กœ ์ด๋™
Map.moveObjectWithKey(key: string, targetX: number, targetY: number, usePath:Boolean= true, time=0 )

// ํ•ด๋‹นํ•˜๋Š” ๋ ˆ์ด์–ด์˜ x, y ์ขŒํ‘œ์— ์žˆ๋Š” ํƒ€์ผ์˜ ํƒ€์ž… ๊ฐ’์„ ๋ฆฌํ„ด
Map.getTile(layer: number, x: number, y: number)

// ๋งต์— ํ•ด๋‹นํ•˜๋Š” ๋กœ์ผ€์ด์…˜์ด ์žˆ๋Š”์ง€ true/false ๊ฐ’์œผ๋กœ ๋ฆฌํ„ด
Map.hasLocation(locationName: string)

// Type์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
Map.getObjectsByType(type: number)

// Type์— ํ•ด๋‹นํ•˜๋Š” ์ƒ๋‹จ ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
Map.getTopObjectsByType(type: number)

// key ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ ์œ„์— ๋งํ’์„ ์„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
Map.sayObjectWithKey( key: string, message: string )

putTileEffect

Map.putTileEffect(x: number, y: number, tileID: TileEffectType)

์ง€์ •ํ•œ ์ขŒํ‘œ์— ํƒ€์ผ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

TileEffectType์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์„ค๋ช…์€ TileEffectType ์ƒ์„ธ ์„ค๋ช… ํŽ˜์ด์ง€๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”.

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

x, y

Number

ํƒ€์ผ ํšจ๊ณผ๋ฅผ ์„ค์น˜ํ•  x, y ์ขŒํ‘œ

tileID

TileEffectType

โ€ข TileEffectType.NONE : ์—†์Œ โ€ขTileEffectType.IMPASSABLE : ํ†ต๊ณผ ๋ถˆ๊ฐ€ โ€ข TileEffectType.SPAWN : ์Šคํฐ

โ€ข TileEffectType.PORTAL : ํฌํ„ธ โ€ข TileEffectType.PRIVATE_AREA : ํ”„๋ผ์ด๋น— ๊ณต๊ฐ„ โ€ข TileEffectType.SPOTLIGHT : ์ŠคํฌํŠธ๋ผ์ดํŠธ โ€ข TileEffectType.EMBED : ์›น ๋งํฌ โ€ข TileEffectType.LOCATION : ์ง€์ • ์˜์—ญ โ€ข TileEffectType.AMBIENT_SOUND : ๋ฐฐ๊ฒฝ ์Œ์•… โ€ข TileEffectType.TILE_EMBED : ์›น ์ž„๋ฒ ๋“œ โ€ข TileEffectType.WEB_PORTAL : ์›น ํฌํ„ธ โ€ข TileEffectType.SPACE_PORTAL : ์ŠคํŽ˜์ด์Šค ํฌํ„ธ

์˜ˆ์ œ

IMPASSABLE ํƒ€์ผ ํšจ๊ณผ ์„ค์น˜ํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	// 5, 5 ์ขŒํ‘œ์— IMPASSABLE ํƒ€์ผ ํšจ๊ณผ ์„ค์น˜
	Map.putTileEffect(5, 5, TileEffectType.IMPASSABLE);
});

putObject

Map.putObject(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)

์ง€์ •ํ•œ ์ขŒํ‘œ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ( ๊ธฐ์ค€ ์ขŒํ‘œ: Left Top ) โ†’ ๊ธฐ์ค€ ์ขŒํ‘œ๋ž€?

ScriptDynamicResource์— ๋Œ€ํ•œ ์ดํ•ด๋ฅผ ๋•๋Š” ์Šคํ”„๋ผ์ดํŠธ์‹œํŠธ ์ดํ•ดํ•˜๊ธฐ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!

null ๊ฐ’์„ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•˜์—ฌ ์Šคํฌ๋ฆฝํŠธ๋กœ ์„ค์น˜ํ•œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ญ์ œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Map.putObject(x, y, null);

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

x, y

Number

์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“์„ x, y ์ขŒํ‘œ

dynamicResource

ScriptDynamicResource

App.loadSpritesheet ํ•จ์ˆ˜๋กœ ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€

option

Object

onObjectTouched, onObjectAttacked ์™€ ๊ฐ™์€ App EventListener์—์„œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ธ์‹ํ•˜๋ ค๋ฉด ํŒŒ๋ผ๋ฏธํ„ฐ ๋ž€์— { overlap: true } ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

๋ธ”๋ฃจ๋งจ ์˜ค๋ธŒ์ ํŠธ ์ƒ์„ฑํ•ด๋ณด๊ธฐ

// blueman.png๋ฅผ ๊ฐ์ฒดํ™” ํ•˜์—ฌ blueman ๋ณ€์ˆ˜์— ์ €์žฅ
let blueman = App.loadSpritesheet("blueman.png");

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	// 5, 5 ์ขŒํ‘œ์— blueman ์˜ค๋ธŒ์ ํŠธ ์ƒ์„ฑ
	Map.putObject(5, 5, blueman, {overlap: true});
});
// w ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	// 5, 5 ์ขŒํ‘œ์— ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ญ์ œ
	Map.putObject(5, 5, null);
});

putObjectMultiple

Map.putObjectMultiple(tileArray: array, type: PutObjectType, dynamicResource: ScriptDynamicResource, option: object);

์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐฐ์น˜ํ•  ์ขŒํ‘œ๋“ค์„ 2์ฐจ์› ๋ฐฐ์—ด๋กœ ์ž…๋ ฅํ•˜์—ฌ ํ•œ ๋ฒˆ์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค. ์ด ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ํ•œ ๋ฒˆ์— ๋งŽ์€ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์„ค์น˜ํ•  ๊ฒฝ์šฐ ๋ถ€ํ•˜๋ฅผ ์ค„์ด๋Š” ํšจ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

tileArray

Array

์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐฐ์น˜ํ•  ์ขŒํ‘œ๋“ค์„ ์ •์˜ํ•  2์ฐจ์› ๋ฐฐ์—ด์„ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (์ตœ๋Œ€ ๊ธธ์ด 10 ์ œํ•œ)

type

PutObjectType

PutObjectType.STROKE

  • tileArray ๋ฐฐ์—ด์— ์ •์˜๋œ ์ขŒํ‘œ๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ์—ฐ๊ฒฐํ•˜์—ฌ ๊ฒฝ๋กœ๋ฅผ ์ƒ์„ฑํ•œ ๋‹ค์Œ, ์ƒ์„ฑ๋œ ๊ฒฝ๋กœ ์ƒ์˜ ๋ชจ๋“  ์ขŒํ‘œ๋“ค์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐฐ์น˜ํ•ฉ๋‹ˆ๋‹ค.

dynamicResource

ScriptDynamicResource

App.loadSpritesheet ํ•จ์ˆ˜๋กœ ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€

option

Object

onObjectTouched, onObjectAttacked ์™€ ๊ฐ™์€ App EventListener์—์„œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ธ์‹ํ•˜๋ ค๋ฉด ํŒŒ๋ผ๋ฏธํ„ฐ ๋ž€์— { overlap: true } ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

์‚ฌ๊ฐํ˜•, ์› ๋ชจ์–‘์œผ๋กœ ์˜ค๋ธŒ์ ํŠธ ๋ฐฐ์น˜ํ•˜๊ธฐ

const _mark = App.loadSpritesheet("mark.png");

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜ - ์‚ฌ๊ฐํ˜• ๋ชจ์–‘์œผ๋กœ ๋ฐฐ์น˜
App.addOnKeyDown(81, function (player) {
	const tileArray = [
		[5, 5],
		[9, 5],
		[9, 9],
		[5, 9],
		[5, 5],
	];
	Map.putObjectMultiple(tileArray, PutObjectType.STROKE, _mark, { overlap: true });
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜ - ์› ๋ชจ์–‘์œผ๋กœ ๋ฐฐ์น˜
App.addOnKeyDown(87, function (player) {
	const tileArray = [
		[10, 5],
		[8, 7],
		[8, 10],
		[10, 12],
		[13, 12],
		[15, 10],
		[15, 7],
		[13, 5],
		[10, 5],
	];
	Map.putObjectMultiple(tileArray, PutObjectType.STROKE, _mark, { overlap: true });
});

putObjectWithKey

Map.putObjectWithKey(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)

์ง€์ •ํ•œ ์ขŒํ‘œ์— ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ( ๊ธฐ์ค€ ์ขŒํ‘œ: Left Top )

dynamicResource ํŒŒ๋ผ๋ฏธํ„ฐ์— null ์ž…๋ ฅ์‹œ ํ•ด๋‹น ์ขŒํ‘œ์˜ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ด€๋ จ ๋ฌธ์„œ: ์˜ค๋ธŒ์ ํŠธ npcProperty

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

x, y

Number

์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋†“์„ x, y ์ขŒํ‘œ

dynamicResource

ScriptDynamicResource

App.loadSpritesheet ํ•จ์ˆ˜๋กœ ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€

์˜ต์…˜ (option)

๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ Default ๊ฐ’์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

์˜ค๋ธŒ์ ํŠธ์˜ ํ‚ค ๊ฐ’ (Default: null)

moveSpeed

Number

์˜ค๋ธŒ์ ํŠธ์˜ ์ด๋™์†๋„

(Default: 80)

useDirAnim

Boolean

๋ฐฉํ–ฅ์„ ์ธ์ง€ํ•ด์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์žฌ์ƒํ•˜๋Š” ์˜ต์…˜ (Default: false)

impassable

Boolean

์˜ค๋ธŒ์ ํŠธ ํ†ต๊ณผ๋ถˆ๊ฐ€ ์˜ต์…˜ (Default: false)

offsetX

Number

์˜ค๋ธŒ์ ํŠธ ์ด๋ฏธ์ง€์˜ ๋ฐฐ์น˜ ๊ธฐ์ค€์ ์˜ X์ขŒํ‘œ (Default: 0)

offsetY

Number

์˜ค๋ธŒ์ ํŠธ ์ด๋ฏธ์ง€์˜ ๋ฐฐ์น˜ ๊ธฐ์ค€์ ์˜ Y์ขŒํ‘œ (Default: 0)

npcProperty

Object

npcProperty ๊ด€๋ จ ๋‚ด์šฉ์€ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”. (Default: null)

์˜ˆ์ œ

ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ๋ธ”๋ฃจ๋งจ ์˜ค๋ธŒ์ ํŠธ ์ƒ์„ฑํ•ด๋ณด๊ธฐ

let blueman = App.loadSpritesheet("blueman.png");
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	Map.putObjectWithKey(18, 6, blueman, {
		type:21, // zep-script ์ƒํ˜ธ์ž‘์šฉ ์˜ค๋ธŒ์ ํŠธ
		overlap: true, // ์ถฉ๋Œ ์ด๋ฒคํŠธ ๊ฐ์ง€
		movespeed: 100, // ์ด๋™์†๋„, ๊ธฐ๋ณธ๊ฐ’: 80
		key: "TestBlueMan", // ํ‚ค ๊ฐ’
		impassalbe:true, // ํ†ต๊ณผ ๋ถˆ๊ฐ€ ์˜ค๋ธŒ์ ํŠธ ์„ค์ •
		useDirAnim: true, // ๋ฐฉํ–ฅ์„ ์ธ์ง€ํ•ด์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์žฌ์ƒํ•˜๋Š” ์˜ต์…˜
        	offsetX: -8, // ์˜ค๋ธŒ์ ํŠธ ์ด๋ฏธ์ง€์˜ ๋ฐฐ์น˜ ๊ธฐ์ค€์ ์˜ X์ขŒํ‘œ๋ฅผ ์กฐ์ •
              	offsetY: -32,// ์˜ค๋ธŒ์ ํŠธ ์ด๋ฏธ์ง€์˜ ๋ฐฐ์น˜ ๊ธฐ์ค€์ ์˜ Y์ขŒํ‘œ๋ฅผ ์กฐ์ •
	});
});

// w ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(87, function (player) {
	// ์˜ค๋ธŒ์ ํŠธ ์‚ญ์ œ
	Map.putObjectWithKey(18, 6, null, {
		key: "TestBlueMan", // ํ‚ค ๊ฐ’
	});
});

getObjectWithKey

Map.getObjectWithKey(key: String)

ํ•ด๋‹น ํ‚ค ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์˜ค๋ธŒ์ ํŠธ์˜ key ๊ฐ’

์˜ˆ์ œ

ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ๊ด€๋ จ ๋ฐ์ดํ„ฐ๋ฅผ ์ฑ„ํŒ…์ฐฝ์— ์ถœ๋ ฅํ•ด๋ณด๊ธฐ.

let blueman = App.loadSpritesheet("blueman.png");
App.onStart.Add(function() {
	Map.putObjectWithKey(18, 6, blueman, {
		overlap: true,
		movespeed: 80,
		key: "TestBlueMan", // ํ‚ค ๊ฐ’
	});
});
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	let object_blueman = Map.getObjectWithKey("TestBlueMan");
	for(let data in object_blueman){
		App.sayToAll(`${data}: ${object_blueman[data]}`)
	}
})

playObjectAnimation

Map.playObjectAnimation(x: number, y: number, name: string, loop: number)

ํ•ด๋‹น ์ขŒํ‘œ์— ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํ•ด๋‹น ์ขŒํ‘œ ์ง€์ ์— Map.putObject ํ•จ์ˆ˜๊ฐ€ ์„ ํ–‰๋˜์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

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

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

x, y

Number

ํƒ€์ผ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•  x, y ์ขŒํ‘œ

name

String

let ๋ณ€์ˆ˜ = App.loadSpritesheet(...) ์Šคํ”„๋ผ์ดํŠธ๋ฅผ ์ €์žฅํ•œ ๋ณ€์ˆ˜ ์ด๋ฆ„์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. โ†’ โ€˜#โ€™ + ๋ณ€์ˆ˜.id

loop

number

์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฐ˜๋ณต ํšŸ์ˆ˜ ( -1: ๊ณ„์†๋ฐ˜๋ณต)

์˜ˆ์ œ

์ถค์ถ”๋Š” ๋ธ”๋ฃจ๋งจ ์˜ค๋ธŒ์ ํŠธ ์„ค์น˜ํ•ด๋ณด๊ธฐ

// ํ•œ ํ”„๋ ˆ์ž„์˜ ์‚ฌ์ด์ฆˆ 48x64
let blueman_dance = App.loadSpritesheet(
	"blueman.png",
	48,
	64,
	[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37], // 21๋ฒˆ์งธ ~ 38๋ฒˆ์งธ ์ด๋ฏธ์ง€๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌ์„ฑ
	8
);
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	Map.putObject(5, 5, blueman_dance, { overlap: true });
	Map.playObjectAnimation(5, 5, "#" + blueman_dance.id, -1);
});

playObjectAnimationWithKey

Map.playObjectAnimation(key: string, animName: string, repeatCount: number)

key ๊ฐ’์ด ์ผ์น˜ํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ์˜ ์Šคํ”„๋ผ์ดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

Map.putObjectWithKeyํ•จ์ˆ˜๊ฐ€ ์„ ํ–‰๋˜์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

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

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

์˜ค๋ธŒ์ ํŠธ์˜ ํ‚ค๊ฐ’

animName

String

ํ”Œ๋ ˆ์ดํ•  ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ด๋ฆ„

repeatCount

Number

์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฐ˜๋ณต ํšŸ์ˆ˜ ( -1 ์ž…๋ ฅ์‹œ ๋ฌดํ•œ๋ฐ˜๋ณต )

์˜ˆ์ œ

์ถค์ถ”๋Š” ๋ธ”๋ฃจ๋งจ ์˜ค๋ธŒ์ ํŠธ ์„ค์น˜ํ•ด๋ณด๊ธฐ

var blueman_sprite = 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],
		idle: [0],
	},
	8
);

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	Map.putObjectWithKey(10, 10, blueman_sprite, {
		overlap: true,
		movespeed: 80, // default: 80
		key: "blueman",
	});
	// "dance" ์• ๋‹ˆ๋ฉ”์ด์…˜ ์žฌ์ƒ
	Map.playObjectAnimationWithKey("blueman", "dance", -1);
});

moveObject

Map.moveObject(x: number, y: number, targetX: number, targetY: number, time: number)

x, y ์ขŒํ‘œ์— ์œ„์น˜ํ•œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ targetX, targetY๋กœ time ์ดˆ ๋™์•ˆ ์›€์ง์ด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํ•ด๋‹น ์ขŒํ‘œ ์ง€์ ์— Map.putObject ํ•จ์ˆ˜๊ฐ€ ์„ ํ–‰๋˜์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

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

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

x, y

Number

์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์œ„์น˜ํ•œ x, y ์ขŒํ‘œ

targetX, targetY

Number

๋ชฉ์ ์ง€ x, y ์ขŒํ‘œ

time

Number

๋ชฉ์ ์ง€๊นŒ์ง€ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„(์ดˆ)

์˜ˆ์ œ

๋ธ”๋ฃจ๋งจ ์ด๋™์‹œ์ผœ๋ณด๊ธฐ

// ํ•œ ํ”„๋ ˆ์ž„์˜ ์‚ฌ์ด์ฆˆ 48x64
let blueman_right = App.loadSpritesheet(
	"blueman.png",
	48,
	64,
	[10, 11, 12, 13, 14], // 11 ~ 15๋ฒˆ์งธ ์ด๋ฏธ์ง€๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ตฌ์„ฑ
	8
);
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	Map.putObject(5, 5, blueman_right, { overlap: true });
	Map.playObjectAnimation(5, 5, "#" + blueman_right.id, -1);
	Map.moveObject(5, 5, 10, 5, 3) // (5,5)์—์„œ (10,5)๋กœ 3์ดˆ ๋™์•ˆ ์ด๋™
});

moveObjectWithKey

Map.moveObjectWithKey(key: string, targetX: number, targetY: number, usePath:boolean = true)

key ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ targetX, targetY๋กœ ์›€์ง์ด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก path ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ true์ธ ๊ฒฝ์šฐ, ๋ชฉํ‘œ ์ง€์ ์ด impassable ํƒ€์ผ์ด๊ฑฐ๋‚˜ ๋„๋‹ฌ ํ•  ์ˆ˜ ์—†๋Š” ์ขŒํ‘œ์ด๋ฉด ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์›€์ง์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

์˜ค๋ธŒ์ ํŠธ์˜ key ๊ฐ’

targetX, targetY

Number

๋ชฉ์ ์ง€ x, y ์ขŒํ‘œ

usePath

Boolean

true์ผ ๊ฒฝ์šฐ Impassable ํƒ€์ผ์„ ํ†ต๊ณผํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค. false์ผ ๊ฒฝ์šฐ Impassable ํƒ€์ผ์„ ๋ฌด์‹œํ•˜๊ณ  ์ง€๋‚˜๊ฐ‘๋‹ˆ๋‹ค.

์˜ˆ์ œ

moveObejctWithKey ๋™์ž‘ ๋ฐฉ์‹

// ํ•œ ํ”„๋ ˆ์ž„์˜ ์‚ฌ์ด์ฆˆ 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],
}, 10);
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown ์„ค๋ช…(๋งํฌ)
App.addOnKeyDown(81, function (player) {
	Map.putObjectWithKey(18, 6, blueman, {
		overlap: true,
		movespeed: 50, // default: 80
		key: "TestBlueMan",
                useDirAnim: true // ๋ฐฉํ–ฅ์„ ์ธ์ง€ํ•ด์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์žฌ์ƒํ•˜๋Š” ์˜ต์…˜
                offsetX: -8,
                offsetY: -32,
	});
	Map.moveObjectWithKey("TestBlueMan", 10, 10, true);
});

clearAllObjects()

Map.clearAllObjects()

ZEP ์Šคํฌ๋ฆฝํŠธ๋กœ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

  • ์—†์Œ

์˜ˆ์ œ

์ƒ์„ฑ๋œ ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ ์‚ญ์ œํ•˜๊ธฐ

let blueman = App.loadSpritesheet("blueman.png");

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	// 5, 5 ์ขŒํ‘œ๋ถ€ํ„ฐ blueman ์˜ค๋ธŒ์ ํŠธ 5๊ฐœ ์ƒ์„ฑ
	Map.putObject(5, 5, blueman, {overlap: true});
	Map.putObject(6, 5, blueman, {overlap: true});
	Map.putObject(7, 5, blueman, {overlap: true});
	Map.putObject(8, 5, blueman, {overlap: true});
	Map.putObject(9, 5, blueman, {overlap: true});
});

// w ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(87, function (player) {
	// ์Šคํฌ๋ฆฝํŠธ๋กœ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ ์ œ๊ฑฐ
	Map.clearAllObjects();
});

getTile

Map.getTile(layer: number, x: number, y: number)

ํ•ด๋‹นํ•˜๋Š” ๋ ˆ์ด์–ด์˜ x, y ์ขŒํ‘œ์— ์žˆ๋Š” ํƒ€์ผ์˜ ํƒ€์ž… ๊ฐ’์„ ๋ฆฌํ„ด, ํƒ€์ผ์ด ์—†์œผ๋ฉด -1์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

layer

Number

๋ ˆ์ด์–ด์— ํ•ด๋‹นํ•˜๋Š” ๊ฐ’ 0 = Floor (๋ฐ”๋‹ฅํƒ€์ผ), 1 = WALL (๋ฒฝํƒ€์ผ), 2 = TileEffect (ํƒ€์ผํšจ๊ณผ), 3 = Object (์˜ค๋ธŒ์ ํŠธ), 5 = TopObject (์ƒ๋‹จ์˜ค๋ธŒ์ ํŠธ),

x, y

Number

x, y ์ขŒํ‘œ

์˜ˆ์ œ

๋งต์— ์žˆ๋Š” ๋ชจ๋“  ์˜ค๋ธŒ์ ํŠธ์˜ ํƒ€์ž…์„ ์กฐํšŒํ•˜๊ธฐ

const LayerType = {
	FLOOR: 0,
	WALL: 1,
	TILE_EFFECTS: 2,
	OBJECTS: 3,
	TOP_OBJECTS: 5,
};
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	let layer = LayerType.OBJECTS;
	for (let x = 0; x < Map.width; x++) {
		for (let y = 0; y < Map.height; y++) {
			let data = Map.getTile(layer, x, y);
			if (data >= 0) {
				App.sayToAll(`(${x},${y})  type: ${data}`);
			}
		}
	}
});

getLocation

Map.getLocation(locationName: string)

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•œ ๋กœ์ผ€์ด์…˜์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ๋กœ์ผ€์ด์…˜ ์„ค์น˜ ์ขŒํ‘œ๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

locationName

String

๋กœ์ผ€์ด์…˜ ์ด๋ฆ„

์˜ˆ์ œ

๋งต ์—๋””ํ„ฐ์—์„œ ํƒ€์ผํšจ๊ณผ > ์ง€์ • ์˜์—ญ ์„ ํƒ ํ›„ ์˜์—ญ ์ด๋ฆ„์„ "testLocation" ์œผ๋กœ ์ง€์ •ํ•ด ๋งต์— ์„ค์น˜ํ•œ ํ›„ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ด๋ณด์„ธ์š”.

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
    const targetLocationName = "testLocation";
    const targetLocation = Map.getLocation(targetLocationName);
    
    if(targetLocation) {
        player.sendMessage(`targetLocation placed at (${targetLocation.x}, ${targetLocation.y})`)
    } else {
        player.sendMessage(`${targetLocationName} is not exist!`)
    }
});

getLocationRandom

Map.getLocationRandom(locationName: string)

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•œ ๋กœ์ผ€์ด์…˜์ด 2๊ฐœ์ด์ƒ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ๋ฌด์ž‘์œ„๋กœ ์„ ํƒํ•˜์—ฌ ํ•ด๋‹น ๋กœ์ผ€์ด์…˜์˜ ์„ค์น˜ ์ขŒํ‘œ๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

locationName

String

๋กœ์ผ€์ด์…˜ ์ด๋ฆ„

์˜ˆ์ œ

๋งต ์—๋””ํ„ฐ์—์„œ ํƒ€์ผํšจ๊ณผ > ์ง€์ • ์˜์—ญ ์„ ํƒ ํ›„ ์˜์—ญ ์ด๋ฆ„์„ "testLocation" ์œผ๋กœ ์ง€์ •ํ•ด ๋งต์— ์—ฌ๋Ÿฌ๊ฐœ ์„ค์น˜ํ•œ ํ›„ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ด๋ณด์„ธ์š”.

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
    const targetLocationName = "testLocation";
    const targetLocation = Map.getLocationRandom(targetLocationName);
    
    if(targetLocation) {
        player.sendMessage(`targetLocation placed at (${targetLocation.x}, ${targetLocation.y})`)
    } else {
        player.sendMessage(`${targetLocationName} is not exist!`)
    }
});

getLocationList

Map.getLocationList(locationName: string): Array

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌ๋œ ๋กœ์ผ€์ด์…˜ ์ด๋ฆ„๊ณผ ์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋กœ์ผ€์ด์…˜์˜ ์ •๋ณด๋ฅผ ๋ฐฐ์—ด ํ˜•ํƒœ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ๊ฐ์˜ ๋กœ์ผ€์ด์…˜ ์ •๋ณด๋Š” ๋กœ์ผ€์ด์…˜ ์„ค์น˜ ์ขŒํ‘œ(x, y), ํฌ๊ธฐ(width, height), ๊ทธ๋ฆฌ๊ณ  ๋ผ๋ฒจ ๊ฐ’(label)์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

locationName

String

๋กœ์ผ€์ด์…˜ ์ด๋ฆ„

์˜ˆ์ œ

๋งต ์—๋””ํ„ฐ์—์„œ ํƒ€์ผํšจ๊ณผ > ์ง€์ • ์˜์—ญ ์„ ํƒ ํ›„ ์˜์—ญ ์ด๋ฆ„์„ "testLocation" ์œผ๋กœ ์ง€์ •ํ•ด ๋งต์— ์—ฌ๋Ÿฌ๊ฐœ ์„ค์น˜ํ•œ ํ›„ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ด๋ณด์„ธ์š”.

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	const targetLocationName = "testLocation";
	const targetLocationList = Map.getLocationList(targetLocationName);

	if (targetLocationList) {
		for (const location of targetLocationList) {
			player.sendMessage(`${JSON.stringify(location)}`);
		}
	} else {
		player.sendMessage(`${targetLocationName} is not exist!`);
	}
});

hasLocation

Map.hasLocation(locationName: String): Boolean

๋งต์— ํ•ด๋‹น ๋กœ์ผ€์ด์…˜์ด ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜์—ฌ true/false ๊ฐ’์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

locationName

String

๋กœ์ผ€์ด์…˜ ์ด๋ฆ„

์˜ˆ์ œ

๋กœ์ผ€์ด์…˜์ด ์„ค์น˜๋˜์–ด์žˆ๋Š”์ง€ ์ฒดํฌํ•˜๋Š” ํ‚ค ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	if(Map.hasLocation("test")){
		App.sayToAll("test ๋กœ์ผ€์ด์…˜์ด ์„ค์น˜๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.")
	} else {
		App.sayToAll("test ๋กœ์ผ€์ด์…˜์ด ์„ค์น˜๋˜์–ด์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.")
	}
});

getObjectsByType

Map.getObjectsByType(type: numer) : Array

Type์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

type

Number

์˜ค๋ธŒ์ ํŠธ์˜ type ๊ฐ’

์˜ˆ์ œ

๋ชจ๋“  ํƒ€์ž…์˜ ์˜ค๋ธŒ์ ํŠธ ์กฐํšŒํ•˜๊ธฐ

const ObjectEffectType = {
    NONE = 0,
    SHOW_NOTE = 1,
    SHOW_IMAGE = 2,
    PASSWORD_DOOR = 3,
    LINK_WEBSITE = 4,
    EMBED_WEBSITE = 5,
    API_CALL = 6,
    REPLACE_IMAGE = 7,
    NFT_GIVEAWAY = 8,
    NFT_DOOR = 9,
    POST_MESSAGE = 10,
    SHOW_CHAT_BALLOON = 11,
    FT_DOOR = 12,
    POST_MESSAGE_TO_APP = 13,
    DONATION_DOOR = 14,
    IMPASSABLE = 15,
    STAMP = 16,
    TOKEN_DONATION_DOOR = 17,
    CHANGE_OBJECT = 18,
    ANIMATION = 19,
    NFT_DOOR_MOVE = 20,
    INTERACTION_WITH_ZEPSCRIPTS = 21,
    MULTIPLE_CHOICE = 22,
}
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81,function(player){
    for(let key in ObjectEffectType){
        let type = ObjectEffectType[key];
        let arr = Map.getObjectsByType(type);
        let index = 0;
        for(let obj of arr){
            for(let key in obj){
                App.sayToAll(`${key}: ${obj[key]}`);        
            }
        }
    }
})

getTopObjectsByType

Map.getTopObjectsByType(type: numer) : array

Type์— ํ•ด๋‹นํ•˜๋Š” ์ƒ๋‹จ์˜ค๋ธŒ์ ํŠธ๋“ค์„ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

type

Number

์˜ค๋ธŒ์ ํŠธ์˜ type ๊ฐ’

์˜ˆ์ œ

๋ชจ๋“  ํƒ€์ž…์˜ ์ƒ๋‹จ์˜ค๋ธŒ์ ํŠธ ์กฐํšŒํ•˜๊ธฐ

const ObjectEffectType = {
    NONE : 0,
    SHOW_NOTE : 1,
    SHOW_IMAGE : 2,
    PASSWORD_DOOR : 3,
    LINK_WEBSITE : 4,
    EMBED_WEBSITE : 5,
    API_CALL : 6,
    REPLACE_IMAGE : 7,
    NFT_GIVEAWAY : 8,
    NFT_DOOR : 9,
    POST_MESSAGE : 10,
    SHOW_CHAT_BALLOON : 11,
    FT_DOOR : 12,
    POST_MESSAGE_TO_APP : 13,
    DONATION_DOOR : 14,
    IMPASSABLE : 15,
    STAMP : 16,
    TOKEN_DONATION_DOOR : 17,
    CHANGE_OBJECT : 18,
    ANIMATION : 19,
    NFT_DOOR_MOVE : 20,
    INTERACTION_WITH_ZEPSCRIPTS : 21,
    MULTIPLE_CHOICE : 22,
}
// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81,function(player){
    for(let key in ObjectEffectType){
        let type = ObjectEffectType[key];
        let arr = Map.getTopObjectsByType(type);
        for(let obj of arr){
            for(let key in obj){
                App.sayToAll(`${key}: ${obj[key]}`);        
            }
        }
    }
})

sayObjectWithKey

Map.sayObjectWithKey( key: string, message: string )

key ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ ์œ„์— ๋งํ’์„ ์„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

๋Œ€์ƒ์˜ค๋ธŒ์ ํŠธ์˜ ํ‚ค ๊ฐ’

message

String

๋งํ’์„ ์— ํ‘œ์‹œํ•  ๋ฉ”์‹œ์ง€

์˜ˆ์ œ

key ๊ฐ’์„ ๊ฐ€์ง„ ์˜ค๋ธŒ์ ํŠธ ์œ„์— ๋งํ’์„  ํ‘œ์‹œํ•˜๊ธฐ

const objectKey = "TestBlueMan";
// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	Map.putObjectWithKey(18, 6, blueman, {
		npcProperty: { name: "BlueMan", hpColor: 0x03ff03, hp: 100, hpMax: 100 },
		overlap: true,
		movespeed: 100, 
		key: objectKey, 
		useDirAnim: true
	});
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(87, function(player){
    Map.sayObjectWithKey(objectKey, `I'm BlueMan!`)
})

๋ถ€๋ก

์Šคํ”„๋ผ์ดํŠธ์‹œํŠธ ์ดํ•ดํ•˜๊ธฐ

๊ธฐ์ค€์ขŒํ‘œ๋ž€?


Last updated