123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- -- Define a table with the values of the first level
- Level = {
- ----------------------------------------------------
- -- Table to define the list of assets
- ----------------------------------------------------
- assets = {
- [0] =
- { type = "texture", id = "tilemap-texture", file = "assets/tilemaps/jungle.png" },
- { type = "texture", id = "chopper-texture", file = "assets/images/chopper-spritesheet.png" },
- { type = "texture", id = "tank-texture", file = "assets/images/tank-tiger-up.png" },
- { type = "texture", id = "bullet-texture", file = "assets/images/bullet.png" },
- { type = "font" , id = "pico8-font-5", file = "assets/fonts/pico8.ttf", font_size = 5 },
- { type = "font" , id = "pico8-font-10", file = "assets/fonts/pico8.ttf", font_size = 10 }
- },
- ----------------------------------------------------
- -- table to define the map config variables
- ----------------------------------------------------
- tilemap = {
- map_file = "assets/tilemaps/jungle.map",
- texture_asset_id = "tilemap-texture",
- num_rows = 20,
- num_cols = 25,
- tile_size = 32,
- scale = 2.0
- },
- ----------------------------------------------------
- -- table to define entities and their components
- ----------------------------------------------------
- entities = {
- [0] =
- {
- -- Player
- tag = "player",
- components = {
- transform = {
- position = { x = 242, y = 110 },
- scale = { x = 1.0, y = 1.0 },
- rotation = 0.0, -- degrees
- },
- rigidbody = {
- velocity = { x = 0.0, y = 0.0 }
- },
- sprite = {
- texture_asset_id = "chopper-texture",
- width = 32,
- height = 32,
- z_index = 4,
- fixed = false,
- src_rect_x = 0,
- src_rect_y = 0
- },
- animation = {
- num_frames = 2,
- speed_rate = 10 -- fps
- },
- boxcollider = {
- width = 32,
- height = 25,
- offset = { x = 0, y = 5 }
- },
- health = {
- health_percentage = 100
- },
- projectile_emitter = {
- projectile_velocity = { x = 200, y = 200 },
- projectile_duration = 10, -- seconds
- repeat_frequency = 0, -- seconds
- hit_percentage_damage = 10,
- friendly = true
- },
- keyboard_controller = {
- up_velocity = { x = 0, y = -50 },
- right_velocity = { x = 50, y = 0 },
- down_velocity = { x = 0, y = 50 },
- left_velocity = { x = -50, y = 0 }
- },
- camera_follow = {
- follow = true
- }
- }
- },
- {
- -- Tank
- group = "enemies",
- components = {
- transform = {
- position = { x = 200, y = 497 },
- scale = { x = 1.0, y = 1.0 },
- rotation = 0.0, -- degrees
- },
- sprite = {
- texture_asset_id = "tank-texture",
- width = 32,
- height = 32,
- z_index = 2
- },
- boxcollider = {
- width = 25,
- height = 18,
- offset = { x = 0, y = 7 }
- },
- health = {
- health_percentage = 100
- },
- projectile_emitter = {
- projectile_velocity = { x = 100, y = 0 },
- projectile_duration = 2, -- seconds
- repeat_frequency = 1, -- seconds
- hit_percentage_damage = 20,
- friendly = false
- }
- }
- }
- }
- }
|