How to use withGrid method in storybook-root

Best JavaScript code snippet using storybook-root

overworld-maps.ts

Source: overworld-maps.ts Github

copy

Full Screen

...6 upperSrc: "/​images/​maps/​DemoUpper.png",7 gameObjects: {8 hero: new Person().init({9 isPlayerControlled: true,10 x: Utils.withGrid(5),11 y: Utils.withGrid(6),12 }),13 npcA: new Person().init({14 x: Utils.withGrid(7),15 y: Utils.withGrid(9),16 src: "/​images/​characters/​people/​npc1.png",17 behaviorLoop: [18 { type: "stand", direction: "left", time: 800 },19 { type: "stand", direction: "up", time: 800 },20 { type: "stand", direction: "right", time: 1200 },21 { type: "stand", direction: "up", time: 300 },22 ],23 talking: [24 {25 events: [26 { type: "textMessage", text: "I'm busy...", faceHero: "npcA" },27 { type: "textMessage", text: "Go away!" },28 { who: "hero", type: "walk", direction: "up" },29 ]30 }31 ]32 }),33 npcB: new Person().init({34 x: Utils.withGrid(8),35 y: Utils.withGrid(5),36 src: "/​images/​characters/​people/​npc2.png",37 /​/​ behaviorLoop: [38 /​/​ { type: "walk", direction: "left" },39 /​/​ { type: "stand", direction: "up", time: 800 },40 /​/​ { type: "walk", direction: "up" },41 /​/​ { type: "walk", direction: "right" },42 /​/​ { type: "walk", direction: "down" },43 /​/​ ]44 }),45 },46 walls: {47 [Utils.asGridCoord(7, 6)]: true,48 [Utils.asGridCoord(8, 6)]: true,49 [Utils.asGridCoord(7, 7)]: true,50 [Utils.asGridCoord(8, 7)]: true,51 },52 cutsceneSpaces: {53 [Utils.asGridCoord(7, 4)]: [54 {55 events: [56 { who: "npcB", type: "walk", direction: "left" },57 { who: "npcB", type: "stand", direction: "up", time: 500 },58 { type: "textMessage", text: "You can't be in there!" },59 { who: "npcB", type: "walk", direction: "right" },60 { who: "hero", type: "walk", direction: "down" },61 { who: "hero", type: "walk", direction: "left" },62 ]63 }64 ],65 [Utils.asGridCoord(5, 10)]: [66 {67 events: [68 { type: "changeMap", map: "Kitchen" }69 ]70 }71 ]72 }73 },74 Kitchen: {75 lowerSrc: "/​images/​maps/​KitchenLower.png",76 upperSrc: "/​images/​maps/​KitchenUpper.png",77 gameObjects: {78 hero: new Person().init({79 isPlayerControlled: true,80 x: Utils.withGrid(5),81 y: Utils.withGrid(5),82 }),83 npcB: new Person().init({84 x: Utils.withGrid(8),85 y: Utils.withGrid(8),86 src: "/​images/​characters/​people/​npc3.png",87 talking: [88 {89 events: [90 { type: "textMessage", text: "You made it!", faceHero: "npcB" },91 ]92 }93 ]94 }),95 /​/​ npcB0: new Person().init({96 /​/​ x: Utils.withGrid(8),97 /​/​ y: Utils.withGrid(8),98 /​/​ src: "/​images/​characters/​people/​npc3.png",99 /​/​ talking: [100 /​/​ {101 /​/​ events: [102 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },103 /​/​ ]104 /​/​ }105 /​/​ ]106 /​/​ }),107 /​/​ npcB1: new Person().init({108 /​/​ x: Utils.withGrid(8),109 /​/​ y: Utils.withGrid(8),110 /​/​ src: "/​images/​characters/​people/​npc3.png",111 /​/​ talking: [112 /​/​ {113 /​/​ events: [114 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },115 /​/​ ]116 /​/​ }117 /​/​ ]118 /​/​ }),119 /​/​ npcB2: new Person().init({120 /​/​ x: Utils.withGrid(8),121 /​/​ y: Utils.withGrid(8),122 /​/​ src: "/​images/​characters/​people/​npc3.png",123 /​/​ talking: [124 /​/​ {125 /​/​ events: [126 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },127 /​/​ ]128 /​/​ }129 /​/​ ]130 /​/​ }),131 /​/​ npcB3: new Person().init({132 /​/​ x: Utils.withGrid(8),133 /​/​ y: Utils.withGrid(8),134 /​/​ src: "/​images/​characters/​people/​npc3.png",135 /​/​ talking: [136 /​/​ {137 /​/​ events: [138 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },139 /​/​ ]140 /​/​ }141 /​/​ ]142 /​/​ }),143 /​/​ npcB4: new Person().init({144 /​/​ x: Utils.withGrid(8),145 /​/​ y: Utils.withGrid(8),146 /​/​ src: "/​images/​characters/​people/​npc3.png",147 /​/​ talking: [148 /​/​ {149 /​/​ events: [150 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },151 /​/​ ]152 /​/​ }153 /​/​ ]154 /​/​ }),155 /​/​ npcB5: new Person().init({156 /​/​ x: Utils.withGrid(8),157 /​/​ y: Utils.withGrid(8),158 /​/​ src: "/​images/​characters/​people/​npc3.png",159 /​/​ talking: [160 /​/​ {161 /​/​ events: [162 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },163 /​/​ ]164 /​/​ }165 /​/​ ]166 /​/​ }),167 /​/​ npcB6: new Person().init({168 /​/​ x: Utils.withGrid(8),169 /​/​ y: Utils.withGrid(8),170 /​/​ src: "/​images/​characters/​people/​npc3.png",171 /​/​ talking: [172 /​/​ {173 /​/​ events: [174 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },175 /​/​ ]176 /​/​ }177 /​/​ ]178 /​/​ }),179 /​/​ npcB7: new Person().init({180 /​/​ x: Utils.withGrid(8),181 /​/​ y: Utils.withGrid(8),182 /​/​ src: "/​images/​characters/​people/​npc3.png",183 /​/​ talking: [184 /​/​ {185 /​/​ events: [186 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },187 /​/​ ]188 /​/​ }189 /​/​ ]190 /​/​ }),191 /​/​ npcB8: new Person().init({192 /​/​ x: Utils.withGrid(8),193 /​/​ y: Utils.withGrid(8),194 /​/​ src: "/​images/​characters/​people/​npc3.png",195 /​/​ talking: [196 /​/​ {197 /​/​ events: [198 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },199 /​/​ ]200 /​/​ }201 /​/​ ]202 /​/​ }),203 /​/​ npcB9: new Person().init({204 /​/​ x: Utils.withGrid(8),205 /​/​ y: Utils.withGrid(8),206 /​/​ src: "/​images/​characters/​people/​npc3.png",207 /​/​ talking: [208 /​/​ {209 /​/​ events: [210 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },211 /​/​ ]212 /​/​ }213 /​/​ ]214 /​/​ }),215 /​/​ npcB10: new Person().init({216 /​/​ x: Utils.withGrid(8),217 /​/​ y: Utils.withGrid(8),218 /​/​ src: "/​images/​characters/​people/​npc3.png",219 /​/​ talking: [220 /​/​ {221 /​/​ events: [222 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },223 /​/​ ]224 /​/​ }225 /​/​ ]226 /​/​ }),227 /​/​ npcB11: new Person().init({228 /​/​ x: Utils.withGrid(8),229 /​/​ y: Utils.withGrid(8),230 /​/​ src: "/​images/​characters/​people/​npc3.png",231 /​/​ talking: [232 /​/​ {233 /​/​ events: [234 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },235 /​/​ ]236 /​/​ }237 /​/​ ]238 /​/​ }),239 /​/​ npcB12: new Person().init({240 /​/​ x: Utils.withGrid(8),241 /​/​ y: Utils.withGrid(8),242 /​/​ src: "/​images/​characters/​people/​npc3.png",243 /​/​ talking: [244 /​/​ {245 /​/​ events: [246 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },247 /​/​ ]248 /​/​ }249 /​/​ ]250 /​/​ }),251 /​/​ npcB13: new Person().init({252 /​/​ x: Utils.withGrid(8),253 /​/​ y: Utils.withGrid(8),254 /​/​ src: "/​images/​characters/​people/​npc3.png",255 /​/​ talking: [256 /​/​ {257 /​/​ events: [258 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },259 /​/​ ]260 /​/​ }261 /​/​ ]262 /​/​ }),263 /​/​ npcB14: new Person().init({264 /​/​ x: Utils.withGrid(8),265 /​/​ y: Utils.withGrid(8),266 /​/​ src: "/​images/​characters/​people/​npc3.png",267 /​/​ talking: [268 /​/​ {269 /​/​ events: [270 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },271 /​/​ ]272 /​/​ }273 /​/​ ]274 /​/​ }),275 /​/​ npcB15: new Person().init({276 /​/​ x: Utils.withGrid(8),277 /​/​ y: Utils.withGrid(8),278 /​/​ src: "/​images/​characters/​people/​npc3.png",279 /​/​ talking: [280 /​/​ {281 /​/​ events: [282 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },283 /​/​ ]284 /​/​ }285 /​/​ ]286 /​/​ }),287 /​/​ npcB16: new Person().init({288 /​/​ x: Utils.withGrid(8),289 /​/​ y: Utils.withGrid(8),290 /​/​ src: "/​images/​characters/​people/​npc3.png",291 /​/​ talking: [292 /​/​ {293 /​/​ events: [294 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },295 /​/​ ]296 /​/​ }297 /​/​ ]298 /​/​ }),299 /​/​ npcB17: new Person().init({300 /​/​ x: Utils.withGrid(8),301 /​/​ y: Utils.withGrid(8),302 /​/​ src: "/​images/​characters/​people/​npc3.png",303 /​/​ talking: [304 /​/​ {305 /​/​ events: [306 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },307 /​/​ ]308 /​/​ }309 /​/​ ]310 /​/​ }),311 /​/​ npcB18: new Person().init({312 /​/​ x: Utils.withGrid(8),313 /​/​ y: Utils.withGrid(8),314 /​/​ src: "/​images/​characters/​people/​npc3.png",315 /​/​ talking: [316 /​/​ {317 /​/​ events: [318 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },319 /​/​ ]320 /​/​ }321 /​/​ ]322 /​/​ }),323 /​/​ npcB19: new Person().init({324 /​/​ x: Utils.withGrid(8),325 /​/​ y: Utils.withGrid(8),326 /​/​ src: "/​images/​characters/​people/​npc3.png",327 /​/​ talking: [328 /​/​ {329 /​/​ events: [330 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },331 /​/​ ]332 /​/​ }333 /​/​ ]334 /​/​ }),335 /​/​ npcB20: new Person().init({336 /​/​ x: Utils.withGrid(8),337 /​/​ y: Utils.withGrid(8),338 /​/​ src: "/​images/​characters/​people/​npc3.png",339 /​/​ talking: [340 /​/​ {341 /​/​ events: [342 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },343 /​/​ ]344 /​/​ }345 /​/​ ]346 /​/​ }),347 /​/​ npcB21: new Person().init({348 /​/​ x: Utils.withGrid(8),349 /​/​ y: Utils.withGrid(8),350 /​/​ src: "/​images/​characters/​people/​npc3.png",351 /​/​ talking: [352 /​/​ {353 /​/​ events: [354 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },355 /​/​ ]356 /​/​ }357 /​/​ ]358 /​/​ }),359 /​/​ npcB22: new Person().init({360 /​/​ x: Utils.withGrid(8),361 /​/​ y: Utils.withGrid(8),362 /​/​ src: "/​images/​characters/​people/​npc3.png",363 /​/​ talking: [364 /​/​ {365 /​/​ events: [366 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },367 /​/​ ]368 /​/​ }369 /​/​ ]370 /​/​ }),371 /​/​ npcB23: new Person().init({372 /​/​ x: Utils.withGrid(8),373 /​/​ y: Utils.withGrid(8),374 /​/​ src: "/​images/​characters/​people/​npc3.png",375 /​/​ talking: [376 /​/​ {377 /​/​ events: [378 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },379 /​/​ ]380 /​/​ }381 /​/​ ]382 /​/​ }),383 /​/​ npcB24: new Person().init({384 /​/​ x: Utils.withGrid(8),385 /​/​ y: Utils.withGrid(8),386 /​/​ src: "/​images/​characters/​people/​npc3.png",387 /​/​ talking: [388 /​/​ {389 /​/​ events: [390 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },391 /​/​ ]392 /​/​ }393 /​/​ ]394 /​/​ }),395 /​/​ npcB25: new Person().init({396 /​/​ x: Utils.withGrid(8),397 /​/​ y: Utils.withGrid(8),398 /​/​ src: "/​images/​characters/​people/​npc3.png",399 /​/​ talking: [400 /​/​ {401 /​/​ events: [402 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },403 /​/​ ]404 /​/​ }405 /​/​ ]406 /​/​ }),407 /​/​ npcB26: new Person().init({408 /​/​ x: Utils.withGrid(8),409 /​/​ y: Utils.withGrid(8),410 /​/​ src: "/​images/​characters/​people/​npc3.png",411 /​/​ talking: [412 /​/​ {413 /​/​ events: [414 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },415 /​/​ ]416 /​/​ }417 /​/​ ]418 /​/​ }),419 /​/​ npcB27: new Person().init({420 /​/​ x: Utils.withGrid(8),421 /​/​ y: Utils.withGrid(8),422 /​/​ src: "/​images/​characters/​people/​npc3.png",423 /​/​ talking: [424 /​/​ {425 /​/​ events: [426 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },427 /​/​ ]428 /​/​ }429 /​/​ ]430 /​/​ }),431 /​/​ npcB28: new Person().init({432 /​/​ x: Utils.withGrid(8),433 /​/​ y: Utils.withGrid(8),434 /​/​ src: "/​images/​characters/​people/​npc3.png",435 /​/​ talking: [436 /​/​ {437 /​/​ events: [438 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },439 /​/​ ]440 /​/​ }441 /​/​ ]442 /​/​ }),443 /​/​ npcB29: new Person().init({444 /​/​ x: Utils.withGrid(8),445 /​/​ y: Utils.withGrid(8),446 /​/​ src: "/​images/​characters/​people/​npc3.png",447 /​/​ talking: [448 /​/​ {449 /​/​ events: [450 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },451 /​/​ ]452 /​/​ }453 /​/​ ]454 /​/​ }),455 /​/​ npcB30: new Person().init({456 /​/​ x: Utils.withGrid(8),457 /​/​ y: Utils.withGrid(8),458 /​/​ src: "/​images/​characters/​people/​npc3.png",459 /​/​ talking: [460 /​/​ {461 /​/​ events: [462 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },463 /​/​ ]464 /​/​ }465 /​/​ ]466 /​/​ }),467 /​/​ npcB31: new Person().init({468 /​/​ x: Utils.withGrid(8),469 /​/​ y: Utils.withGrid(8),470 /​/​ src: "/​images/​characters/​people/​npc3.png",471 /​/​ talking: [472 /​/​ {473 /​/​ events: [474 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },475 /​/​ ]476 /​/​ }477 /​/​ ]478 /​/​ }),479 /​/​ npcB32: new Person().init({480 /​/​ x: Utils.withGrid(8),481 /​/​ y: Utils.withGrid(8),482 /​/​ src: "/​images/​characters/​people/​npc3.png",483 /​/​ talking: [484 /​/​ {485 /​/​ events: [486 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },487 /​/​ ]488 /​/​ }489 /​/​ ]490 /​/​ }),491 /​/​ npcB33: new Person().init({492 /​/​ x: Utils.withGrid(8),493 /​/​ y: Utils.withGrid(8),494 /​/​ src: "/​images/​characters/​people/​npc3.png",495 /​/​ talking: [496 /​/​ {497 /​/​ events: [498 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },499 /​/​ ]500 /​/​ }501 /​/​ ]502 /​/​ }),503 /​/​ npcB34: new Person().init({504 /​/​ x: Utils.withGrid(8),505 /​/​ y: Utils.withGrid(8),506 /​/​ src: "/​images/​characters/​people/​npc3.png",507 /​/​ talking: [508 /​/​ {509 /​/​ events: [510 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },511 /​/​ ]512 /​/​ }513 /​/​ ]514 /​/​ }),515 /​/​ npcB35: new Person().init({516 /​/​ x: Utils.withGrid(8),517 /​/​ y: Utils.withGrid(8),518 /​/​ src: "/​images/​characters/​people/​npc3.png",519 /​/​ talking: [520 /​/​ {521 /​/​ events: [522 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },523 /​/​ ]524 /​/​ }525 /​/​ ]526 /​/​ }),527 /​/​ npcB36: new Person().init({528 /​/​ x: Utils.withGrid(8),529 /​/​ y: Utils.withGrid(8),530 /​/​ src: "/​images/​characters/​people/​npc3.png",531 /​/​ talking: [532 /​/​ {533 /​/​ events: [534 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },535 /​/​ ]536 /​/​ }537 /​/​ ]538 /​/​ }),539 /​/​ npcB37: new Person().init({540 /​/​ x: Utils.withGrid(8),541 /​/​ y: Utils.withGrid(8),542 /​/​ src: "/​images/​characters/​people/​npc3.png",543 /​/​ talking: [544 /​/​ {545 /​/​ events: [546 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },547 /​/​ ]548 /​/​ }549 /​/​ ]550 /​/​ }),551 /​/​ npcB38: new Person().init({552 /​/​ x: Utils.withGrid(8),553 /​/​ y: Utils.withGrid(8),554 /​/​ src: "/​images/​characters/​people/​npc3.png",555 /​/​ talking: [556 /​/​ {557 /​/​ events: [558 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },559 /​/​ ]560 /​/​ }561 /​/​ ]562 /​/​ }),563 /​/​ npcB39: new Person().init({564 /​/​ x: Utils.withGrid(8),565 /​/​ y: Utils.withGrid(8),566 /​/​ src: "/​images/​characters/​people/​npc3.png",567 /​/​ talking: [568 /​/​ {569 /​/​ events: [570 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },571 /​/​ ]572 /​/​ }573 /​/​ ]574 /​/​ }),575 /​/​ npcB40: new Person().init({576 /​/​ x: Utils.withGrid(8),577 /​/​ y: Utils.withGrid(8),578 /​/​ src: "/​images/​characters/​people/​npc3.png",579 /​/​ talking: [580 /​/​ {581 /​/​ events: [582 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },583 /​/​ ]584 /​/​ }585 /​/​ ]586 /​/​ }),587 /​/​ npcB41: new Person().init({588 /​/​ x: Utils.withGrid(8),589 /​/​ y: Utils.withGrid(8),590 /​/​ src: "/​images/​characters/​people/​npc3.png",591 /​/​ talking: [592 /​/​ {593 /​/​ events: [594 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },595 /​/​ ]596 /​/​ }597 /​/​ ]598 /​/​ }),599 /​/​ npcB42: new Person().init({600 /​/​ x: Utils.withGrid(8),601 /​/​ y: Utils.withGrid(8),602 /​/​ src: "/​images/​characters/​people/​npc3.png",603 /​/​ talking: [604 /​/​ {605 /​/​ events: [606 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },607 /​/​ ]608 /​/​ }609 /​/​ ]610 /​/​ }),611 /​/​ npcB43: new Person().init({612 /​/​ x: Utils.withGrid(8),613 /​/​ y: Utils.withGrid(8),614 /​/​ src: "/​images/​characters/​people/​npc3.png",615 /​/​ talking: [616 /​/​ {617 /​/​ events: [618 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },619 /​/​ ]620 /​/​ }621 /​/​ ]622 /​/​ }),623 /​/​ npcB44: new Person().init({624 /​/​ x: Utils.withGrid(8),625 /​/​ y: Utils.withGrid(8),626 /​/​ src: "/​images/​characters/​people/​npc3.png",627 /​/​ talking: [628 /​/​ {629 /​/​ events: [630 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },631 /​/​ ]632 /​/​ }633 /​/​ ]634 /​/​ }),635 /​/​ npcB45: new Person().init({636 /​/​ x: Utils.withGrid(8),637 /​/​ y: Utils.withGrid(8),638 /​/​ src: "/​images/​characters/​people/​npc3.png",639 /​/​ talking: [640 /​/​ {641 /​/​ events: [642 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },643 /​/​ ]644 /​/​ }645 /​/​ ]646 /​/​ }),647 /​/​ npcB46: new Person().init({648 /​/​ x: Utils.withGrid(8),649 /​/​ y: Utils.withGrid(8),650 /​/​ src: "/​images/​characters/​people/​npc3.png",651 /​/​ talking: [652 /​/​ {653 /​/​ events: [654 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },655 /​/​ ]656 /​/​ }657 /​/​ ]658 /​/​ }),659 /​/​ npcB47: new Person().init({660 /​/​ x: Utils.withGrid(8),661 /​/​ y: Utils.withGrid(8),662 /​/​ src: "/​images/​characters/​people/​npc3.png",663 /​/​ talking: [664 /​/​ {665 /​/​ events: [666 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },667 /​/​ ]668 /​/​ }669 /​/​ ]670 /​/​ }),671 /​/​ npcB48: new Person().init({672 /​/​ x: Utils.withGrid(8),673 /​/​ y: Utils.withGrid(8),674 /​/​ src: "/​images/​characters/​people/​npc3.png",675 /​/​ talking: [676 /​/​ {677 /​/​ events: [678 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },679 /​/​ ]680 /​/​ }681 /​/​ ]682 /​/​ }),683 /​/​ npcB49: new Person().init({684 /​/​ x: Utils.withGrid(8),685 /​/​ y: Utils.withGrid(8),686 /​/​ src: "/​images/​characters/​people/​npc3.png",687 /​/​ talking: [688 /​/​ {689 /​/​ events: [690 /​/​ { type: "textMessage", text: "You made it!", faceHero: "npcB" },691 /​/​ ]692 /​/​ }693 /​/​ ]694 /​/​ }),695 }696 },...

Full Screen

Full Screen

OverworldMap.js

Source: OverworldMap.js Github

copy

Full Screen

...9 }10 drawLowerImage(context, cameraPerson) {11 context.drawImage(12 this.lowerImage,13 utils.withGrid(10.5) - cameraPerson.x,14 utils.withGrid(6) - cameraPerson.y,15 )16 }17 drawUpperImage(context, cameraPerson) {18 context.drawImage(19 this.upperImage,20 utils.withGrid(10.5) - cameraPerson.x,21 utils.withGrid(6) - cameraPerson.y,22 )23 }24 isSpaceTaken(currentX, currentY, direction) {25 const { x, y } = utils.nextPosition(currentX, currentY, direction);26 return this.walls[`${x},${y}`] || false;27 }28 mountObjects() {29 Object.values(this.gameObjects).forEach(o => {30 o.mount(this);31 })32 }33 addWall(x, y) {34 this.walls[`${x},${y}`] = true;35 }36 removeWall(x, y) {37 delete this.walls[`${x},${y}`];38 }39 moveWall(wasX, wasY, direction) {40 this.removeWall(wasX, wasY);41 const { x, y } = utils.nextPosition(wasX, wasY, direction);42 this.addWall(x, y);43 }44}45window.OverworldMaps = {46 DemoRoom: {47 lowerSrc: "/​images/​maps/​DemoLower.png",48 upperSrc: "/​images/​maps/​DemoUpper.png",49 gameObjects: {50 hero: new Person({51 isPlayerControlled: true,52 x: utils.withGrid(5),53 y: utils.withGrid(6),54 }),55 npc1: new Person({56 x: utils.withGrid(7),57 y: utils.withGrid(9),58 src: "/​images/​characters/​people/​npc1.png"59 })60 },61 walls: {62 /​/​ "16,16": true,63 [utils.asGridCoord(7, 6)]: true,64 [utils.asGridCoord(8, 6)]: true,65 [utils.asGridCoord(7, 7)]: true,66 [utils.asGridCoord(8, 7)]: true,67 }68 },69 Kitchen: {70 lowerSrc: "/​images/​maps/​KitchenLower.png",71 upperSrc: "/​images/​maps/​KitchenUpper.png",72 gameObjects: {73 hero: new Person({74 isPlayerControlled: true,75 x: utils.withGrid(5),76 y: utils.withGrid(6),77 }),78 npcA: new Person({79 isPlayerControlled: false,80 x: utils.withGrid(4),81 y: utils.withGrid(4),82 src: "/​images/​characters/​people/​npc2.png"83 }),84 npcB: new Person({85 isPlayerControlled: false,86 x: utils.withGrid(9),87 y: utils.withGrid(8),88 src: "/​images/​characters/​people/​npc3.png"89 })90 }91 },92 DiningRoom: {93 lowerSrc: "/​images/​maps/​DiningRoomLower.png",94 upperSrc: "/​images/​maps/​DiningRoomUpper.png",95 gameObjects: {96 hero: new Person({97 isPlayerControlled: true,98 x: utils.withGrid(5),99 y: utils.withGrid(6),100 }),101 npcA: new Person({102 isPlayerControlled: false,103 x: utils.withGrid(4),104 y: utils.withGrid(4),105 src: "/​images/​characters/​people/​npc2.png"106 }),107 npcB: new Person({108 isPlayerControlled: false,109 x: utils.withGrid(9),110 y: utils.withGrid(8),111 src: "/​images/​characters/​people/​npc3.png"112 })113 }114 },115 Street: {116 lowerSrc: "/​images/​maps/​StreetLower.png",117 upperSrc: "/​images/​maps/​StreetUpper.png",118 gameObjects: {119 hero: new Person({120 isPlayerControlled: true,121 x: utils.withGrid(18),122 y: utils.withGrid(8),123 }),124 npcA: new Person({125 isPlayerControlled: false,126 x: utils.withGrid(14),127 y: utils.withGrid(10),128 src: "/​images/​characters/​people/​npc2.png"129 }),130 npcB: new Person({131 isPlayerControlled: false,132 x: utils.withGrid(9),133 y: utils.withGrid(11),134 src: "/​images/​characters/​people/​npc3.png"135 })136 }137 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/​react';3import { withGrid } from 'storybook-root-decorator';4import { withKnobs, text } from '@storybook/​addon-knobs';5import { action } from '@storybook/​addon-actions';6import Button from './​Button';7storiesOf('Button', module)8 .addDecorator(withGrid)9 .addDecorator(withKnobs)10 .add('with text', () => (11 <Button onClick={action('clicked')}>{text('Label', 'Hello Button')}</​Button>12 .add('with some emoji', () => (13 <Button onClick={action('clicked')}>{text('Label', '😀 😎 👍 💯')}</​Button>14 ));15import React from 'react';16import './​Button.css';17const Button = props => (18 <button className="button" onClick={props.onClick}>19 {props.children}20);21export default Button;22.button {23 background-color: #4caf50;24 border: none;25 color: white;26 padding: 15px 32px;27 text-align: center;28 text-decoration: none;29 display: inline-block;30 font-size: 16px;31 margin: 4px 2px;32 cursor: pointer;33}34import React from 'react';35import { storiesOf } from '@storybook/​react';36import { withGrid } from 'storybook-root-decorator';37import { withKnobs, text } from '@storybook/​addon-knobs';38import { action } from '@storybook/​addon-actions';39import Button from './​Button';40storiesOf('Button', module)41 .addDecorator(withGrid(12, 'red', 0.5))42 .addDecorator(withKnobs)43 .add('with text', () => (44 <Button onClick={action('clicked')}>{text('Label', 'Hello Button')}</​Button>45 .add('with some emoji', () => (46 <Button onClick={action('clicked')}>{text

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-addon-grid';2import { withKnobs } from '@storybook/​addon-knobs';3import { withA11y } from '@storybook/​addon-a11y';4import { addDecorator, addParameters } from '@storybook/​react';5addDecorator(withGrid);6addDecorator(withKnobs);7addDecorator(withA11y);8addParameters({9 grid: {10 gridTemplateColumns: 'repeat(12, 1fr)',11 gridTemplateRows: 'repeat(12, 1fr)',12 },13});14import { withGrid } from 'storybook-addon-grid';15import { withKnobs } from '@storybook/​addon-knobs';16import { withA11y } from '@storybook/​addon-a11y';17import { addDecorator, addParameters } from '@storybook/​react';18addDecorator(withGrid);19addDecorator(withKnobs);20addDecorator(withA11y);21addParameters({22 grid: {23 gridTemplateColumns: 'repeat(12, 1fr)',24 gridTemplateRows: 'repeat(12, 1fr)',25 },26});27import { withGrid } from 'storybook-addon-grid';28import { withKnobs } from '@storybook/​addon-knobs';29import { withA11y } from '@storybook/​addon-a11y';30import { addDecorator, addParameters } from '@storybook/​react';31addDecorator(withGrid);32addDecorator(withKnobs);33addDecorator(withA11y);34addParameters({35 grid: {36 gridTemplateColumns: 'repeat(12, 1fr)',37 gridTemplateRows: 'repeat(12, 1fr)',38 },39});40import { withGrid } from 'storybook-addon-grid';41import { withKnobs } from '@storybook/​addon-knobs';42import { withA11y } from '@storybook/​addon-a11y';43import { addDecorator, addParameters } from '@storybook/​react';44addDecorator(withGrid);45addDecorator(withKnobs);46addDecorator(withA11y);47addParameters({48 grid: {49 gridTemplateColumns: 'repeat(12, 1fr)',50 gridTemplateRows: 'repeat(12,

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-root-decorator';2import { withKnobs } from '@storybook/​addon-knobs';3export default {4 parameters: {5 grid: {6 gridTemplateColumns: 'repeat(12, 1fr)',7 gridTemplateRows: 'repeat(12, 1fr)',8 },9 },10};11export const Test = () => {12 return html`<div style="grid-column: 1 /​ 13; grid-row: 1 /​ 13; background: red;">Test</​div>`;13};14import { addDecorator } from '@storybook/​html';15import { withGrid } from 'storybook-root-decorator';16addDecorator(withGrid);17module.exports = {18};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-root-decorator'2import { withInfo } from '@storybook/​addon-info'3import { withKnobs } from '@storybook/​addon-knobs'4import { withA11y } from '@storybook/​addon-a11y'5import { withTests } from '@storybook/​addon-jest'6import { withConsole } from '@storybook/​addon-console'7import { withOptions } from '@storybook/​addon-options'8import { withBackgrounds } from '@storybook/​addon-backgrounds'9import { withViewport } from '@storybook/​addon-viewport'10import results from '../​.jest-test-results.json'11const withGlobal = withGrid({12 style: {13 gridTemplateColumns: 'repeat(5, 1fr)',14 gridTemplateRows: 'repeat(5, 1fr)',15 },16})17export default {18 withTests({ results }),19}20export const test = () => <div>Test</​div>21import { configure, addDecorator } from '@storybook/​react'22import { withGlobal } from '../​test'23addDecorator(withGlobal)24configure(require.context('../​stories', true, /​\.stories\.js$/​), module)25import { addDecorator } from '@storybook/​react'26import { withGlobal } from '../​test'27addDecorator(withGlobal)28import { addDecorator } from '@storybook/​react'29import { withGlobal } from '../​test'30addDecorator(withGlobal)31import { addDecorator } from '@storybook/​react'32import { withGlobal } from '../​test'33addDecorator(withGlobal)34import { addDecorator } from '@storybook/​react'35import { withGlobal } from '../​test'36addDecorator(withGlobal)37import { addDecorator } from '@storybook/​react'38import { withGlobal } from '../​test'39addDecorator(withGlobal)40import { addDecorator } from '@storybook/​react'

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-addon-grid';2import { withKnobs } from '@storybook/​addon-knobs';3import { withA11y } from '@storybook/​addon-a11y';4import { withDesign } from 'storybook-addon-designs';5import { addDecorator } from '@storybook/​react';6addDecorator(withGrid);7addDecorator(withKnobs);8addDecorator(withA11y);9addDecorator(withDesign);10import React from 'react';11import { storiesOf } from '@storybook/​react';12import { withGrid } from 'storybook-addon-grid';13import { withKnobs } from '@storybook/​addon-knobs';14import { withA11y } from '@storybook/​addon-a11y';15import { withDesign } from 'storybook-addon-designs';16import { addDecorator } from '@storybook/​react';17addDecorator(withGrid);18addDecorator(withKnobs);19addDecorator(withA11y);20addDecorator(withDesign);21storiesOf('Test', module)22 .add('test', () => <div>Test</​div>);23import { withGrid } from 'storybook-addon-grid';24import { withKnobs } from '@storybook/​addon-knobs';25import { withA11y } from '@storybook/​addon-a11y';26import { withDesign } from 'storybook-addon-designs';27import { addDecorator } from '@storybook/​react';28addDecorator(withGrid);29addDecorator(withKnobs);30addDecorator(withA11y);31addDecorator(withDesign);32| `grid` | `Object` | `{ columns: 12, gutter: 16 }` | Grid configuration |33| `grid.breakpoints` | `Object` | `{ xs: 0, sm: 600, md: 960, lg: 1280, xl: 1920 }`

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-root-decorator'2import { addDecorator } from '@storybook/​react'3import { withA11y } from '@storybook/​addon-a11y'4import { withKnobs } from '@storybook/​addon-knobs'5addDecorator(withA11y)6addDecorator(withKnobs)7addDecorator(withGrid)8import { addDecorator } from '@storybook/​react'9import { withA11y } from '@storybook/​addon-a11y'10import { withKnobs } from '@storybook/​addon-knobs'11import { withGrid } from 'storybook-root-decorator'12addDecorator(withA11y)13addDecorator(withKnobs)14addDecorator(withGrid)15import { addDecorator } from '@storybook/​react'16import { withA11y } from '@storybook/​addon-a11y'17import { withKnobs } from '@storybook/​addon-knobs'18import { withGrid } from 'storybook-root-decorator'19addDecorator(withA11y)20addDecorator(withKnobs)21addDecorator(withGrid)22import { addDecorator } from '@storybook/​react'23import { withA11y } from '@storybook/​addon-a11y'24import { withKnobs } from '@storybook/​addon-knobs'25import { withGrid } from 'storybook-root-decorator'26addDecorator(withA11y)27addDecorator(withKnobs)28addDecorator(withGrid)29import { addDecorator } from '@storybook/​react'30import { withA11y } from '@storybook/​addon-a11y'31import { withKnobs } from '@storybook/​addon-knobs'32import { withGrid } from 'storybook-root-decorator'33addDecorator(withA11y)34addDecorator(withKnobs)35addDecorator(withGrid)36import { addDecorator } from '@storybook/​react'37import { withA11y

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-root-decorator';2import { storiesOf } from '@storybook/​react';3import { withKnobs, text, boolean } from '@storybook/​addon-knobs';4import { withInfo } from '@storybook/​addon-info';5import { withReadme } from 'storybook-readme';6import README from './​README.md';7import Component from '.';8const stories = storiesOf('Component', module);9 .addDecorator(withGrid())10 .addDecorator(withKnobs)11 .addDecorator(withInfo)12 .addDecorator(withReadme(README));13stories.add('Default', () => (14 text={text('text', 'Hello World')}15 disabled={boolean('disabled', false)}16));

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withGrid } from 'storybook-root-decorator';2export default {3 decorators: [withGrid({ rows: 2, columns: 2 })],4};5export const Button = () => <button>Button</​button>;6export const Button2 = () => <button>Button</​button>;7export const Button3 = () => <button>Button</​button>;8export const Button4 = () => <button>Button</​button>;9export const Button5 = () => <button>Button</​button>;10export const Button6 = () => <button>Button</​button>;11export const Button7 = () => <button>Button</​button>;12export const Button8 = () => <button>Button</​button>;13export const Button9 = () => <button>Button</​button>;14export const Button10 = () => <button>Button</​button>;15export const Button11 = () => <button>Button</​button>;16export const Button12 = () => <button>Button</​button>;17export const Button13 = () => <button>Button</​button>;18export const Button14 = () => <button>Button</​button>;19export const Button15 = () => <button>Button</​button>;20export const Button16 = ()

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Oct’22 Updates: New Analytics And App Automation Dashboard, Test On Google Pixel 7 Series, And More

Hey everyone! We hope you had a great Hacktober. At LambdaTest, we thrive to bring you the best with each update. Our engineering and tech teams work at lightning speed to deliver you a seamless testing experience.

Now Log Bugs Using LambdaTest and DevRev

In today’s world, an organization’s most valuable resource is its customers. However, acquiring new customers in an increasingly competitive marketplace can be challenging while maintaining a strong bond with existing clients. Implementing a customer relationship management (CRM) system will allow your organization to keep track of important customer information. This will enable you to market your services and products to these customers better.

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

How to Position Your Team for Success in Estimation

Estimates are critical if you want to be successful with projects. If you begin with a bad estimating approach, the project will almost certainly fail. To produce a much more promising estimate, direct each estimation-process issue toward a repeatable standard process. A smart approach reduces the degree of uncertainty. When dealing with presales phases, having the most precise estimation findings can assist you to deal with the project plan. This also helps the process to function more successfully, especially when faced with tight schedules and the danger of deviation.

How To Write End-To-End Tests Using Cypress App Actions

When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful