snuvi_supersnuvi.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <div id="snuviscript">
  2. <section id="Event-List">
  3. <table>
  4. <tr>
  5. <th class="command">
  6. level_reset
  7. </th>
  8. <th class="desc">the level is reseted either because it is loaded the first time or the hero died</th>
  9. </tr>
  10. <tr>
  11. <td class="bold">Information</td>
  12. <td>the hero is already spawned and can be modified</td>
  13. </tr>
  14. </table>
  15. <table>
  16. <tr>
  17. <th class="command">
  18. tile_interact
  19. </th>
  20. <th class="desc">an entity interacts with an interactable tile</th>
  21. </tr>
  22. <tr>
  23. <td class="bold">Input</td>
  24. <td>
  25. entity<br>
  26. tile_x<br>
  27. tile_y
  28. </td>
  29. </tr>
  30. <tr>
  31. <td class="bold">Information</td>
  32. <td>
  33. currently only the hero actively interacts with tiles
  34. </td>
  35. </tr>
  36. </table>
  37. <table>
  38. <tr>
  39. <th class="command">
  40. auto_tile_interact
  41. </th>
  42. <th class="desc">an entity automatically interacts with an interactable tile</th>
  43. </tr>
  44. <tr>
  45. <td class="bold">Input</td>
  46. <td>
  47. entity<br>
  48. tile_x<br>
  49. tile_y
  50. </td>
  51. </tr>
  52. </table>
  53. <table>
  54. <tr>
  55. <th class="command">
  56. tile_hit
  57. </th>
  58. <th class="desc">a head hit tile is hit by an entity</th>
  59. </tr>
  60. <tr>
  61. <td class="bold">Input</td>
  62. <td>
  63. entity<br>
  64. tile_x<br>
  65. tile_y
  66. </td>
  67. </tr>
  68. </table>
  69. <table>
  70. <tr>
  71. <th class="command">
  72. entity_spawn
  73. </th>
  74. <th class="desc">an entity is spawned</th>
  75. </tr>
  76. <tr>
  77. <td class="bold">Input</td>
  78. <td>
  79. entity
  80. </td>
  81. </tr>
  82. <tr>
  83. <td class="bold">Information</td>
  84. <td>
  85. entity.spawn throws this event delayed
  86. </td>
  87. </tr>
  88. </table>
  89. <table>
  90. <tr>
  91. <th class="command">
  92. entity_despawn
  93. </th>
  94. <th class="desc">an entity is despawned</th>
  95. </tr>
  96. <tr>
  97. <td class="bold">Input</td>
  98. <td>
  99. entity
  100. </td>
  101. </tr>
  102. </table>
  103. </section>
  104. <section id="Level">
  105. <table>
  106. <tr>
  107. <th class="command">
  108. level.getName
  109. </th>
  110. <th class="desc">returns the name of the level</th>
  111. </tr>
  112. <tr>
  113. <td class="bold">Format</td>
  114. <td>level.getName()</td>
  115. </tr>
  116. </table>
  117. <table>
  118. <tr>
  119. <th class="command">
  120. level.getWidth
  121. </th>
  122. <th class="desc">returns the width of the level</th>
  123. </tr>
  124. <tr>
  125. <td class="bold">Format</td>
  126. <td>level.getWidth()</td>
  127. </tr>
  128. </table>
  129. <table>
  130. <tr>
  131. <th class="command">
  132. level.getHeight
  133. </th>
  134. <th class="desc">returns the height of the level</th>
  135. </tr>
  136. <tr>
  137. <td class="bold">Format</td>
  138. <td>level.getHeight()</td>
  139. </tr>
  140. </table>
  141. <table>
  142. <tr>
  143. <th class="command">
  144. level.getLayers
  145. </th>
  146. <th class="desc">returns the amount of layers of the level</th>
  147. </tr>
  148. <tr>
  149. <td class="bold">Format</td>
  150. <td>level.getLayers()</td>
  151. </tr>
  152. </table>
  153. <table>
  154. <tr>
  155. <th class="command">
  156. level.getBackgroundIndex
  157. </th>
  158. <th class="desc">returns the background index of the level</th>
  159. </tr>
  160. <tr>
  161. <td class="bold">Format</td>
  162. <td>level.getBackgroundIndex()</td>
  163. </tr>
  164. </table>
  165. <table>
  166. <tr>
  167. <th class="command">
  168. level.getTile
  169. </th>
  170. <th class="desc">returns a tile id of a specified position in the level</th>
  171. </tr>
  172. <tr>
  173. <td class="bold">Format</td>
  174. <td>level.getTile(layer, x, y)</td>
  175. </tr>
  176. </table>
  177. <table>
  178. <tr>
  179. <th class="command">
  180. level.setTile
  181. </th>
  182. <th class="desc">sets a tile id at a specified position in the level</th>
  183. </tr>
  184. <tr>
  185. <td class="bold">Format</td>
  186. <td>level.setTile(layer, x, y, tile_id)</td>
  187. </tr>
  188. </table>
  189. <table>
  190. <tr>
  191. <th class="command">
  192. level.addMessage
  193. </th>
  194. <th class="desc">adds a message to the level message queue</th>
  195. </tr>
  196. <tr>
  197. <td class="bold">Format</td>
  198. <td>level.settile(message)</td>
  199. </tr>
  200. </table>
  201. <table>
  202. <tr>
  203. <th class="command">
  204. level.finish
  205. </th>
  206. <th class="desc">marks the level as done and jumps back to the level navigation</th>
  207. </tr>
  208. <tr>
  209. <td class="bold">Format</td>
  210. <td>level.finish()</td>
  211. </tr>
  212. </table>
  213. </section>
  214. <section id="Tile">
  215. <table>
  216. <tr>
  217. <th class="command">
  218. tile.toTileCoord
  219. </th>
  220. <th class="desc">returns a level coordinate tranformed to a tile coordinate</th>
  221. </tr>
  222. <tr>
  223. <td class="bold">Format</td>
  224. <td>tile.toTileCoord(level_coord)</td>
  225. </tr>
  226. </table>
  227. <table>
  228. <tr>
  229. <th class="command">
  230. tile.toLevelCoord
  231. </th>
  232. <th class="desc">returns a tile coordinate tranformed to a level coordinate</th>
  233. </tr>
  234. <tr>
  235. <td class="bold">Format</td>
  236. <td>tile.toLevelCoord(tile_coord)</td>
  237. </tr>
  238. </table>
  239. <table>
  240. <tr>
  241. <th class="command">
  242. tile.scale
  243. </th>
  244. <th class="desc">returns a value scaled by the tile size factor</th>
  245. </tr>
  246. <tr>
  247. <td class="bold">Format</td>
  248. <td>tile.scale(value)</td>
  249. </tr>
  250. <tr>
  251. <td class="bold">Information</td>
  252. <td>this allows motion to be modified independent from tile size</td>
  253. </tr>
  254. <tr>
  255. <td class="bold">Example</td>
  256. <td>entity.setMotionY(entity.getHero(), tile.scale(-40));</td>
  257. </tr>
  258. </table>
  259. </section>
  260. <section id="Entity">
  261. <table>
  262. <tr>
  263. <th class="command">
  264. entity.getHero
  265. </th>
  266. <th class="desc">returns the hero of a level</th>
  267. </tr>
  268. <tr>
  269. <td class="bold">Format</td>
  270. <td>entity.getHero()</td>
  271. </tr>
  272. </table>
  273. <table>
  274. <tr>
  275. <th class="command">
  276. entity.getX
  277. </th>
  278. <th class="desc">returns the x coordinate of an entity</th>
  279. </tr>
  280. <tr>
  281. <td class="bold">Format</td>
  282. <td>entity.getX(entity)</td>
  283. </tr>
  284. </table>
  285. <table>
  286. <tr>
  287. <th class="command">
  288. entity.getY
  289. </th>
  290. <th class="desc">returns the y coordinate of an entity</th>
  291. </tr>
  292. <tr>
  293. <td class="bold">Format</td>
  294. <td>entity.getY(entity)</td>
  295. </tr>
  296. </table>
  297. <table>
  298. <tr>
  299. <th class="command">
  300. entity.teleport
  301. </th>
  302. <th class="desc">moves an entity to a specified position</th>
  303. </tr>
  304. <tr>
  305. <td class="bold">Format</td>
  306. <td>entity.teleport(entity, x, y)</td>
  307. </tr>
  308. </table>
  309. <table>
  310. <tr>
  311. <th class="command">
  312. entity.getMotionX
  313. </th>
  314. <th class="desc">returns the motion of an entity along the x axis</th>
  315. </tr>
  316. <tr>
  317. <td class="bold">Format</td>
  318. <td>entity.getMotionX(entity)</td>
  319. </tr>
  320. </table>
  321. <table>
  322. <tr>
  323. <th class="command">
  324. entity.getMotionY
  325. </th>
  326. <th class="desc">returns the motion of an entity along the y axis</th>
  327. </tr>
  328. <tr>
  329. <td class="bold">Format</td>
  330. <td>entity.getMotionY(entity)</td>
  331. </tr>
  332. </table>
  333. <table>
  334. <tr>
  335. <th class="command">
  336. entity.setMotionX
  337. </th>
  338. <th class="desc">sets the motion of an entity along the x axis</th>
  339. </tr>
  340. <tr>
  341. <td class="bold">Format</td>
  342. <td>entity.setMotionX(entity, motion_x)</td>
  343. </tr>
  344. </table>
  345. <table>
  346. <tr>
  347. <th class="command">
  348. entity.setMotionY
  349. </th>
  350. <th class="desc">sets the motion of an entity along the y axis</th>
  351. </tr>
  352. <tr>
  353. <td class="bold">Format</td>
  354. <td>entity.setMotionY(entity, motion_y)</td>
  355. </tr>
  356. </table>
  357. <table>
  358. <tr>
  359. <th class="command">
  360. entity.isHero
  361. </th>
  362. <th class="desc">returns true if an entity is the hero</th>
  363. </tr>
  364. <tr>
  365. <td class="bold">Format</td>
  366. <td>entity.isHero(entity)</td>
  367. </tr>
  368. </table>
  369. <table>
  370. <tr>
  371. <th class="command">
  372. entity.getHealth
  373. </th>
  374. <th class="desc">returns the health of an entity</th>
  375. </tr>
  376. <tr>
  377. <td class="bold">Format</td>
  378. <td>entity.getHealth(entity)</td>
  379. </tr>
  380. <tr>
  381. <td class="bold">Information</td>
  382. <td>health is a value between 0 and 1 including both</td>
  383. </tr>
  384. </table>
  385. <table>
  386. <tr>
  387. <th class="command">
  388. entity.addHealth
  389. </th>
  390. <th class="desc">adds a value to the health of an entity</th>
  391. </tr>
  392. <tr>
  393. <td class="bold">Format</td>
  394. <td>entity.addHealth(entity, value)</td>
  395. </tr>
  396. <tr>
  397. <td class="bold">Information</td>
  398. <td>health will always stay within the range 0 to 1 including both</td>
  399. </tr>
  400. </table>
  401. <table>
  402. <tr>
  403. <th class="command">
  404. entity.getEnergy
  405. </th>
  406. <th class="desc">returns the energy of an entity</th>
  407. </tr>
  408. <tr>
  409. <td class="bold">Format</td>
  410. <td>entity.getHealth(entity)</td>
  411. </tr>
  412. <tr>
  413. <td class="bold">Information</td>
  414. <td>energy is a value between 0 and 1 including both</td>
  415. </tr>
  416. </table>
  417. <table>
  418. <tr>
  419. <th class="command">
  420. entity.addEnergy
  421. </th>
  422. <th class="desc">adds a value to the energy of an entity</th>
  423. </tr>
  424. <tr>
  425. <td class="bold">Format</td>
  426. <td>entity.addEnergy(entity, value)</td>
  427. </tr>
  428. <tr>
  429. <td class="bold">Information</td>
  430. <td>energy will always stay within the range 0 to 1 including both</td>
  431. </tr>
  432. </table>
  433. <table>
  434. <tr>
  435. <th class="command">
  436. entity.spawn
  437. </th>
  438. <th class="desc">spawns and returns an entity or null if the entity id is invalid</th>
  439. </tr>
  440. <tr>
  441. <td class="bold">Format</td>
  442. <td>entity.spawn(entity_id, x, y)</td>
  443. </tr>
  444. </table>
  445. <table>
  446. <tr>
  447. <th class="command">
  448. entity.getType
  449. </th>
  450. <th class="desc">returns the type of an entity</th>
  451. </tr>
  452. <tr>
  453. <td class="bold">Format</td>
  454. <td>entity.getType(entity)</td>
  455. </tr>
  456. </table>
  457. </section>
  458. <section id="Platform">
  459. <table>
  460. <tr>
  461. <th class="command">
  462. platform.spawn
  463. </th>
  464. <th class="desc">spawns and returns a platform</th>
  465. </tr>
  466. <tr>
  467. <td class="bold">Format</td>
  468. <td>platform.spawn(x, y, tile_width)</td>
  469. </tr>
  470. <tr>
  471. <td class="bold">Arguments</td>
  472. <td>tile_width should be greater than or equal to 2</td>
  473. </tr>
  474. </table>
  475. <table>
  476. <tr>
  477. <th class="command">
  478. platform.addMove
  479. </th>
  480. <th class="desc">adds move data to a platform</th>
  481. </tr>
  482. <tr>
  483. <td class="bold">Format</td>
  484. <td>platform.addMove(platform, x, y, speedX, speedY, wait_ticks)</td>
  485. </tr>
  486. <tr>
  487. <td class="bold">Information</td>
  488. <td>
  489. a platform will loop through its move data by moving from one specified
  490. position to the next position with the specified speed
  491. </td>
  492. </tr>
  493. <tr>
  494. <td class="bold">Arguments</td>
  495. <td>
  496. speedX and speedY are taken absolute and can therefore be either negative or positive
  497. </td>
  498. </tr>
  499. </table>
  500. <table>
  501. <tr>
  502. <th class="command">
  503. platform.clear
  504. </th>
  505. <th class="desc">removes all move data from a platform</th>
  506. </tr>
  507. <tr>
  508. <td class="bold">Format</td>
  509. <td>platform.clear(platform)</td>
  510. </tr>
  511. </table>
  512. </section>
  513. <section id="Lighting">
  514. <table>
  515. <tr>
  516. <th class="command">
  517. light.setAmbient
  518. </th>
  519. <th class="desc">sets the ambient lighting of a level</th>
  520. </tr>
  521. <tr>
  522. <td class="bold">Format</td>
  523. <td>light.setAmbient(red, green, blue)</td>
  524. </tr>
  525. <tr>
  526. <td class="bold">Arguments</td>
  527. <td>red, green and blue are within the range 0 to 1 including both</td>
  528. </tr>
  529. </table>
  530. <table>
  531. <tr>
  532. <th class="command">
  533. light.setColor
  534. </th>
  535. <th class="desc">sets the color of a light in a level</th>
  536. </tr>
  537. <tr>
  538. <td class="bold">Format</td>
  539. <td>light.setColor(index, red, green, blue)</td>
  540. </tr>
  541. <tr>
  542. <td class="bold">Arguments</td>
  543. <td>
  544. index is a value from 0 to 31<br>
  545. red, green and blue are within the range 0 to 1 including both
  546. </td>
  547. </tr>
  548. </table>
  549. <table>
  550. <tr>
  551. <th class="command">
  552. light.setPosition
  553. </th>
  554. <th class="desc">sets the position of a light in a level</th>
  555. </tr>
  556. <tr>
  557. <td class="bold">Format</td>
  558. <td>light.setPosition(index, x, y)</td>
  559. </tr>
  560. <tr>
  561. <td class="bold">Arguments</td>
  562. <td>
  563. index is a value from 0 to 31
  564. </td>
  565. </tr>
  566. </table>
  567. <table>
  568. <tr>
  569. <th class="command">
  570. light.setPositionSmooth
  571. </th>
  572. <th class="desc">sets the position of a light in a level and remembers the old position for interpolation</th>
  573. </tr>
  574. <tr>
  575. <td class="bold">Format</td>
  576. <td>light.setPositionSmooth(index, x, y)</td>
  577. </tr>
  578. <tr>
  579. <td class="bold">Arguments</td>
  580. <td>
  581. index is a value from 0 to 31
  582. </td>
  583. </tr>
  584. </table>
  585. <table>
  586. <tr>
  587. <th class="command">
  588. light.setStrength
  589. </th>
  590. <th class="desc">sets the strength of a light in a level</th>
  591. </tr>
  592. <tr>
  593. <td class="bold">Format</td>
  594. <td>light.setStrength(index, strength)</td>
  595. </tr>
  596. <tr>
  597. <td class="bold">Arguments</td>
  598. <td>
  599. index is a value from 0 to 31<br>
  600. strength is the loose of lighting per pixel, therefore a higher value means a smaller light
  601. </td>
  602. </tr>
  603. </table>
  604. </section>
  605. </div>
  606. <script src="js/snuviscript.js"></script>