You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
11 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. pico-8 cartridge // http://www.pico-8.com
  2. version 32
  3. __lua__
  4. -- game code
  5. function init_world()
  6. player = {}
  7. player.x = 60
  8. player.y = 112
  9. player.vy = 0
  10. player.flipx = false
  11. player.spr = 0
  12. player.moves = 0
  13. end
  14. function _init()
  15. -- disable btnp autorepeat
  16. poke(0x5f5c, 255)
  17. -- set peach as bg color
  18. -- instead of black
  19. palt(black, false)
  20. palt(peach, true)
  21. init_world()
  22. end
  23. function _update()
  24. update_player()
  25. end
  26. function _draw()
  27. cls(12)
  28. camera_x = mid(0, 896, player.x - 64)
  29. camera(camera_x, 0)
  30. draw_bg()
  31. draw_player()
  32. camera(0, 0)
  33. print_ctr("b o r b",8,yellow)
  34. end
  35. function draw_bg()
  36. map(0, 0, 0, 0, 128, 16)
  37. end
  38. function update_player()
  39. if (btn(0)) then
  40. player.x -= 1
  41. player.moves += 1
  42. player.flipx = true
  43. end
  44. if (btn(1)) then
  45. player.x += 1
  46. player.moves += 1
  47. player.flipx = false
  48. end
  49. if (btnp(🅾️)) then
  50. player.vy = -5
  51. player.jumping = true
  52. end
  53. player.y += player.vy
  54. player.vy += 0.5
  55. if (player.y > 112) then
  56. player.y = 112
  57. player.vy = 0
  58. player.jumping = false
  59. end
  60. player.spr = (player.moves / 3) % 3 + 1
  61. if (player.x < 0) player.x = 0
  62. if (player.x > 1016) player.x = 1016
  63. end
  64. function draw_player()
  65. spr(player.spr,player.x,player.y,1,1,player.flipx)
  66. end
  67. -->8
  68. -- library
  69. black = 0
  70. dark_blue = 1
  71. dark_purple = 2
  72. dark_green = 3
  73. brown = 4
  74. dark_gray = 5
  75. light_gray = 6
  76. white = 7
  77. red = 8
  78. orange = 9
  79. yellow = 10
  80. green = 11
  81. blue = 12
  82. indigo = 13
  83. pink = 14
  84. peach = 15
  85. function print_ctr(s,y,c)
  86. print(s,64 - #s * 2,y,c)
  87. end
  88. __gfx__
  89. 00000000ffff00ffffff00ffffff00ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  90. 00000000fff0880ffff0880ffff0880f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  91. 00000000ffff800fffff800fffff800f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  92. 00000000fff0800800008008fff08008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  93. 00000000ff08888ff888888fff08888f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  94. 00000000f088888fff88888ff088888f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  95. 00000000088888fffff888ff088888ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  96. 00000000fff4f4fffff4f4ffff4f4fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  97. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  98. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  99. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  100. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  101. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  102. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  103. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  104. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  105. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  106. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  107. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  108. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  109. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  110. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  111. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  112. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  113. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  114. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  115. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  116. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  117. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  118. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  119. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  120. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  121. 44444444444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  122. 44444444444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  123. 14444441444444110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  124. 11144111114411110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  125. 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  126. 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  127. 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  128. 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  129. __gff__
  130. 0000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  131. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  132. __map__
  133. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  134. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  135. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  136. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  137. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  138. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  139. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  140. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  141. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  142. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  143. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
  144. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
  145. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  146. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  147. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  148. 4040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040