W
Wuzzems
Guest
Create Event:
Step Event:
I have all of this code on one object, but as you can see I have two "time" variables. Only one "time" variable is being used at the moment and it's being used by all the instances of this object. I would like to assign basically all of this same code on different instances of the same object and just add more "time" variables to assign to all the different instances.
Any help is appreciated.
Code:
// pink block position
pinkposition = room_width - (room_width * 0.992);
// y position of current object instance
var yco = ((room_height/2)*1.5);
var ycoor = (room_height - yco)/2;
yposition = (room_height - ycoor);
// setting instance position
x = x;
y = yposition;
// setting distance
distance = point_distance(x, y, pinkposition, yposition);
// setting time
time = 240;
time2 = 480;
// setting speed
objectspeed = distance/time;
//outside room variable
outside = 0;
Code:
distance = point_distance(x, y, pinkposition, yposition);
if distance > objectspeed
{
move_towards_point(pinkposition,yposition,objectspeed);
}
else
{
x = x;
speed = 0;
outside = 1;
}
if (outside == 1)
{
move_towards_point(pinkposition - 2500, y, objectspeed);
}
Any help is appreciated.