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.

136 lines
6.9 KiB

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. palt(black, false)
  16. palt(peach, true)
  17. init_world()
  18. end
  19. function _update()
  20. update_player()
  21. end
  22. function _draw()
  23. cls(12)
  24. draw_bg()
  25. draw_player()
  26. print_ctr("b o r b",8,yellow)
  27. end
  28. function draw_bg()
  29. for i=0,15 do
  30. spr(64,i*8,120)
  31. end
  32. end
  33. function update_player()
  34. if (btn(0)) then
  35. player.x -= 1
  36. player.moves += 1
  37. player.flipx = true
  38. end
  39. if (btn(1)) then
  40. player.x += 1
  41. player.moves += 1
  42. player.flipx = false
  43. end
  44. if (btnp(🅾️) and not player.jumping) then
  45. player.vy = -6
  46. player.jumping = true
  47. end
  48. player.y += player.vy
  49. player.vy += 0.5
  50. if (player.y > 112) then
  51. player.y = 112
  52. player.vy = 0
  53. player.jumping = false
  54. end
  55. player.spr = (player.moves / 3) % 3
  56. if (player.x < 0) player.x = 0
  57. if (player.x > 120) player.x = 120
  58. end
  59. function draw_player()
  60. spr(player.spr,player.x,player.y,1,1,player.flipx)
  61. end
  62. -->8
  63. -- library
  64. black = 0
  65. dark_blue = 1
  66. dark_purple = 2
  67. dark_green = 3
  68. brown = 4
  69. dark_gray = 5
  70. light_gray = 6
  71. white = 7
  72. red = 8
  73. orange = 9
  74. yellow = 10
  75. green = 11
  76. blue = 12
  77. indigo = 13
  78. pink = 14
  79. peach = 15
  80. function print_ctr(s,y,c)
  81. print(s,64 - #s * 2,y,c)
  82. end
  83. __gfx__
  84. ffff00ffffff00ffffff00ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  85. fff0880ffff0880ffff0880f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  86. ffff800fffff800fffff800f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  87. fff0800800008008fff0800800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  88. ff08888ff888888fff08888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  89. f088888fff88888ff088888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  90. 088888fffff888ff088888ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  91. fff4f4fffff4f4ffff4f4fff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  92. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  93. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  94. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  95. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  96. 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  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. 44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  117. 44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  118. 14444441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  119. 11144111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  120. 11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  121. 11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  122. 11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  123. 11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  124. __gff__
  125. 0000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  126. 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000