Jump to content


verzigua

Member Since 09 Aug 2009
Offline Last Active Feb 26 2011 11:34 PM

Topics I've Started

Group Position*solved*

28 January 2010 - 10:35 AM

What i need is help on a group position system,

here's the idea for a basic formation L is leader and numbers are priority spots:

5|1|6
2|L|3
7|4|8

considering the group direction is from bottom right to top left.  So it will first fill in the closest spots to the leader (1,2,3,4) giving priority to be as close as possible and on front of the leader(always top) and then on the side of the direction it points to.

i can't figure out an algorithm to do so, and that's where i need help. (the number of units can be any, not only 9)

thanks

1 Instance Or Many

27 January 2010 - 03:20 PM

Well is it faster to have 1 instance using "with (objects)", or having each object performing? or is it the same performance wise?

this regarding just 1 step, a 1 time thing.

example:

obj_controller code: with (obj_block) motion_set(dir,speed);


or

obj_block user0 event: motion_set(dir,speed);

imagine there is 1 obj_controller and 500 obj_block

(that is just an example it's not something i'm doing)

Mp_grid Not Working

26 January 2010 - 07:12 PM

here's the deal i'm trying to do a path using mp_grid functions, and can't find what i'm doing wrong.

script(actually it does for ob1-14 and up to argument15):
//path_avoid(destx,desty,object1,...,object14);
xx=argument0;
yy=argument1;
ob1=argument2;
...

new_path=path_add();
new_grid=mp_grid_create(0,0,ceil(room_width/32),ceil(room_height/32),32,32);
if instance_exists(ob1) mp_grid_add_instances(new_grid,ob1,1);
...

mp_grid_path(new_grid,new_path,x,y,xx,yy,1);
mp_grid_destroy(id)

on step event of an object:
if (targetx!=x || targety!=y) && !path_exists(new_path){
	path_avoid(targetx,targety,obj_parent,obj_uparent,obj_bpa
rent,obj_rparent);
	path_start(new_path,spd,0,0);
	}
	//else if path_exists(new_path) path_delete(new_path);

it won't start moving on the path.

additional info
spd=4
room size 6400x4800

so can anyone tell me what am i doing wrong?

Parent

26 January 2010 - 05:19 PM

ok this may sound weird, but is there a built in variable for parent?

to put it better, to use depth you simply write "depth" is there the same variable for parent? (neither "parent" or "Parent" are that variable)

Find Nearest / Instance_place

23 January 2010 - 02:33 AM

Hello, i have 2 questions:
1. is there a way to find the nearest object sprite pixel instead of nearest object??(x,y of the pixel that stands closest to the point.)

2. is there a way to change the angle of my sprite so that instance_place(x,y,obj) checks for if the object was there but in a different angle?

thnks