diff --git a/404.html b/404.html index b300e60..d8ba6d2 100644 --- a/404.html +++ b/404.html @@ -5,7 +5,7 @@
print()
",id:"print",level:3},{value:"print_debug_info()
",id:"print_debug_info",level:3},{value:"set_level_size()
",id:"set_level_size",level:3},{value:"add_wall()
",id:"add_wall",level:3},{value:"remove_wall()
",id:"remove_wall",level:3},{value:"add_update_callback()
",id:"add_update_callback",level:3},{value:"get_number_of_players()
",id:"get_number_of_players",level:3},{value:"increase_score_of_player()
",id:"increase_score_of_player",level:3},{value:"increase_score_streak_of_player()
",id:"increase_score_streak_of_player",level:3},{value:"get_score_streak_level()
",id:"get_score_streak_level",level:3},{value:"stop_game()
",id:"stop_game",level:3},{value:"get_player_inputs()
",id:"get_player_inputs",level:3},{value:"get_score_of_player()
",id:"get_score_of_player",level:3},{value:"configure_player()
",id:"configure_player",level:3},{value:"configure_player_hud()
",id:"configure_player_hud",level:3},{value:"get_player_configuration()
",id:"get_player_configuration",level:3},{value:"configure_player_ship_weapon()
",id:"configure_player_ship_weapon",level:3},{value:"add_damage_to_player_ship()
",id:"add_damage_to_player_ship",level:3},{value:"add_arrow_to_player_ship()
",id:"add_arrow_to_player_ship",level:3},{value:"remove_arrow_from_player_ship()
",id:"remove_arrow_from_player_ship",level:3},{value:"make_player_ship_transparent()
",id:"make_player_ship_transparent",level:3},{value:"set_player_ship_speed()
",id:"set_player_ship_speed",level:3},{value:"get_all_entities()
",id:"get_all_entities",level:3},{value:"get_entities_colliding_with_disk()
",id:"get_entities_colliding_with_disk",level:3},{value:"get_entity_count()
",id:"get_entity_count",level:3},{value:"get_entity_type()
",id:"get_entity_type",level:3},{value:"play_ambient_sound()
",id:"play_ambient_sound",level:3},{value:"play_sound()
",id:"play_sound",level:3},{value:"create_explosion()
",id:"create_explosion",level:3},{value:"new_asteroid()
",id:"new_asteroid",level:3},{value:"new_asteroid_with_size()
",id:"new_asteroid_with_size",level:3},{value:"new_baf()
",id:"new_baf",level:3},{value:"new_baf_red()
",id:"new_baf_red",level:3},{value:"new_baf_blue()
",id:"new_baf_blue",level:3},{value:"new_bomb()
",id:"new_bomb",level:3},{value:"new_bonus()
",id:"new_bonus",level:3},{value:"new_crowder()
",id:"new_crowder",level:3},{value:"new_floating_message()
",id:"new_floating_message",level:3},{value:"new_customizable_entity()
",id:"new_customizable_entity",level:3},{value:"new_inertiac()
",id:"new_inertiac",level:3},{value:"new_mothership()
",id:"new_mothership",level:3},{value:"new_pointonium()
",id:"new_pointonium",level:3},{value:"new_player_ship()
",id:"new_player_ship",level:3},{value:"new_player_bullet()
",id:"new_player_bullet",level:3},{value:"new_rolling_cube()
",id:"new_rolling_cube",level:3},{value:"new_rolling_sphere()
",id:"new_rolling_sphere",level:3},{value:"new_wary()
",id:"new_wary",level:3},{value:"new_ufo()
",id:"new_ufo",level:3},{value:"rolling_cube_set_enable_collisions_with_walls()
",id:"rolling_cube_set_enable_collisions_with_walls",level:3},{value:"ufo_set_enable_collisions_with_walls()
",id:"ufo_set_enable_collisions_with_walls",level:3},{value:"entity_get_position()
",id:"entity_get_position",level:3},{value:"entity_get_is_alive()
",id:"entity_get_is_alive",level:3},{value:"entity_get_is_started_to_be_destroyed()
",id:"entity_get_is_started_to_be_destroyed",level:3},{value:"entity_set_position()
",id:"entity_set_position",level:3},{value:"entity_set_radius()
",id:"entity_set_radius",level:3},{value:"entity_set_update_callback()
",id:"entity_set_update_callback",level:3},{value:"entity_destroy()
",id:"entity_destroy",level:3},{value:"entity_react_to_weapon()
",id:"entity_react_to_weapon",level:3},{value:"customizable_entity_set_position_interpolation()
",id:"customizable_entity_set_position_interpolation",level:3},{value:"customizable_entity_set_mesh()
",id:"customizable_entity_set_mesh",level:3},{value:"customizable_entity_set_flipping_meshes()
",id:"customizable_entity_set_flipping_meshes",level:3},{value:"customizable_entity_set_mesh_color()
",id:"customizable_entity_set_mesh_color",level:3},{value:"customizable_entity_set_string()
",id:"customizable_entity_set_string",level:3},{value:"customizable_entity_set_mesh_xyz()
",id:"customizable_entity_set_mesh_xyz",level:3},{value:"customizable_entity_set_mesh_z()
",id:"customizable_entity_set_mesh_z",level:3},{value:"customizable_entity_set_mesh_scale()
",id:"customizable_entity_set_mesh_scale",level:3},{value:"customizable_entity_set_mesh_xyz_scale()
",id:"customizable_entity_set_mesh_xyz_scale",level:3},{value:"customizable_entity_set_mesh_angle()
",id:"customizable_entity_set_mesh_angle",level:3},{value:"customizable_entity_skip_mesh_attributes_interpolation()
",id:"customizable_entity_skip_mesh_attributes_interpolation",level:3},{value:"customizable_entity_configure_music_response()
",id:"customizable_entity_configure_music_response",level:3},{value:"customizable_entity_add_rotation_to_mesh()
",id:"customizable_entity_add_rotation_to_mesh",level:3},{value:"customizable_entity_set_visibility_radius()
",id:"customizable_entity_set_visibility_radius",level:3},{value:"customizable_entity_configure_wall_collision()
",id:"customizable_entity_configure_wall_collision",level:3},{value:"customizable_entity_set_player_collision_callback()
",id:"customizable_entity_set_player_collision_callback",level:3},{value:"customizable_entity_set_weapon_collision_callback()
",id:"customizable_entity_set_weapon_collision_callback",level:3},{value:"customizable_entity_start_spawning()
",id:"customizable_entity_start_spawning",level:3},{value:"customizable_entity_start_exploding()
",id:"customizable_entity_start_exploding",level:3}];function r(e){const n={blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"pewpew-library",children:"pewpew library"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"pewpew"})," library contains all the functions for configuring levels and managing entities."]}),"\n",(0,t.jsx)(n.h2,{id:"enums",children:"Enums"}),"\n",(0,t.jsx)(n.h3,{id:"entitytype",children:"EntityType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"ASTEROID"}),"\n",(0,t.jsx)(n.li,{children:"BAF"}),"\n",(0,t.jsx)(n.li,{children:"INERTIAC"}),"\n",(0,t.jsx)(n.li,{children:"MOTHERSHIP"}),"\n",(0,t.jsx)(n.li,{children:"MOTHERSHIP_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"ROLLING_CUBE"}),"\n",(0,t.jsx)(n.li,{children:"ROLLING_SPHERE"}),"\n",(0,t.jsx)(n.li,{children:"UFO"}),"\n",(0,t.jsx)(n.li,{children:"WARY"}),"\n",(0,t.jsx)(n.li,{children:"CROWDER"}),"\n",(0,t.jsx)(n.li,{children:"CUSTOMIZABLE_ENTITY"}),"\n",(0,t.jsx)(n.li,{children:"SHIP"}),"\n",(0,t.jsx)(n.li,{children:"BOMB"}),"\n",(0,t.jsx)(n.li,{children:"BAF_BLUE"}),"\n",(0,t.jsx)(n.li,{children:"BAF_RED"}),"\n",(0,t.jsx)(n.li,{children:"WARY_MISSILE"}),"\n",(0,t.jsx)(n.li,{children:"UFO_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"PLAYER_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"BOMB_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"PLAYER_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"BONUS"}),"\n",(0,t.jsx)(n.li,{children:"FLOATING_MESSAGE"}),"\n",(0,t.jsx)(n.li,{children:"POINTONIUM"}),"\n",(0,t.jsx)(n.li,{children:"BONUS_IMPLOSION"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"mothershiptype",children:"MothershipType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"THREE_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"FOUR_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"FIVE_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"SIX_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"SEVEN_CORNERS"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cannontype",children:"CannonType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"SINGLE"}),"\n",(0,t.jsx)(n.li,{children:"TIC_TOC"}),"\n",(0,t.jsx)(n.li,{children:"DOUBLE"}),"\n",(0,t.jsx)(n.li,{children:"TRIPLE"}),"\n",(0,t.jsx)(n.li,{children:"FOUR_DIRECTIONS"}),"\n",(0,t.jsx)(n.li,{children:"DOUBLE_SWIPE"}),"\n",(0,t.jsx)(n.li,{children:"HEMISPHERE"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cannonfrequency",children:"CannonFrequency"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"FREQ_30"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_15"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_10"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_7_5"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_6"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_5"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_3"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_2"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_1"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"bombtype",children:"BombType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"FREEZE"}),"\n",(0,t.jsx)(n.li,{children:"REPULSIVE"}),"\n",(0,t.jsx)(n.li,{children:"ATOMIZE"}),"\n",(0,t.jsx)(n.li,{children:"SMALL_ATOMIZE"}),"\n",(0,t.jsx)(n.li,{children:"SMALL_FREEZE"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"bonustype",children:"BonusType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"REINSTANTIATION"}),"\n",(0,t.jsx)(n.li,{children:"SHIELD"}),"\n",(0,t.jsx)(n.li,{children:"SPEED"}),"\n",(0,t.jsx)(n.li,{children:"WEAPON"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"weapontype",children:"WeaponType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"BULLET"}),"\n",(0,t.jsx)(n.li,{children:"FREEZE_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"REPULSIVE_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"ATOMIZE_EXPLOSION"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"asteroidsize",children:"AsteroidSize"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"SMALL"}),"\n",(0,t.jsx)(n.li,{children:"MEDIUM"}),"\n",(0,t.jsx)(n.li,{children:"LARGE"}),"\n",(0,t.jsx)(n.li,{children:"VERY_LARGE"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,t.jsx)(n.h3,{id:"print",children:(0,t.jsx)(n.code,{children:"print()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.print(str: string)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Prints ",(0,t.jsx)(n.code,{children:"str"})," in the console for debugging."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local some_number = 42\npewpew.print("the value of some_number is: " .. some_number)\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"print_debug_info",children:(0,t.jsx)(n.code,{children:"print_debug_info()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.print_debug_info()\n"})}),"\n",(0,t.jsx)(n.p,{children:"Prints debug info: the number of entities created and the amount of memory used by the script."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.print_debug_info()\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_level_size",children:(0,t.jsx)(n.code,{children:"set_level_size()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.set_level_size(\n width: FixedPoint,\n height: FixedPoint\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Sets the level's size. Implicetely adds walls to make sure that entities can not go outside of the level's boundaries. ",(0,t.jsx)(n.code,{children:"width"})," and ",(0,t.jsx)(n.code,{children:"height"})," are clamped to the range ]0fx, 6000fx]. If this function is not called, the level size is (10fx, 10fx), which is uselessly small for most cases."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local width = 300fx\nlocal height = 200fx\npewpew.set_level_size(width, height)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_wall",children:(0,t.jsx)(n.code,{children:"add_wall()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_wall(\n start_x: FixedPoint,\n start_y: FixedPoint,\n end_x: FixedPoint,\n end_y: FixedPoint\n): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Adds a wall to the level from (",(0,t.jsx)(n.code,{children:"start_x"}),",",(0,t.jsx)(n.code,{children:"start_y"}),") to (",(0,t.jsx)(n.code,{children:"end_x"}),",",(0,t.jsx)(n.code,{children:"end_y"}),"), and returns its wall ID. A maximum of 200 walls can be added to a level."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.add_wall(100fx, 100fx, 200fx, 200fx)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"remove_wall",children:(0,t.jsx)(n.code,{children:"remove_wall()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.remove_wall(wall_id: int)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Remove the wall with the given ",(0,t.jsx)(n.code,{children:"wall_id"}),"."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local wall_id = pewpew.add_wall(100fx, 100fx, 200fx, 200fx)\n-- Later, when the wall needs to be removed:\npewpew.remove_wall(wall_id)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_update_callback",children:(0,t.jsx)(n.code,{children:"add_update_callback()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_update_callback(update_callback: function)\n"})}),"\n",(0,t.jsx)(n.p,{children:"Adds a callback that will be updated at each game tick."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local tick_count = 0\npewpew.add_update_callback(function()\n pewpew.print("this is tick " .. tick_count)\n tick_count = tick_count + 1\nend)\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_number_of_players",children:(0,t.jsx)(n.code,{children:"get_number_of_players()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_number_of_players(): int\n"})}),"\n",(0,t.jsx)(n.p,{children:"Returns the number of players in the game."}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"increase_score_of_player",children:(0,t.jsx)(n.code,{children:"increase_score_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.increase_score_of_player(\n player_index: int,\n delta: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Increases the score of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"})," by an amount of ",(0,t.jsx)(n.code,{children:"delta"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. Note that ",(0,t.jsx)(n.code,{children:"delta"})," can be negative."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"increase_score_streak_of_player",children:(0,t.jsx)(n.code,{children:"increase_score_streak_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.increase_score_streak_of_player(\n player_index: int,\n delta: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Increases the score streak counter of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"})," by an amount of ",(0,t.jsx)(n.code,{children:"delta"}),". This counter is used to determine at which level of score streak the player is at. In turn, the score streak level is used to determine how much pointonium is given. Typically the score streak counter should be increased when an enemy is destroyed with the same score that the enemy provide. ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. Note that ",(0,t.jsx)(n.code,{children:"delta"})," can be negative."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_score_streak_level",children:(0,t.jsx)(n.code,{children:"get_score_streak_level()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_score_streak_level(player_index: int): int\n"})}),"\n",(0,t.jsx)(n.p,{children:"Returns a number between 0 and 3. 0 is the lowest score streak (no pointonium is given), while 3 is the highest (3 pointoniums is usually given)"}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"stop_game",children:(0,t.jsx)(n.code,{children:"stop_game()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.stop_game()\n"})}),"\n",(0,t.jsx)(n.p,{children:"Ends the current game."}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_player_inputs",children:(0,t.jsx)(n.code,{children:"get_player_inputs()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_player_inputs(player_index: int): FixedPoint, FixedPoint, FixedPoint, FixedPoint\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns the inputs of the player at the specified ",(0,t.jsx)(n.code,{children:"index"}),". The return values are in order: the movement joystick's angle (between 0 and 2pi), the movement joystick's distance (between 0 and 1), the shoot joystick's angle (between 0 and 2pi), and the shoot joystick's distance (between 0 and 1)."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local move_angle, move_distance, shoot_angle, shoot_distance = pewpew.get_player_inputs(0)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_score_of_player",children:(0,t.jsx)(n.code,{children:"get_score_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_score_of_player(player_index: int): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns the score of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player",children:(0,t.jsx)(n.code,{children:"configure_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player(\n player_index: int,\n configuration: table {\n has_lost: bool,\n shield: int,\n camera_x_override: FixedPoint,\n camera_y_override: FixedPoint,\n camera_distance: FixedPoint,\n camera_rotation_x_axis: FixedPoint,\n move_joystick_color: int,\n shoot_joystick_color: int\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. A ",(0,t.jsx)(n.code,{children:"camera_distance"})," less than 0fx makes the camera move away from the ship. ",(0,t.jsx)(n.code,{children:"camera_rotation_x_axis"})," is in radian and rotates along the X axis.\nTo temporarily override the XY position of the camera, set ",(0,t.jsx)(n.strong,{children:"both"})," ",(0,t.jsx)(n.code,{children:"camera_x_override"})," and ",(0,t.jsx)(n.code,{children:"camera_y_override"}),"; this will make the camera be interpolated from wherever it was, to that new position."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.configure_player(0, {shield = 3, camera_distance = 50fx, move_joystick_color = 0xffff00ff})\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player_hud",children:(0,t.jsx)(n.code,{children:"configure_player_hud()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player_hud(\n player_index: int,\n configuration: table {\n top_left_line: string\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the player's HUD.",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'pewpew.configure_player_hud(0, {top_left_line = "Hello World"})\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_player_configuration",children:(0,t.jsx)(n.code,{children:"get_player_configuration()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_player_configuration(player_index: int): table {\n shield: int,\n has_lost: bool\n }\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns a map containing the configuration of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),"."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local shield = pewpew.get_player_configuration(0).shield\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player_ship_weapon",children:(0,t.jsx)(n.code,{children:"configure_player_ship_weapon()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player_ship_weapon(\n ship_id: EntityId,\n configuration: table {\n frequency: int,\n cannon: int,\n duration: int\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the weapon of the ship identified with ",(0,t.jsx)(n.code,{children:"ship_id"})," using ",(0,t.jsx)(n.code,{children:"configuration"}),". ",(0,t.jsx)(n.code,{children:"frequency"})," determines the frequency of the shots. ",(0,t.jsx)(n.code,{children:"cannon"})," determines the type of cannon. ",(0,t.jsx)(n.code,{children:"duration"})," determines the number of game ticks during which the weapon will be available. Once the duration expires, the weapon reverts to its permanent configuration. If ",(0,t.jsx)(n.code,{children:"duration"})," is omitted, the weapon will be permanently set to this configuration. If ",(0,t.jsx)(n.code,{children:"frequency"})," or ",(0,t.jsx)(n.code,{children:"cannon"})," is omitted, the ship is configured to not have any weapon."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local weapon_config = {frequency = pewpew.CannonFrequency.FREQ_10, cannon = pewpew.CannonType.DOUBLE}\nlocal ship_id = player_helpers.new_player_ship(100fx, 200fx, 0)\npewpew.configure_player_ship_weapon(ship_id, weapon_config)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_damage_to_player_ship",children:(0,t.jsx)(n.code,{children:"add_damage_to_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_damage_to_player_ship(\n ship_id: EntityId,\n damage: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reduces the amount of shield of the player that owns the ship by ",(0,t.jsx)(n.code,{children:"damage"})," points. If the player receives damage while having 0 shields left, the player loses."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_arrow_to_player_ship",children:(0,t.jsx)(n.code,{children:"add_arrow_to_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_arrow_to_player_ship(\n ship_id: EntityId,\n target_id: EntityId,\n color: int\n): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Adds an arrow to the ship identified with ",(0,t.jsx)(n.code,{children:"ship_id"})," pointing towards the entity identified with ",(0,t.jsx)(n.code,{children:"entity_id"}),", and returns the identifier of the arrow. ",(0,t.jsx)(n.code,{children:"color"})," specifies the arrow's color. The arrow is automatically removed when the target entity is destroyed."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"remove_arrow_from_player_ship",children:(0,t.jsx)(n.code,{children:"remove_arrow_from_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.remove_arrow_from_player_ship(\n ship_id: EntityId,\n arrow_id: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Removes the arrow identified by ",(0,t.jsx)(n.code,{children:"arrow_id"})," from the ship identified by ",(0,t.jsx)(n.code,{children:"ship_id"}),"."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"make_player_ship_transparent",children:(0,t.jsx)(n.code,{children:"make_player_ship_transparent()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.make_player_ship_transparent(\n ship_id: EntityId,\n transparency_duration: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Makes the player ship transparent for ",(0,t.jsx)(n.code,{children:"transparency_duration"})," game ticks."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_player_ship_speed",children:(0,t.jsx)(n.code,{children:"set_player_ship_speed()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.set_player_ship_speed(\n ship_id: EntityId,\n factor: FixedPoint,\n offset: FixedPoint,\n duration: int\n): FixedPoint\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Sets and returns the ",(0,t.jsx)(n.strong,{children:"effective speed"})," of the specified player ship as a function of the ",(0,t.jsx)(n.strong,{children:"base speed"})," of the ship. By default, a player ship moves according to its base speed, which is 10 distance units per tick (in the future, different ships may have different base speeds).\nAssuming the base speed of the ship is S, the new effective speed will be ",(0,t.jsx)(n.code,{children:"(factor*S)+offset"}),". ",(0,t.jsx)(n.code,{children:"duration"})," is the number of ticks during which the effective speed will be applied. Afterwards, the ship's speed reverts to its base speed. If ",(0,t.jsx)(n.code,{children:"duration"})," is negative, the effective speed never reverts to the base speed."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_all_entities",children:(0,t.jsx)(n.code,{children:"get_all_entities()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_all_entities(): Listprint()
",id:"print",level:3},{value:"print_debug_info()
",id:"print_debug_info",level:3},{value:"set_level_size()
",id:"set_level_size",level:3},{value:"add_wall()
",id:"add_wall",level:3},{value:"remove_wall()
",id:"remove_wall",level:3},{value:"add_update_callback()
",id:"add_update_callback",level:3},{value:"get_number_of_players()
",id:"get_number_of_players",level:3},{value:"increase_score_of_player()
",id:"increase_score_of_player",level:3},{value:"increase_score_streak_of_player()
",id:"increase_score_streak_of_player",level:3},{value:"get_score_streak_level()
",id:"get_score_streak_level",level:3},{value:"stop_game()
",id:"stop_game",level:3},{value:"get_player_inputs()
",id:"get_player_inputs",level:3},{value:"get_score_of_player()
",id:"get_score_of_player",level:3},{value:"configure_player()
",id:"configure_player",level:3},{value:"configure_player_hud()
",id:"configure_player_hud",level:3},{value:"get_player_configuration()
",id:"get_player_configuration",level:3},{value:"configure_player_ship_weapon()
",id:"configure_player_ship_weapon",level:3},{value:"add_damage_to_player_ship()
",id:"add_damage_to_player_ship",level:3},{value:"add_arrow_to_player_ship()
",id:"add_arrow_to_player_ship",level:3},{value:"remove_arrow_from_player_ship()
",id:"remove_arrow_from_player_ship",level:3},{value:"make_player_ship_transparent()
",id:"make_player_ship_transparent",level:3},{value:"set_player_ship_speed()
",id:"set_player_ship_speed",level:3},{value:"get_all_entities()
",id:"get_all_entities",level:3},{value:"get_entities_colliding_with_disk()
",id:"get_entities_colliding_with_disk",level:3},{value:"get_entity_count()
",id:"get_entity_count",level:3},{value:"get_entity_type()
",id:"get_entity_type",level:3},{value:"play_ambient_sound()
",id:"play_ambient_sound",level:3},{value:"play_sound()
",id:"play_sound",level:3},{value:"create_explosion()
",id:"create_explosion",level:3},{value:"new_asteroid()
",id:"new_asteroid",level:3},{value:"new_asteroid_with_size()
",id:"new_asteroid_with_size",level:3},{value:"new_baf()
",id:"new_baf",level:3},{value:"new_baf_red()
",id:"new_baf_red",level:3},{value:"new_baf_blue()
",id:"new_baf_blue",level:3},{value:"new_bomb()
",id:"new_bomb",level:3},{value:"new_bonus()
",id:"new_bonus",level:3},{value:"new_crowder()
",id:"new_crowder",level:3},{value:"new_floating_message()
",id:"new_floating_message",level:3},{value:"new_customizable_entity()
",id:"new_customizable_entity",level:3},{value:"new_inertiac()
",id:"new_inertiac",level:3},{value:"new_mothership()
",id:"new_mothership",level:3},{value:"new_pointonium()
",id:"new_pointonium",level:3},{value:"new_player_ship()
",id:"new_player_ship",level:3},{value:"new_player_bullet()
",id:"new_player_bullet",level:3},{value:"new_rolling_cube()
",id:"new_rolling_cube",level:3},{value:"new_rolling_sphere()
",id:"new_rolling_sphere",level:3},{value:"new_wary()
",id:"new_wary",level:3},{value:"new_ufo()
",id:"new_ufo",level:3},{value:"rolling_cube_set_enable_collisions_with_walls()
",id:"rolling_cube_set_enable_collisions_with_walls",level:3},{value:"ufo_set_enable_collisions_with_walls()
",id:"ufo_set_enable_collisions_with_walls",level:3},{value:"entity_get_position()
",id:"entity_get_position",level:3},{value:"entity_get_is_alive()
",id:"entity_get_is_alive",level:3},{value:"entity_get_is_started_to_be_destroyed()
",id:"entity_get_is_started_to_be_destroyed",level:3},{value:"entity_set_position()
",id:"entity_set_position",level:3},{value:"entity_set_radius()
",id:"entity_set_radius",level:3},{value:"entity_set_update_callback()
",id:"entity_set_update_callback",level:3},{value:"entity_destroy()
",id:"entity_destroy",level:3},{value:"entity_react_to_weapon()
",id:"entity_react_to_weapon",level:3},{value:"customizable_entity_set_position_interpolation()
",id:"customizable_entity_set_position_interpolation",level:3},{value:"customizable_entity_set_mesh()
",id:"customizable_entity_set_mesh",level:3},{value:"customizable_entity_set_flipping_meshes()
",id:"customizable_entity_set_flipping_meshes",level:3},{value:"customizable_entity_set_mesh_color()
",id:"customizable_entity_set_mesh_color",level:3},{value:"customizable_entity_set_string()
",id:"customizable_entity_set_string",level:3},{value:"customizable_entity_set_mesh_xyz()
",id:"customizable_entity_set_mesh_xyz",level:3},{value:"customizable_entity_set_mesh_z()
",id:"customizable_entity_set_mesh_z",level:3},{value:"customizable_entity_set_mesh_scale()
",id:"customizable_entity_set_mesh_scale",level:3},{value:"customizable_entity_set_mesh_xyz_scale()
",id:"customizable_entity_set_mesh_xyz_scale",level:3},{value:"customizable_entity_set_mesh_angle()
",id:"customizable_entity_set_mesh_angle",level:3},{value:"customizable_entity_skip_mesh_attributes_interpolation()
",id:"customizable_entity_skip_mesh_attributes_interpolation",level:3},{value:"customizable_entity_configure_music_response()
",id:"customizable_entity_configure_music_response",level:3},{value:"customizable_entity_add_rotation_to_mesh()
",id:"customizable_entity_add_rotation_to_mesh",level:3},{value:"customizable_entity_set_visibility_radius()
",id:"customizable_entity_set_visibility_radius",level:3},{value:"customizable_entity_configure_wall_collision()
",id:"customizable_entity_configure_wall_collision",level:3},{value:"customizable_entity_set_player_collision_callback()
",id:"customizable_entity_set_player_collision_callback",level:3},{value:"customizable_entity_set_weapon_collision_callback()
",id:"customizable_entity_set_weapon_collision_callback",level:3},{value:"customizable_entity_start_spawning()
",id:"customizable_entity_start_spawning",level:3},{value:"customizable_entity_start_exploding()
",id:"customizable_entity_start_exploding",level:3}];function r(e){const n={blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"pewpew-library",children:"pewpew library"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"pewpew"})," library contains all the functions for configuring levels and managing entities."]}),"\n",(0,t.jsx)(n.h2,{id:"enums",children:"Enums"}),"\n",(0,t.jsx)(n.h3,{id:"entitytype",children:"EntityType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"ASTEROID"}),"\n",(0,t.jsx)(n.li,{children:"BAF"}),"\n",(0,t.jsx)(n.li,{children:"INERTIAC"}),"\n",(0,t.jsx)(n.li,{children:"MOTHERSHIP"}),"\n",(0,t.jsx)(n.li,{children:"MOTHERSHIP_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"ROLLING_CUBE"}),"\n",(0,t.jsx)(n.li,{children:"ROLLING_SPHERE"}),"\n",(0,t.jsx)(n.li,{children:"UFO"}),"\n",(0,t.jsx)(n.li,{children:"WARY"}),"\n",(0,t.jsx)(n.li,{children:"CROWDER"}),"\n",(0,t.jsx)(n.li,{children:"CUSTOMIZABLE_ENTITY"}),"\n",(0,t.jsx)(n.li,{children:"SHIP"}),"\n",(0,t.jsx)(n.li,{children:"BOMB"}),"\n",(0,t.jsx)(n.li,{children:"BAF_BLUE"}),"\n",(0,t.jsx)(n.li,{children:"BAF_RED"}),"\n",(0,t.jsx)(n.li,{children:"WARY_MISSILE"}),"\n",(0,t.jsx)(n.li,{children:"UFO_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"PLAYER_BULLET"}),"\n",(0,t.jsx)(n.li,{children:"BOMB_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"PLAYER_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"BONUS"}),"\n",(0,t.jsx)(n.li,{children:"FLOATING_MESSAGE"}),"\n",(0,t.jsx)(n.li,{children:"POINTONIUM"}),"\n",(0,t.jsx)(n.li,{children:"BONUS_IMPLOSION"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"mothershiptype",children:"MothershipType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"THREE_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"FOUR_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"FIVE_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"SIX_CORNERS"}),"\n",(0,t.jsx)(n.li,{children:"SEVEN_CORNERS"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cannontype",children:"CannonType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"SINGLE"}),"\n",(0,t.jsx)(n.li,{children:"TIC_TOC"}),"\n",(0,t.jsx)(n.li,{children:"DOUBLE"}),"\n",(0,t.jsx)(n.li,{children:"TRIPLE"}),"\n",(0,t.jsx)(n.li,{children:"FOUR_DIRECTIONS"}),"\n",(0,t.jsx)(n.li,{children:"DOUBLE_SWIPE"}),"\n",(0,t.jsx)(n.li,{children:"HEMISPHERE"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cannonfrequency",children:"CannonFrequency"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"FREQ_30"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_15"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_10"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_7_5"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_6"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_5"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_3"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_2"}),"\n",(0,t.jsx)(n.li,{children:"FREQ_1"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"bombtype",children:"BombType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"FREEZE"}),"\n",(0,t.jsx)(n.li,{children:"REPULSIVE"}),"\n",(0,t.jsx)(n.li,{children:"ATOMIZE"}),"\n",(0,t.jsx)(n.li,{children:"SMALL_ATOMIZE"}),"\n",(0,t.jsx)(n.li,{children:"SMALL_FREEZE"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"bonustype",children:"BonusType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"REINSTANTIATION"}),"\n",(0,t.jsx)(n.li,{children:"SHIELD"}),"\n",(0,t.jsx)(n.li,{children:"SPEED"}),"\n",(0,t.jsx)(n.li,{children:"WEAPON"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"weapontype",children:"WeaponType"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"BULLET"}),"\n",(0,t.jsx)(n.li,{children:"FREEZE_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"REPULSIVE_EXPLOSION"}),"\n",(0,t.jsx)(n.li,{children:"ATOMIZE_EXPLOSION"}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"asteroidsize",children:"AsteroidSize"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"SMALL"}),"\n",(0,t.jsx)(n.li,{children:"MEDIUM"}),"\n",(0,t.jsx)(n.li,{children:"LARGE"}),"\n",(0,t.jsx)(n.li,{children:"VERY_LARGE"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,t.jsx)(n.h3,{id:"print",children:(0,t.jsx)(n.code,{children:"print()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.print(str: string)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Prints ",(0,t.jsx)(n.code,{children:"str"})," in the console for debugging."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local some_number = 42\npewpew.print("the value of some_number is: " .. some_number)\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"print_debug_info",children:(0,t.jsx)(n.code,{children:"print_debug_info()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.print_debug_info()\n"})}),"\n",(0,t.jsx)(n.p,{children:"Prints debug info: the number of entities created and the amount of memory used by the script."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.print_debug_info()\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_level_size",children:(0,t.jsx)(n.code,{children:"set_level_size()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.set_level_size(\n width: FixedPoint,\n height: FixedPoint\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Sets the level's size. Implicetely adds walls to make sure that entities can not go outside of the level's boundaries. ",(0,t.jsx)(n.code,{children:"width"})," and ",(0,t.jsx)(n.code,{children:"height"})," are clamped to the range ]0fx, 6000fx]. If this function is not called, the level size is (10fx, 10fx), which is uselessly small for most cases."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local width = 300fx\nlocal height = 200fx\npewpew.set_level_size(width, height)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_wall",children:(0,t.jsx)(n.code,{children:"add_wall()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_wall(\n start_x: FixedPoint,\n start_y: FixedPoint,\n end_x: FixedPoint,\n end_y: FixedPoint\n): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Adds a wall to the level from (",(0,t.jsx)(n.code,{children:"start_x"}),",",(0,t.jsx)(n.code,{children:"start_y"}),") to (",(0,t.jsx)(n.code,{children:"end_x"}),",",(0,t.jsx)(n.code,{children:"end_y"}),"), and returns its wall ID. A maximum of 200 walls can be added to a level."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.add_wall(100fx, 100fx, 200fx, 200fx)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"remove_wall",children:(0,t.jsx)(n.code,{children:"remove_wall()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.remove_wall(wall_id: int)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Remove the wall with the given ",(0,t.jsx)(n.code,{children:"wall_id"}),"."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local wall_id = pewpew.add_wall(100fx, 100fx, 200fx, 200fx)\n-- Later, when the wall needs to be removed:\npewpew.remove_wall(wall_id)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_update_callback",children:(0,t.jsx)(n.code,{children:"add_update_callback()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_update_callback(update_callback: function)\n"})}),"\n",(0,t.jsx)(n.p,{children:"Adds a callback that will be updated at each game tick."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local tick_count = 0\npewpew.add_update_callback(function()\n pewpew.print("this is tick " .. tick_count)\n tick_count = tick_count + 1\nend)\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_number_of_players",children:(0,t.jsx)(n.code,{children:"get_number_of_players()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_number_of_players(): int\n"})}),"\n",(0,t.jsx)(n.p,{children:"Returns the number of players in the game."}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"increase_score_of_player",children:(0,t.jsx)(n.code,{children:"increase_score_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.increase_score_of_player(\n player_index: int,\n delta: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Increases the score of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"})," by an amount of ",(0,t.jsx)(n.code,{children:"delta"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. Note that ",(0,t.jsx)(n.code,{children:"delta"})," can be negative."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"increase_score_streak_of_player",children:(0,t.jsx)(n.code,{children:"increase_score_streak_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.increase_score_streak_of_player(\n player_index: int,\n delta: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Increases the score streak counter of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"})," by an amount of ",(0,t.jsx)(n.code,{children:"delta"}),". This counter is used to determine at which level of score streak the player is at. In turn, the score streak level is used to determine how much pointonium is given. Typically the score streak counter should be increased when an enemy is destroyed with the same score that the enemy provide. ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. Note that ",(0,t.jsx)(n.code,{children:"delta"})," can be negative."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_score_streak_level",children:(0,t.jsx)(n.code,{children:"get_score_streak_level()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_score_streak_level(player_index: int): int\n"})}),"\n",(0,t.jsx)(n.p,{children:"Returns a number between 0 and 3. 0 is the lowest score streak (no pointonium is given), while 3 is the highest (3 pointoniums is usually given)"}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"stop_game",children:(0,t.jsx)(n.code,{children:"stop_game()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.stop_game()\n"})}),"\n",(0,t.jsx)(n.p,{children:"Ends the current game."}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_player_inputs",children:(0,t.jsx)(n.code,{children:"get_player_inputs()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_player_inputs(player_index: int): FixedPoint, FixedPoint, FixedPoint, FixedPoint\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns the inputs of the player at the specified ",(0,t.jsx)(n.code,{children:"index"}),". The return values are in order: the movement joystick's angle (between 0 and 2pi), the movement joystick's distance (between 0 and 1), the shoot joystick's angle (between 0 and 2pi), and the shoot joystick's distance (between 0 and 1)."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local move_angle, move_distance, shoot_angle, shoot_distance = pewpew.get_player_inputs(0)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_score_of_player",children:(0,t.jsx)(n.code,{children:"get_score_of_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_score_of_player(player_index: int): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns the score of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player",children:(0,t.jsx)(n.code,{children:"configure_player()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player(\n player_index: int,\n configuration: table {\n has_lost: bool,\n shield: int,\n camera_x_override: FixedPoint,\n camera_y_override: FixedPoint,\n camera_distance: FixedPoint,\n camera_rotation_x_axis: FixedPoint,\n move_joystick_color: int,\n shoot_joystick_color: int\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),". ",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]. A ",(0,t.jsx)(n.code,{children:"camera_distance"})," less than 0fx makes the camera move away from the ship. ",(0,t.jsx)(n.code,{children:"camera_rotation_x_axis"})," is in radian and rotates along the X axis.\nTo temporarily override the XY position of the camera, set ",(0,t.jsx)(n.strong,{children:"both"})," ",(0,t.jsx)(n.code,{children:"camera_x_override"})," and ",(0,t.jsx)(n.code,{children:"camera_y_override"}),"; this will make the camera be interpolated from wherever it was, to that new position."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"pewpew.configure_player(0, {shield = 3, camera_distance = 50fx, move_joystick_color = 0xffff00ff})\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player_hud",children:(0,t.jsx)(n.code,{children:"configure_player_hud()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player_hud(\n player_index: int,\n configuration: table {\n top_left_line: string\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the player's HUD.",(0,t.jsx)(n.code,{children:"player_index"})," must in the range [0, get_number_of_players() - 1]."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'pewpew.configure_player_hud(0, {top_left_line = "Hello World"})\n'})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_player_configuration",children:(0,t.jsx)(n.code,{children:"get_player_configuration()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_player_configuration(player_index: int): table {\n shield: int,\n has_lost: bool\n }\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Returns a map containing the configuration of the player at the specified ",(0,t.jsx)(n.code,{children:"player_index"}),"."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local shield = pewpew.get_player_configuration(0).shield\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"configure_player_ship_weapon",children:(0,t.jsx)(n.code,{children:"configure_player_ship_weapon()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.configure_player_ship_weapon(\n ship_id: EntityId,\n configuration: table {\n frequency: int,\n cannon: int,\n duration: int\n }\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Configures the weapon of the ship identified with ",(0,t.jsx)(n.code,{children:"ship_id"})," using ",(0,t.jsx)(n.code,{children:"configuration"}),". ",(0,t.jsx)(n.code,{children:"frequency"})," determines the frequency of the shots. ",(0,t.jsx)(n.code,{children:"cannon"})," determines the type of cannon. ",(0,t.jsx)(n.code,{children:"duration"})," determines the number of game ticks during which the weapon will be available. Once the duration expires, the weapon reverts to its permanent configuration. If ",(0,t.jsx)(n.code,{children:"duration"})," is omitted, the weapon will be permanently set to this configuration. If ",(0,t.jsx)(n.code,{children:"frequency"})," or ",(0,t.jsx)(n.code,{children:"cannon"})," is omitted, the ship is configured to not have any weapon."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local weapon_config = {frequency = pewpew.CannonFrequency.FREQ_10, cannon = pewpew.CannonType.DOUBLE}\nlocal ship_id = player_helpers.new_player_ship(100fx, 200fx, 0)\npewpew.configure_player_ship_weapon(ship_id, weapon_config)\n"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_damage_to_player_ship",children:(0,t.jsx)(n.code,{children:"add_damage_to_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_damage_to_player_ship(\n ship_id: EntityId,\n damage: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reduces the amount of shield of the player that owns the ship by ",(0,t.jsx)(n.code,{children:"damage"})," points. If the player receives damage while having 0 shields left, the player loses."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_arrow_to_player_ship",children:(0,t.jsx)(n.code,{children:"add_arrow_to_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.add_arrow_to_player_ship(\n ship_id: EntityId,\n target_id: EntityId,\n color: int\n): int\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Adds an arrow to the ship identified with ",(0,t.jsx)(n.code,{children:"ship_id"})," pointing towards the entity identified with ",(0,t.jsx)(n.code,{children:"entity_id"}),", and returns the identifier of the arrow. ",(0,t.jsx)(n.code,{children:"color"})," specifies the arrow's color. The arrow is automatically removed when the target entity is destroyed."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"remove_arrow_from_player_ship",children:(0,t.jsx)(n.code,{children:"remove_arrow_from_player_ship()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.remove_arrow_from_player_ship(\n ship_id: EntityId,\n arrow_id: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Removes the arrow identified by ",(0,t.jsx)(n.code,{children:"arrow_id"})," from the ship identified by ",(0,t.jsx)(n.code,{children:"ship_id"}),"."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"make_player_ship_transparent",children:(0,t.jsx)(n.code,{children:"make_player_ship_transparent()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.make_player_ship_transparent(\n ship_id: EntityId,\n transparency_duration: int\n)\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Makes the player ship transparent for ",(0,t.jsx)(n.code,{children:"transparency_duration"})," game ticks."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_player_ship_speed",children:(0,t.jsx)(n.code,{children:"set_player_ship_speed()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.set_player_ship_speed(\n ship_id: EntityId,\n factor: FixedPoint,\n offset: FixedPoint,\n duration: int\n): FixedPoint\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Sets and returns the ",(0,t.jsx)(n.strong,{children:"effective speed"})," of the specified player ship as a function of the ",(0,t.jsx)(n.strong,{children:"base speed"})," of the ship. By default, a player ship moves according to its base speed, which is 10 distance units per tick (in the future, different ships may have different base speeds).\nAssuming the base speed of the ship is S, the new effective speed will be ",(0,t.jsx)(n.code,{children:"(factor*S)+offset"}),". ",(0,t.jsx)(n.code,{children:"duration"})," is the number of ticks during which the effective speed will be applied. Afterwards, the ship's speed reverts to its base speed. If ",(0,t.jsx)(n.code,{children:"duration"})," is negative, the effective speed never reverts to the base speed."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_all_entities",children:(0,t.jsx)(n.code,{children:"get_all_entities()"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"pewpew.get_all_entities(): Listcustomizable_entity_skip_mesh_attributes_interpolation()
​pewpew.customizable_entity_skip_mesh_attributes_interpolation(entity_id: EntityId)
Skips the interpolation of the mesh's attributes (x, y, z, scale_x, scale_y, scale_z, rotation).
+Skips the interpolation of the mesh's attributes (x, y, z, scale_x, scale_y, scale_z, rotation) for one tick. Only applies to the attributes that were set before the call to customizable_entity_skip_mesh_attributes_interpolation
customizable_entity_configure_music_response()
​pewpew.customizable_entity_configure_music_response(
entity_id: EntityId,
config: table {
color_start: int,
color_end: int,
scale_x_start: FixedPoint,
scale_x_end: FixedPoint,
scale_y_start: FixedPoint,
scale_y_end: FixedPoint,
scale_z_start: FixedPoint,
scale_z_end: FixedPoint
}
)