You are not logged in.
Pages: 1
Some code for when you need to fill in a ds_grid row all at once.
// fill in a ds_grid row with arguments
// 0 = ds var | 1 = current row | 2 = width | 3 = column 1... etc
var i;
// GRIDS START WITH 0
for(i = 0; i <= argument2; i+=1)
{
ds_grid_set(argument0, i, argument1, argument[i+3]);
}
Example usage.
//================================================================================
// PROPERTIES:
//================================================================================
// weapon name | assoc projectile | firing speed | spread | max projectiles | ..?
// (p/s) (deg) 0 = unlimited
//================================================================================
var WG,w,h;
// GRIDS START AT 0
// Meaning, 0 counts as 1 when setting w&h
// All FORS must be < NOT <=
w = 5; // number of properties
h = 6; // number of weapons
WG = ds_grid_create(w,h);
// bullets
row(WG,0,w, "gatling", p_bullet, 4, 5, 0);
row(WG,1,w, "machine", p_bullet, 6, 10, 0);
row(WG,2,w, "chain", p_bullet, 8, 15, 0);
// flak
row(WG,3,w, "shotgun", p_flak, 2, 40, 8);
row(WG,4,w, "dblsg", p_flak, 1.5, 50, 16);
row(WG,5,w, "flkcnn", p_flak, .75, 35, 20);
// rocket
row(WG,3,w, "rocket", p_rocket, 4, 40, 6);
Last edited by Burunduk (2009-03-04 16:32:47)
Offline
Pages: 1