Difference between revisions of "Functions"

From The Powder Toy
Jump to: navigation, search
m (1 revision)
(No difference)

Revision as of 19:42, 28 September 2011

This is list of functions with their variables, every function is described. There is recommended to read article Hotkeys, it's helpful to understand description of some functions.

clear_area(int area_x, int area_y, int area_w, int area_h) - (like CTRL-Erase) Clears the area with height h and width w. (x,y) is the top left corner.

create_part(int p, int x, int y, int t) - Creates particle which type is t at [x,y]. For p use -1.

create_box(int x1, int y1, int x2, int y2, int c) - Creates rectangle (like CTRL in PT). x1, y1 is first corner position, x2,y2 is second corner position, c is particle type.

create_line(int x1, int y1, int x2, int y2, int r, int c) - Like create_box, but x1,y1,x2,y2 are line ends position.

delete_part(int x, int y) - Deletes part at defined position.

flood_parts(int x, int y, int c, int cm, int bm) - Flood fill. (x,y) is the location to start the fill. c is the particle type to fill(not the particle itself but the number ex. PT_DUST). set cm and bm to -1.

kill_part(int i) - Deletes particle i.(Does not use x,y location like delete_part)

nearest_part(int ci,int t) - Returns nearest particle of type t. ci is current particle.

parts_avg(int ci, int ni) - Returns the part in between the particles ci and ni.

part_change_type(int i, int x, int y, int t) - Changes type of particle i. t is new type, x is the x location of the particle, y is the y location of the particle.