Level0.lua 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. -- Define a table with the values of the first level
  2. Level = {
  3. ----------------------------------------------------
  4. -- Table to define the list of assets
  5. ----------------------------------------------------
  6. assets = {
  7. [0] =
  8. { type = "texture", id = "tilemap-texture", file = "assets/tilemaps/jungle.png" },
  9. { type = "texture", id = "chopper-texture", file = "assets/images/chopper-spritesheet.png" },
  10. { type = "texture", id = "tank-texture", file = "assets/images/tank-tiger-up.png" },
  11. { type = "texture", id = "bullet-texture", file = "assets/images/bullet.png" },
  12. { type = "font" , id = "pico8-font-5", file = "assets/fonts/pico8.ttf", font_size = 5 },
  13. { type = "font" , id = "pico8-font-10", file = "assets/fonts/pico8.ttf", font_size = 10 }
  14. },
  15. ----------------------------------------------------
  16. -- table to define the map config variables
  17. ----------------------------------------------------
  18. tilemap = {
  19. map_file = "assets/tilemaps/jungle.map",
  20. texture_asset_id = "tilemap-texture",
  21. num_rows = 20,
  22. num_cols = 25,
  23. tile_size = 32,
  24. scale = 2.0
  25. },
  26. ----------------------------------------------------
  27. -- table to define entities and their components
  28. ----------------------------------------------------
  29. entities = {
  30. [0] =
  31. {
  32. -- Player
  33. tag = "player",
  34. components = {
  35. transform = {
  36. position = { x = 242, y = 110 },
  37. scale = { x = 1.0, y = 1.0 },
  38. rotation = 0.0, -- degrees
  39. },
  40. rigidbody = {
  41. velocity = { x = 0.0, y = 0.0 }
  42. },
  43. sprite = {
  44. texture_asset_id = "chopper-texture",
  45. width = 32,
  46. height = 32,
  47. z_index = 4,
  48. fixed = false,
  49. src_rect_x = 0,
  50. src_rect_y = 0
  51. },
  52. animation = {
  53. num_frames = 2,
  54. speed_rate = 10 -- fps
  55. },
  56. boxcollider = {
  57. width = 32,
  58. height = 25,
  59. offset = { x = 0, y = 5 }
  60. },
  61. health = {
  62. health_percentage = 100
  63. },
  64. projectile_emitter = {
  65. projectile_velocity = { x = 200, y = 200 },
  66. projectile_duration = 10, -- seconds
  67. repeat_frequency = 0, -- seconds
  68. hit_percentage_damage = 10,
  69. friendly = true
  70. },
  71. keyboard_controller = {
  72. up_velocity = { x = 0, y = -50 },
  73. right_velocity = { x = 50, y = 0 },
  74. down_velocity = { x = 0, y = 50 },
  75. left_velocity = { x = -50, y = 0 }
  76. },
  77. camera_follow = {
  78. follow = true
  79. }
  80. }
  81. },
  82. {
  83. -- Tank
  84. group = "enemies",
  85. components = {
  86. transform = {
  87. position = { x = 200, y = 497 },
  88. scale = { x = 1.0, y = 1.0 },
  89. rotation = 0.0, -- degrees
  90. },
  91. sprite = {
  92. texture_asset_id = "tank-texture",
  93. width = 32,
  94. height = 32,
  95. z_index = 2
  96. },
  97. boxcollider = {
  98. width = 25,
  99. height = 18,
  100. offset = { x = 0, y = 7 }
  101. },
  102. health = {
  103. health_percentage = 100
  104. },
  105. projectile_emitter = {
  106. projectile_velocity = { x = 100, y = 0 },
  107. projectile_duration = 2, -- seconds
  108. repeat_frequency = 1, -- seconds
  109. hit_percentage_damage = 20,
  110. friendly = false
  111. }
  112. }
  113. }
  114. }
  115. }