obj_one is already set up to generate the random x y #s so those variables are attached to obj_one
d&d or gml solution would be fine. thank you.
Edited by Piwaket, 08 May 2012 - 12:13 AM.
Posted 04 May 2012 - 06:05 PM
Edited by Piwaket, 08 May 2012 - 12:13 AM.
Posted 04 May 2012 - 06:19 PM
Posted 04 May 2012 - 06:21 PM
Posted 04 May 2012 - 06:25 PM
if !collision_ellipse(obj_two.x-var_rdx-50,obj_two.y-var_rdy-25,obj_two.x-var_rdx+50,obj_two.y-var_rdy+25,all,true,true).solidor
if !collision_ellipse(x-obj_one.var_rdx-50,y-obj_one.var_rdy-25,x-obj_one.var_rdx+50,y-obj_one.var_rdy+25,all,true,true).solid
Posted 04 May 2012 - 06:30 PM
im not going to code it all for you but check out, place_free and place_empty in the help file. or alternatively collision_circle
Edited by Piwaket, 04 May 2012 - 06:34 PM.
Posted 04 May 2012 - 06:44 PM
Is the alarm event in the first or second object?
Edited by Piwaket, 04 May 2012 - 06:59 PM.
Posted 04 May 2012 - 10:12 PM
if !collision_ellipse(obj_two.x-var_rdx-50,obj_two.y-var_rdy-25,obj_two.x-var_rdx+50,obj_two.y-var_rdy+25,all,true,true).solidorif !collision_ellipse(x-obj_one.var_rdx-50,y-obj_one.var_rdy-25,x-obj_one.var_rdx+50,y-obj_one.var_rdy+25,all,true,true).solid
Posted 04 May 2012 - 11:06 PM
Posted 05 May 2012 - 12:47 AM
Edited by Piwaket, 05 May 2012 - 04:08 AM.
Posted 05 May 2012 - 10:42 AM
anyway now im having another problem
Posted 06 May 2012 - 06:31 PM
anyway now im having another problem
and that is?
Edited by Piwaket, 06 May 2012 - 06:35 PM.
Posted 06 May 2012 - 06:45 PM
Edited by Jack Indie Box, 06 May 2012 - 06:48 PM.
Posted 06 May 2012 - 06:55 PM
direction can be >360 it keeps going round and round 360 being one loop
so store in each object a new direction variable called dir
if(point_distance(xprevious,yprevious,x,y))
{
dir=point_direction(xprevious,yprevious,x,y);//this will between 0 and 360
}
put that in step event, before you need to compare the 2 dir
or do it with math, which isnt fun(ive done it before as direction can be >360 or <0).
as for your jump to problem use:
xx=lengthdir_x(distance_to_move,dir_difference);
yy=lengthdir_y(distance_to_move,dir_difference);
Posted 06 May 2012 - 07:13 PM
Posted 06 May 2012 - 07:41 PM
var_dir = (point_direction(0,0,otherobject.x,otherobject.y)+180)
xx=lengthdir_x(distance_to_move,dir_difference); yy=lengthdir_y(distance_to_move,dir_difference);
Edited by Piwaket, 06 May 2012 - 07:47 PM.
Posted 06 May 2012 - 08:14 PM
Edited by Jack Indie Box, 06 May 2012 - 08:15 PM.
Posted 06 May 2012 - 11:18 PM
if collision_circle(0,0,50,solid,true,false)
{
if(point_distance(xprevious,yprevious,x,y))
{
dir=point_direction(xprevious,yprevious,x,y);//this will between 0 and 360
}
dir=dir+180
xx=lengthdir_x(1,dir);
yy=lengthdir_y(1,dir);
x=xx
y=yy
}i then stacked my object(a solid with a 100x100 circle sprite with precice mask, that code, and a variable called dir set to 0) on top of another solid(also with variable dir just in case), ran it....and nothing happened.Posted 07 May 2012 - 08:54 AM
which i thought you meant, dir of one object compared to dir of playeri want to get a direction of an object(relative to self)
Posted 07 May 2012 - 07:48 PM
i thought you wanted:
which i thought you meant, dir of one object compared to dir of playeri want to get a direction of an object(relative to self)
Edited by Piwaket, 07 May 2012 - 08:19 PM.
Posted 07 May 2012 - 08:57 PM
0 members, 0 guests, 0 anonymous users