How to use setPos method in root

Best JavaScript code snippet using root

level_0_7.ts

Source:level_0_7.ts Github

copy

Full Screen

...5 .setViewPos({ x: 1, y: 3 })6 .setArea({ x: 2, y: 4 }, { x: 12, y: 4 }, () => [wall])7 .setArea({ x: 2, y: 8 }, { x: 12, y: 8 }, () => [wall])8 .setArea({ x: 7, y: 5 }, { x: 7, y: 7 }, () => [rock])9 .setPos({ x: 3, y: 6 }, () => [baba])10 .setPos({ x: 11, y: 6 }, () => [flag])11 .setPos({ x: 2, y: 2 }, () => ([text.baba]))12 .setPos({ x: 3, y: 2 }, () => ([text.is]))13 .setPos({ x: 4, y: 2 }, () => ([text.you]))14 .setPos({ x: 2, y: 10 }, () => ([text.wall]))15 .setPos({ x: 3, y: 10 }, () => ([text.is]))16 .setPos({ x: 4, y: 10 }, () => ([text.stop]))17 .setPos({ x: 10, y: 2 }, () => ([text.flag]))18 .setPos({ x: 11, y: 2 }, () => ([text.is]))19 .setPos({ x: 12, y: 2 }, () => ([text.win]))20 .setPos({ x: 10, y: 10 }, () => ([text.rock]))21 .setPos({ x: 11, y: 10 }, () => ([text.is]))22 .setPos({ x: 12, y: 10 }, () => ([text.push]))23 .build()24export const level1: GameMap = mapBuilder(22, 17)25 .setArea({ x: 4, y: 5 }, { x: 4, y: 9 }, () => [wall])26 .setArea({ x: 5, y: 5 }, { x: 8, y: 5 }, () => [wall])27 .setArea({ x: 5, y: 9 }, { x: 15, y: 9 }, () => [wall])28 .setArea({ x: 8, y: 1 }, { x: 8, y: 5 }, () => [wall])29 .setArea({ x: 9, y: 1 }, { x: 16, y: 1 }, () => [wall])30 .setArea({ x: 8, y: 9 }, { x: 8, y: 15 }, () => [wall])31 .setArea({ x: 16, y: 2 }, { x: 16, y: 15 }, () => [wall])32 .setArea({ x: 9, y: 15 }, { x: 15, y: 15 }, () => [wall])33 .setPos({ x: 14, y: 12 }, () => [baba])34 .setPos({ x: 10, y: 7 }, () => [flag])35 .setPos({ x: 10, y: 11 }, () => [text.wall])36 .setPos({ x: 10, y: 12 }, () => [text.is])37 .setPos({ x: 10, y: 13 }, () => [text.stop])38 .setPos({ x: 14, y: 5 }, () => [text.win])39 .setPos({ x: 10, y: 3 }, () => [text.is])40 .setPos({ x: 6, y: 7 }, () => [text.flag])41 .setPos({ x: 5, y: 11 }, () => [text.baba])42 .setPos({ x: 5, y: 12 }, () => [text.is])43 .setPos({ x: 5, y: 13 }, () => [text.you])44 .build()45export const level2: GameMap = mapBuilder(22, 17)46 .setArea({ x: 4, y: 5 }, { x: 4, y: 9 }, () => [flag])47 .setArea({ x: 5, y: 5 }, { x: 8, y: 5 }, () => [flag])48 .setArea({ x: 5, y: 9 }, { x: 15, y: 9 }, () => [flag])49 .setArea({ x: 8, y: 1 }, { x: 8, y: 5 }, () => [flag])50 .setArea({ x: 9, y: 1 }, { x: 16, y: 1 }, () => [flag])51 .setArea({ x: 8, y: 9 }, { x: 8, y: 15 }, () => [flag])52 .setArea({ x: 16, y: 2 }, { x: 16, y: 15 }, () => [flag])53 .setArea({ x: 9, y: 15 }, { x: 15, y: 15 }, () => [flag])54 .setPos({ x: 14, y: 12 }, () => [wall])55 .setPos({ x: 10, y: 11 }, () => [text.flag])56 .setPos({ x: 10, y: 12 }, () => [text.is])57 .setPos({ x: 10, y: 13 }, () => [text.stop])58 .setPos({ x: 14, y: 5 }, () => [text.win])59 .setPos({ x: 10, y: 3 }, () => [text.is])60 .setPos({ x: 6, y: 7 }, () => [text.baba])61 .setPos({ x: 5, y: 11 }, () => [text.wall])62 .setPos({ x: 5, y: 12 }, () => [text.is])63 .setPos({ x: 5, y: 13 }, () => [text.you])64 .build()65export const level3: GameMap = mapBuilder(22, 16)66 .setArea({ x: 2, y: 0 }, { x: 2, y: 2 }, () => [wall])67 .setArea({ x: 0, y: 3 }, { x: 2, y: 3 }, () => [wall])68 .setArea({ x: 7, y: 1 }, { x: 14, y: 7 }, () => [wall])69 .setArea({ x: 8, y: 2 }, { x: 13, y: 6 }, () => [])70 .setArea({ x: 4, y: 7 }, { x: 17, y: 14 }, () => [wall])71 .setArea({ x: 5, y: 8 }, { x: 16, y: 13 }, () => [])72 .setArea({ x: 8, y: 7 }, { x: 10, y: 7 }, () => [water])73 .setArea({ x: 5, y: 11 }, { x: 7, y: 13 }, () => [water])74 .setArea({ x: 11, y: 8 }, { x: 11, y: 10 }, () => [wall])75 .setArea({ x: 11, y: 12 }, { x: 11, y: 13 }, () => [wall])76 .setPos({ x: 5, y: 13 }, () => [flag])77 .setPos({ x: 12, y: 3 }, () => [rock])78 .setPos({ x: 12, y: 5 }, () => [rock])79 .setPos({ x: 9, y: 3 }, () => [baba])80 .setPos({ x: 0, y: 0 }, () => [text.baba])81 .setPos({ x: 0, y: 1 }, () => [text.is])82 .setPos({ x: 0, y: 2 }, () => [text.you])83 .setPos({ x: 1, y: 0 }, () => [text.wall])84 .setPos({ x: 1, y: 1 }, () => [text.is])85 .setPos({ x: 1, y: 2 }, () => [text.stop])86 .setPos({ x: 13, y: 9 }, () => [text.rock])87 .setPos({ x: 14, y: 9 }, () => [text.is])88 .setPos({ x: 15, y: 9 }, () => [text.push])89 .setPos({ x: 13, y: 12 }, () => [text.flag])90 .setPos({ x: 14, y: 12 }, () => [text.is])91 .setPos({ x: 15, y: 12 }, () => [text.win])92 .setPos({ x: 6, y: 4 }, () => [text.water])93 .setPos({ x: 6, y: 5 }, () => [text.is])94 .setPos({ x: 6, y: 6 }, () => [text.sink])95 .build()96export const level4: GameMap = mapBuilder(24, 14)97 // flag is win98 .setPos({ x: 0, y: 0 }, () => [text.flag])99 .setPos({ x: 1, y: 0 }, () => [text.is])100 .setPos({ x: 2, y: 0 }, () => [text.win])101 // baba is you102 .setPos({ x: 0, y: 1 }, () => [text.baba])103 .setPos({ x: 1, y: 1 }, () => [text.is])104 .setPos({ x: 2, y: 1 }, () => [text.you])105 // rock is push106 .setPos({ x: 2, y: 5 }, () => [text.rock])107 .setPos({ x: 3, y: 5 }, () => [text.is])108 .setPos({ x: 4, y: 5 }, () => [text.push])109 // 左下角区域110 .setArea({ x: 9, y: 9 }, { x: 9, y: 13 }, () => [skull])111 .setArea({ x: 3, y: 9 }, { x: 3, y: 13 }, () => [skull])112 .setArea({ x: 5, y: 7 }, { x: 5, y: 9 }, () => [skull])113 .setArea({ x: 7, y: 7 }, { x: 7, y: 9 }, () => [skull])114 .setPos({ x: 4, y: 9 }, () => [skull])115 .setPos({ x: 8, y: 9 }, () => [skull])116 .setArea({ x: 6, y: 8 }, { x: 6, y: 10 }, () => [rock])117 .setPos({ x: 6, y: 12 }, () => [baba])118 // 右侧区域119 .setArea({ x: 13, y: 3 }, { x: 21, y: 11 }, () => [skull])120 .setArea({ x: 14, y: 4 }, { x: 20, y: 10 }, () => [])121 .setPos({ x: 15, y: 5 }, () => [text.skull])122 .setPos({ x: 15, y: 6 }, () => [text.is])123 .setPos({ x: 15, y: 7 }, () => [text.defeat])124 .setPos({ x: 18, y: 9 }, () => [flag])125 .build()126export const level5: GameMap = mapBuilder(33, 18)127 .setArea({ x: 0, y: 1 }, { x: 3, y: 1 }, () => [lava])128 .setArea({ x: 0, y: 2 }, { x: 1, y: 2 }, () => [lava])129 .setArea({ x: 3, y: 0 }, { x: 4, y: 0 }, () => [lava])130 .setPos({ x: 0, y: 3 }, () => [lava])131 .setPos({ x: 0, y: 0 }, () => [text.wall])132 .setPos({ x: 1, y: 0 }, () => [text.is])133 .setPos({ x: 2, y: 0 }, () => [text.stop])134 .setArea({ x: 6, y: 0 }, { x: 6, y: 7 }, () => [wall])135 .setPos({ x: 7, y: 4 }, () => [wall])136 .setPos({ x: 11, y: 4 }, () => [wall])137 .setPos({ x: 12, y: 0 }, () => [wall])138 .setPos({ x: 8, y: 7 }, () => [wall])139 .setArea({ x: 7, y: 6 }, { x: 12, y: 6 }, () => [wall])140 .setArea({ x: 12, y: 2 }, { x: 12, y: 4 }, () => [wall])141 .setArea({ x: 13, y: 3 }, { x: 16, y: 3 }, () => [wall])142 .setArea({ x: 16, y: 0 }, { x: 16, y: 2 }, () => [wall])143 // baba is you144 .setPos({ x: 8, y: 3 }, () => [text.baba])145 .setPos({ x: 9, y: 3 }, () => [text.is])146 .setPos({ x: 10, y: 3 }, () => [text.you])147 // rock is push148 .setPos({ x: 7, y: 7 }, () => [text.rock])149 .setPos({ x: 7, y: 8 }, () => [text.is])150 .setPos({ x: 7, y: 9 }, () => [text.push])151 .setPos({ x: 12, y: 5 }, () => [rock])152 .setPos({ x: 14, y: 1 }, () => [baba])153 // 下方墙154 .setArea({ x: 7, y: 12 }, { x: 7, y: 15 }, () => [wall])155 .setArea({ x: 11, y: 12 }, { x: 11, y: 15 }, () => [wall])156 .setArea({ x: 8, y: 13 }, { x: 10, y: 13 }, () => [wall])157 .setArea({ x: 8, y: 15 }, { x: 10, y: 15 }, () => [wall])158 //159 .setPos({ x: 12, y: 10 }, () => [text.lava])160 .setPos({ x: 8, y: 12 }, () => [text.baba])161 .setPos({ x: 9, y: 12 }, () => [text.is])162 .setPos({ x: 10, y: 12 }, () => [text.melt])163 .setPos({ x: 8, y: 14 }, () => [text.lava])164 .setPos({ x: 9, y: 14 }, () => [text.is])165 .setPos({ x: 10, y: 14 }, () => [text.hot])166 .setArea({ x: 11, y: 17 }, { x: 11, y: 17 }, () => [lava])167 .setArea({ x: 12, y: 16 }, { x: 12, y: 17 }, () => [lava])168 .setArea({ x: 13, y: 15 }, { x: 13, y: 17 }, () => [lava])169 .setArea({ x: 14, y: 13 }, { x: 14, y: 17 }, () => [lava])170 .setArea({ x: 15, y: 11 }, { x: 15, y: 17 }, () => [lava])171 .setArea({ x: 16, y: 9 }, { x: 16, y: 17 }, () => [lava])172 .setArea({ x: 17, y: 6 }, { x: 17, y: 17 }, () => [lava])173 .setArea({ x: 18, y: 3 }, { x: 18, y: 15 }, () => [lava])174 .setArea({ x: 19, y: 1 }, { x: 19, y: 13 }, () => [lava])175 .setArea({ x: 20, y: 0 }, { x: 20, y: 12 }, () => [lava])176 .setArea({ x: 21, y: 0 }, { x: 21, y: 10 }, () => [lava])177 .setArea({ x: 22, y: 0 }, { x: 22, y: 9 }, () => [lava])178 .setArea({ x: 23, y: 0 }, { x: 23, y: 6 }, () => [lava])179 .setArea({ x: 24, y: 0 }, { x: 24, y: 3 }, () => [lava])180 .setArea({ x: 25, y: 0 }, { x: 25, y: 1 }, () => [lava])181 .setArea({ x: 26, y: 0 }, { x: 26, y: 0 }, () => [lava])182 .setPos({ x: 26, y: 12 }, () => [flag])183 .setPos({ x: 25, y: 14 }, () => [text.flag])184 .setPos({ x: 26, y: 14 }, () => [text.is])185 .setPos({ x: 27, y: 14 }, () => [text.win])186 .setArea({ x: 30, y: 17 }, { x: 30, y: 17 }, () => [lava])187 .setArea({ x: 31, y: 16 }, { x: 31, y: 17 }, () => [lava])188 .setArea({ x: 32, y: 15 }, { x: 32, y: 17 }, () => [lava])189 .build()190export const level6: GameMap = mapBuilder(24, 14)191 .setArea({ x: 0, y: 0 }, { x: 4, y: 6 }, () => [rock])192 .setArea({ x: 0, y: 0 }, { x: 3, y: 5 }, () => [])193 .setPos({ x: 0, y: 0 }, () => [text.rock])194 .setPos({ x: 1, y: 0 }, () => [text.is])195 .setPos({ x: 2, y: 0 }, () => [text.stop])196 .setPos({ x: 0, y: 2 }, () => [text.skull])197 .setPos({ x: 1, y: 2 }, () => [text.is])198 .setPos({ x: 2, y: 2 }, () => [text.defeat])199 .setPos({ x: 0, y: 4 }, () => [text.flag])200 .setPos({ x: 1, y: 4 }, () => [text.is])201 .setPos({ x: 2, y: 4 }, () => [text.win])202 .setArea({ x: 6, y: 4 }, { x: 10, y: 8 }, () => [wall])203 .setArea({ x: 7, y: 5 }, { x: 9, y: 7 }, () => [])204 .setArea({ x: 10, y: 1 }, { x: 15, y: 11 }, () => [wall])205 .setArea({ x: 11, y: 2 }, { x: 14, y: 10 }, () => [])206 .setArea({ x: 16, y: 1 }, { x: 19, y: 5 }, () => [wall])207 .setArea({ x: 16, y: 2 }, { x: 18, y: 4 }, () => [])208 .setPos({ x: 15, y: 3 }, () => [])209 .setPos({ x: 10, y: 6 }, () => [])210 .setArea({ x: 13, y: 6 }, { x: 15, y: 6 }, () => [wall])211 .setArea({ x: 12, y: 0 }, { x: 12, y: 7 }, () => [skull])212 .setArea({ x: 13, y: 7 }, { x: 23, y: 7 }, () => [skull])213 .setPos({ x: 8, y: 6 }, () => [baba])214 .setPos({ x: 17, y: 3 }, () => [flag])215 .setPos({ x: 12, y: 9 }, () => [text.wall])216 .setPos({ x: 13, y: 9 }, () => [text.is])217 .setPos({ x: 14, y: 9 }, () => [text.stop])218 .setPos({ x: 8, y: 10 }, () => [text.baba])219 .setPos({ x: 8, y: 11 }, () => [text.is])220 .setPos({ x: 8, y: 12 }, () => [text.you])221 .build()222export const level7: GameMap = mapBuilder(24, 14)223 .setArea({ x: 5, y: 2 }, { x: 18, y: 11 }, () => [wall])224 .setArea({ x: 6, y: 3 }, { x: 17, y: 10 }, () => [])225 .setPos({ x: 7, y: 4 }, () => [text.baba])226 .setPos({ x: 8, y: 4 }, () => [text.is])227 .setPos({ x: 9, y: 4 }, () => [text.you])228 .setPos({ x: 9, y: 7 }, () => [baba])229 .setPos({ x: 23, y: 6 }, () => [text.grass])230 .setPos({ x: 23, y: 7 }, () => [text.is])231 .setPos({ x: 23, y: 8 }, () => [text.stop])232 .setPos({ x: 16, y: 4 }, () => [flag])233 .setPos({ x: 6, y: 5 }, () => [grass])234 .setPos({ x: 10, y: 3 }, () => [grass])235 .setPos({ x: 6, y: 8 }, () => [grass])236 .setPos({ x: 7, y: 9 }, () => [grass])237 .setPos({ x: 10, y: 10 }, () => [grass])238 .setArea({ x: 12, y: 7 }, { x: 12, y: 9 }, () => [grass])239 .setPos({ x: 13, y: 5 }, () => [grass])240 .setPos({ x: 13, y: 10 }, () => [grass])241 .setPos({ x: 14, y: 6 }, () => [grass])242 .setPos({ x: 15, y: 7 }, () => [grass])243 .setPos({ x: 15, y: 9 }, () => [grass])244 .setPos({ x: 16, y: 6 }, () => [grass])245 .setPos({ x: 17, y: 7 }, () => [grass])246 .setPos({ x: 14, y: 8 }, () => [text.flag])247 .setPos({ x: 16, y: 8 }, () => [text.win])248 .build()249export const allLevel: LevelInfo[] = [250 { gameMap: level0, levelName: 'Baba is you.' },251 { gameMap: level1, levelName: 'Where do I go?' },252 { gameMap: level2, levelName: 'Now what is this' },253 { gameMap: level3, levelName: 'Out of reach' },254 { gameMap: level4, levelName: 'Still out of reach' },255 { gameMap: level5, levelName: 'Volcano' },256 { gameMap: level6, levelName: 'Off limits' },257 { gameMap: level7, levelName: 'Grass yard' },...

Full Screen

Full Screen

lake_1_13.ts

Source:lake_1_13.ts Github

copy

Full Screen

...7 .setArea({ x: 0, y: 2 }, { x: 1, y: 2 }, () => [objects.ice])8 .setArea({ x: 0, y: 3 }, { x: 0, y: 3 }, () => [objects.ice])9 .setArea({ x: 5, y: 3 }, { x: 9, y: 7 }, () => [objects.wall])10 .setArea({ x: 6, y: 4 }, { x: 8, y: 6 }, () => [])11 .setPos({ x: 7, y: 7 }, () => [])12 .setPos({ x: 7, y: 5 }, () => [objects.baba])13 .setArea({ x: 8, y: 10 }, { x: 11, y: 10 }, () => [objects.wall])14 .setArea({ x: 5, y: 12 }, { x: 11, y: 12 }, () => [objects.wall])15 .setLine({ x: 8, y: 11 }, [[text.baba], [text.is], [text.you], [text.and], [text.sink]])16 .setPos({ x: 5, y: 11 }, () => [objects.wall])17 .setPos({ x: 13, y: 11 }, () => [objects.wall])18 .setArea({ x: 0, y: 13 }, { x: 0, y: 13 }, () => [objects.ice])19 .setArea({ x: 0, y: 14 }, { x: 1, y: 14 }, () => [objects.ice])20 .setArea({ x: 0, y: 15 }, { x: 4, y: 15 }, () => [objects.ice])21 .setPos({ x: 6, y: 15 }, () => [objects.ice])22 .setPos({ x: 11, y: 15 }, () => [objects.ice])23 .setArea({ x: 11, y: 0 }, { x: 11, y: 0 }, () => [objects.ice])24 .setArea({ x: 12, y: 0 }, { x: 12, y: 1 }, () => [objects.ice])25 .setArea({ x: 13, y: 0 }, { x: 13, y: 3 }, () => [objects.ice])26 .setArea({ x: 14, y: 1 }, { x: 14, y: 6 }, () => [objects.ice])27 .setArea({ x: 15, y: 1 }, { x: 15, y: 9 }, () => [objects.ice])28 .setArea({ x: 16, y: 0 }, { x: 16, y: 10 }, () => [objects.ice])29 .setArea({ x: 17, y: 0 }, { x: 17, y: 11 }, () => [objects.ice])30 .setArea({ x: 18, y: 1 }, { x: 18, y: 12 }, () => [objects.ice])31 .setArea({ x: 19, y: 2 }, { x: 19, y: 13 }, () => [objects.ice])32 .setArea({ x: 20, y: 3 }, { x: 20, y: 14 }, () => [objects.ice])33 .setArea({ x: 21, y: 5 }, { x: 21, y: 15 }, () => [objects.ice])34 .setArea({ x: 22, y: 7 }, { x: 22, y: 15 }, () => [objects.ice])35 .setArea({ x: 23, y: 8 }, { x: 23, y: 15 }, () => [objects.ice])36 .setArea({ x: 24, y: 10 }, { x: 24, y: 15 }, () => [objects.ice])37 .setArea({ x: 25, y: 11 }, { x: 25, y: 15 }, () => [objects.ice])38 .setArea({ x: 26, y: 14 }, { x: 26, y: 15 }, () => [objects.ice])39 .setArea({ x: 16, y: 6 }, { x: 20, y: 8 }, () => [])40 .setArea({ x: 17, y: 5 }, { x: 19, y: 9 }, () => [])41 .setLine({ x: 25, y: 15 }, [[text.wall], [text.is], [text.stop]])42 .setLine({ x: 18, y: 7 }, [[text.wall]])43 .setArea({ x: 22, y: 3 }, { x: 26, y: 5 }, () => [objects.jelly])44 .setArea({ x: 23, y: 2 }, { x: 25, y: 6 }, () => [objects.jelly])45 .setArea({ x: 24, y: 3 }, { x: 24, y: 5 }, () => [])46 .setArea({ x: 23, y: 4 }, { x: 25, y: 4 }, () => [])47 .setPos({ x: 24, y: 4 }, () => [objects.flag])48 .setLine({ x: 25, y: 0 }, [[text.jelly], [text.is], [text.sink]])49 .build()50export const lake2: GameMap = mapBuilder(28, 16)51 .setArea({ x: 4, y: 3 }, { x: 8, y: 9 }, () => [objects.wall])52 .setArea({ x: 5, y: 2 }, { x: 20, y: 12 }, () => [objects.wall])53 .setArea({ x: 9, y: 3 }, { x: 19, y: 11 }, () => [])54 .setArea({ x: 5, y: 4 }, { x: 7, y: 8 }, () => [])55 .setArea({ x: 8, y: 5 }, { x: 10, y: 7 }, () => [objects.wall])56 .setArea({ x: 8, y: 6 }, { x: 10, y: 6 }, () => [])57 .setArea({ x: 21, y: 6 }, { x: 25, y: 10 }, () => [objects.wall])58 .setArea({ x: 20, y: 7 }, { x: 22, y: 7 }, () => [])59 .setArea({ x: 22, y: 8 }, { x: 24, y: 8 }, () => [])60 .setArea({ x: 24, y: 7 }, { x: 24, y: 9 }, () => [])61 .setPos({ x: 22, y: 9 }, () => [])62 .setPos({ x: 2, y: 6 }, () => [objects.crab])63 .setPos({ x: 6, y: 6 }, () => [text.crab])64 .setLine({ x: 5, y: 2 }, [[text.skull], [text.is], [text.defeat]])65 .setLine({ x: 6, y: 9 }, [[text.baba], [text.is], [text.you]], true)66 .setPos({ x: 23, y: 8 }, () => [objects.baba])67 .setPos({ x: 21, y: 7 }, () => [objects.rock])68 .setPos({ x: 3, y: 11 }, () => [objects.flag])69 .setPos({ x: 8, y: 6 }, () => [objects.skull])70 .setPos({ x: 10, y: 6 }, () => [objects.star])71 .setLine({ x: 2, y: 13 }, [[text.flag], [text.is], [text.win]])72 .setLine({ x: 21, y: 5 }, [[text.wall], [text.is], [text.stop]])73 .setLine({ x: 13, y: 5 }, [[text.star], [text.is], [text.sink]])74 .setLine({ x: 13, y: 7 }, [[text.rock], [text.is], [text.push]])75 .setPos({ x: 13, y: 9 }, () => [objects.rock])76 .setPos({ x: 15, y: 9 }, () => [text.and])77 .build()78export const lake3: GameMap = mapBuilder(24, 14)79 .setLine({ x: 0, y: 0 }, [[text.algae], [text.is], [text.defeat]])80 .setLine({ x: 0, y: 11 }, [[text.love], [text.is], [text.win]], true)81 .setLine({ x: 21, y: 13 }, [[text.baba], [text.is], [text.you]])82 .setPos({ x: 3, y: 9 }, () => [objects.baba])83 .setLine({ x: 9, y: 9 }, [[text.love], [text.is], [text.push]])84 .setLine({ x: 9, y: 5 }, [[text.keke], [text.is], [text.move]])85 .setArea({ x: 14, y: 5 }, { x: 18, y: 9 }, () => [objects.algae])86 .setArea({ x: 15, y: 6 }, { x: 17, y: 8 }, () => [])87 .setPos({ x: 16, y: 7 }, () => [objects.love])88 .setPos({ x: 6, y: 3 }, () => [{ ...objects.keke, direction: Direction.right }])89 .setPos({ x: 7, y: 7 }, () => [{ ...objects.keke, direction: Direction.up }])90 .setPos({ x: 12, y: 10 }, () => [{ ...objects.keke, direction: Direction.down }])91 .build()92export const lake4: GameMap = mapBuilder(24, 14)93 .setLine({ x: 0, y: 0 }, [[text.flag], [text.is], [text.win]])94 .setLine({ x: 5, y: 2 }, [[text.pillar], [text.is], [text.push]])95 .setLine({ x: 0, y: 6 }, [[text.wall], [text.is], [text.stop]], true)96 .setLine({ x: 5, y: 12 }, [[text.baba], [text.is], [text.you]])97 .setLine({ x: 21, y: 13 }, [[text.star], [text.is], [text.defeat]])98 .setPos({ x: 1, y: 1 }, () => [objects.algae])99 .setArea({ x: 4, y: 5 }, { x: 8, y: 9 }, () => [objects.wall])100 .setArea({ x: 5, y: 6 }, { x: 7, y: 8 }, () => [])101 .setPos({ x: 6, y: 7 }, () => [objects.baba])102 .setArea({ x: 15, y: 5 }, { x: 19, y: 9 }, () => [objects.star])103 .setArea({ x: 16, y: 6 }, { x: 18, y: 8 }, () => [])104 .setPos({ x: 17, y: 7 }, () => [objects.flag])105 .setPos({ x: 10, y: 2 }, () => [objects.pillar])106 .setPos({ x: 12, y: 3 }, () => [objects.pillar])107 .setPos({ x: 11, y: 11 }, () => [objects.pillar])108 .setPos({ x: 17, y: 12 }, () => [objects.pillar])109 .setPos({ x: 8, y: 7 }, () => [objects.pillar])110 .setPos({ x: 18, y: 1 }, () => [objects.pillar])111 .setPos({ x: 1, y: 11 }, () => [objects.algae])112 .setPos({ x: 10, y: 8 }, () => [objects.algae])113 .setPos({ x: 14, y: 13 }, () => [objects.algae])114 .setPos({ x: 15, y: 12 }, () => [objects.algae])115 .setPos({ x: 19, y: 12 }, () => [objects.algae])116 .setPos({ x: 20, y: 8 }, () => [objects.algae])117 .setPos({ x: 16, y: 1 }, () => [objects.algae])118 .setPos({ x: 17, y: 2 }, () => [objects.algae])119 .setPos({ x: 20, y: 3 }, () => [objects.algae])120 .setPos({ x: 22, y: 1 }, () => [objects.algae])121 .build()122export const lake5: GameMap = mapBuilder(15, 8)123 .setLine({ x: 4, y: 2 }, [[text.baba], [text.is], [text.you]])124 .setLine({ x: 4, y: 5 }, [[text.flag], [text.is], [text.win]])125 .setArea({ x: 9, y: 2 }, { x: 14, y: 6 }, () => [objects.wall])126 .setArea({ x: 10, y: 3 }, { x: 12, y: 5 }, () => [])127 .setLine({ x: 14, y: 3 }, [[text.wall], [text.is], [text.stop]], true)128 .setPos({ x: 1, y: 4 }, () => [objects.baba])129 .setPos({ x: 11, y: 4 }, () => [objects.flag])130 .setPos({ x: 1, y: 0 }, () => [objects.algae])131 .setPos({ x: 0, y: 1 }, () => [objects.algae])132 .setPos({ x: 2, y: 7 }, () => [objects.algae])133 .setPos({ x: 12, y: 7 }, () => [objects.algae])134 .setPos({ x: 13, y: 0 }, () => [objects.algae])135 .build()136export const allLevel: LevelInfo[] = [137 { gameMap: lake1, levelName: 'Icy waters' },138 { gameMap: lake2, levelName: 'Turns' },139 { gameMap: lake3, levelName: 'Affection' },140 { gameMap: lake4, levelName: 'Pillar yard' },141 { gameMap: lake5, levelName: 'Brick wall' }...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

1import React, { useState } from 'react';2import './App.css';3import * as axios from 'axios';4import { Container, Row, Col, Button, Form } from 'react-bootstrap'5function App() {6 const [hombroPata1, setHombroPata1] = useState(0)7 const handleClick = (pata, motor, direccion) => {8 axios.get(`http://192.168.7.64:3000/move?pata=${pata}&motor=${motor}&direccion=${direccion}`)9 .then(data => {10 console.log(data)11 //setHombroPata1(data.data.posicion)12 })13 }14 const shutdown = () => {15 axios.get(`http://192.168.7.64:3000/shutdown`)16 .then(data => {17 console.log(data)18 //setHombroPata1(data.data.posicion)19 })20 }21 const setpos = (pata, motor, posicion) => {22 return axios.get(`http://192.168.7.64:3000/move?pata=${pata}&motor=${motor}&posicion=${posicion}`)23 .then(data => {24 console.log(data)25 //setHombroPata1(data.data.posicion)26 })27 }28 const off = () => {29 axios.get(`http://192.168.7.64:3000/off`);30 }31 const home = () => {32 axios.get(`http://192.168.7.64:3000/home`);33 }34 const pausa = async (tout) => new Promise(resolve => setTimeout(() => resolve(), tout));35 const stepup = async () => {36 setpos(1, 'brazo', 1);37 setpos(2, 'brazo', 1);38 setpos(3, 'brazo', 1);39 setpos(4, 'brazo', 1);40 await pausa(1000);41 setpos(1, 'hombro', 0.25);42 setpos(2, 'hombro', 0.75);43 setpos(3, 'hombro', 0.75);44 setpos(4, 'hombro', 0.25);45 await pausa(1000);46 setpos(1, 'antebrazo', 0);47 setpos(2, 'antebrazo', 0);48 setpos(3, 'antebrazo', 0);49 setpos(4, 'antebrazo', 0);50 await pausa(1000);51 setpos(1, 'brazo', 0.75);52 setpos(2, 'brazo', 0.75);53 setpos(3, 'brazo', 0.75);54 setpos(4, 'brazo', 0.75);55 await pausa(1000);56// setpos(1, 'hombro', 0.5);57// setpos(2, 'hombro', 0.5);58// setpos(3, 'hombro', 0.5);59// setpos(4, 'hombro', 0.5);60// await pausa(1000);61// setpos(1, 'brazo', 0.65);62// setpos(2, 'brazo', 0.65);63// await pausa(1000);64// setpos(3, 'brazo', 0.65);65// setpos(4, 'brazo', 0.65);66// await pausa(1000);67 /* setpos(2, 'brazo', 0.5);68 setpos(2, 'antebrazo', 1);69 await pausa(1000);70 setpos(2, 'brazo', 0);71 setpos(1, 'brazo', 0.5);72 await pausa(1000);73 setpos(3, 'brazo', 0.5);74 setpos(3, 'antebrazo', 1);75 await pausa(1000);76 setpos(3, 'brazo', 0);77 setpos(4, 'brazo', 0.5);78 await pausa(1000);79 80 81 setpos(2, 'brazo', 0.5);82 setpos(2, 'antebrazo', 0);83 await pausa(2000);84 85 setpos(3, 'brazo', 0.5);86 setpos(3, 'antebrazo', 0);87 await pausa(1000);88 */89 //await pausa(5000);90 //off();91 }92 const sitdown = async () => {93 for (let p = 0.5; p < 0.8; p += 0.01) {94 setpos(1, 'brazo', p);95 setpos(2, 'brazo', p);96 setpos(3, 'brazo', p);97 setpos(4, 'brazo', p);98 await pausa(500);99 }100 // const p=0.8;101 // setpos(1, 'brazo', p);102 // setpos(2, 'brazo', p);103 // setpos(3, 'brazo', p);104 // setpos(4, 'brazo', p);105 await pausa(2000);106 off();107 }108 const center = async () => {109 for (let p = 1; p <= 6; p++) {110 setpos(p, 'hombro', 0.5);111 setpos(p, 'brazo', 0.5);112 setpos(p, 'antebrazo', 0.5);113 await pausa(500);114 }115 off();116 }117 const cambia = async (value, pata, motor) => {118 console.log(value, pata, motor);119 }120 return (121 <Container columns={2} rows={2}>122 <Row>123 <Button onClick={() => off()}>Poweroff all</Button>124 <Button onClick={() => home()}>Home all</Button>125 <Button onClick={() => stepup()}>Step Up</Button>126 <Button onClick={() => sitdown()}>Sit Down</Button>127 <Button onClick={() => center()}>Center and Off</Button>128 <Button onClick={() => shutdown()}>Shutdown system</Button>129 </Row>130 <Row>131 <Col>132 Pata 1133 <Row>134 <Col>135 <Form>136 <Form.Group>137 <Form.Label>Hombro</Form.Label>138 <Form.Control type={'range'} min={0} max={100}139 onChange={e => setpos(1, 'hombro', Number(e.target.value) / 100)}/>140 </Form.Group>141 </Form>142 </Col>143 </Row>144 <Row>145 <Col>146 <Form>147 <Form.Group>148 <Form.Label>Brazo</Form.Label>149 <Form.Control type={'range'} min={0} max={100}150 onChange={e => setpos(1, 'brazo', Number(e.target.value) / 100)}/>151 </Form.Group>152 </Form>153 </Col>154 </Row>155 <Row>156 <Col>157 <Form>158 <Form.Group>159 <Form.Label>Antebrazo</Form.Label>160 <Form.Control type={'range'} min={0} max={100}161 onChange={e => setpos(1, 'antebrazo', Number(e.target.value) / 100)}/>162 </Form.Group>163 </Form>164 </Col>165 </Row>166 </Col>167 <Col>168 Pata 3169 <Row>170 <Col>Hombro</Col>171 <Col><Button onClick={() => handleClick(3, 'hombro', 'l')}>Left</Button></Col>172 <Col><Button onClick={() => handleClick(3, 'hombro', 'r')}>Right</Button></Col>173 </Row>174 <Row>175 <Col>Brazo</Col>176 <Col><Button onClick={() => handleClick(3, 'brazo', 'd')}>Down</Button></Col>177 <Col><Button onClick={() => handleClick(3, 'brazo', 'u')}>Up</Button></Col>178 </Row>179 <Row>180 <Col>Antebrazo</Col>181 <Col><Button onClick={() => handleClick(3, 'antebrazo', 'd')}>Down</Button></Col>182 <Col><Button onClick={() => handleClick(3, 'antebrazo', 'u')}>Up</Button></Col>183 </Row>184 </Col>185 </Row>186 <Row>187 <Col>188 Pata 2189 <Row>190 <Col>Hombro</Col>191 <Col><Button onClick={() => handleClick(2, 'hombro', 'l')}>Left</Button></Col>192 <Col><Button onClick={() => handleClick(2, 'hombro', 'r')}>Right</Button></Col>193 </Row>194 <Row>195 <Col>Brazo</Col>196 <Col><Button onClick={() => handleClick(2, 'brazo', 'd')}>Down</Button></Col>197 <Col><Button onClick={() => handleClick(2, 'brazo', 'u')}>Up</Button></Col>198 </Row>199 <Row>200 <Col>Antebrazo</Col>201 <Col><Button onClick={() => handleClick(2, 'antebrazo', 'd')}>Down</Button></Col>202 <Col><Button onClick={() => handleClick(2, 'antebrazo', 'u')}>Up</Button></Col>203 </Row>204 </Col>205 <Col>206 Pata 4207 <Row>208 <Col>Hombro</Col>209 <Col><Button onClick={() => handleClick(4, 'hombro', 'l')}>Left</Button></Col>210 <Col><Button onClick={() => handleClick(4, 'hombro', 'r')}>Right</Button></Col>211 </Row>212 <Row>213 <Col>Brazo</Col>214 <Col><Button onClick={() => handleClick(4, 'brazo', 'd')}>Down</Button></Col>215 <Col><Button onClick={() => handleClick(4, 'brazo', 'u')}>Up</Button></Col>216 </Row>217 <Row>218 <Col>Antebrazo</Col>219 <Col><Button onClick={() => handleClick(4, 'antebrazo', 'd')}>Down</Button></Col>220 <Col><Button onClick={() => handleClick(4, 'antebrazo', 'u')}>Up</Button></Col>221 </Row>222 </Col>223 </Row>224 </Container>225 );226}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1root.setPos(0,0,0);2root.setPos(0,0,0);3root.setPos(0,0,0);4root.setPos(0,0,0);5root.setPos(0,0,0);6root.setPos(0,0,0);7root.setPos(0,0,0);8root.setPos(0,0,0);9root.setPos(0,0,0);10root.setPos(0,0,0);11root.setPos(0,0,0);12root.setPos(0,0,0);13root.setPos(0,0,0);14root.setPos(0,0,0);15root.setPos(0,0,0);16root.setPos(0,0,0);17root.setPos(0,0,0);18root.setPos(0,0,0);

Full Screen

Using AI Code Generation

copy

Full Screen

1root.setPos(0,0);2root.setPos(100,100);3root.setPos(0,0);4root.setPos(100,100);5root.setPos(0,0);6root.setPos(100,100);7root.setPos(0,0);8root.setPos(100,100);9root.setPos(0,0);10root.setPos(100,100);11root.setPos(0,0);12root.setPos(100,100);13root.setPos(0,0);14root.setPos(100,100);15root.setPos(0,0);16root.setPos(100,100);17root.setPos(0,0);18root.setPos(100,100);19root.setPos(0,0);20root.setPos(100,100);21root.setPos(0,0);22root.setPos(100,100);

Full Screen

Using AI Code Generation

copy

Full Screen

1root.setPos(100,100);2child.setPos(100,100);3root.setPos(100,100);4child.setPos(100,100);5root.setPos(100,100);6child.setPos(100,100);

Full Screen

Using AI Code Generation

copy

Full Screen

1root.setPos(0,0,0);2root.setPos(1,0,0);3root.setPos(2,0,0);4root.setPos(0,0,0);5root.setPos(1,0,0);6root.setPos(2,0,0);7root.setPos(0,0,0);8root.setPos(1,0,0);9root.setPos(2,0,0);10root.setPos(0,0,0);11root.setPos(1,0,0);12root.setPos(2,0,0);13root.setPos(0,0,0);14root.setPos(1,0,0);15root.setPos(2,0,0);16root.setPos(0,0,0);17root.setPos(1,0,0);18root.setPos(2,0,0);19root.setPos(0,0,0);20root.setPos(1,0,0);21root.setPos(2,0,0);22root.setPos(0,0,0);23root.setPos(1,0,0);24root.setPos(2,0,0);25root.setPos(0,0,0);26root.setPos(1,0,0);27root.setPos(2,0,0);28root.setPos(0,0,0);29root.setPos(1,0,0);30root.setPos(2,0,0);31root.setPos(0,0,0);32root.setPos(1,0,0);33root.setPos(2,0,0);

Full Screen

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 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