C
Chris Livermore
Guest
hi guys and girls,
I am having some issues with a script I have made, Basically I want a space ship to drive up to a planet object and when its inside the diameter of the planet object get smaller (as if to land on the planet) I have got this working correctly
if distance_to_point(argument0.x,argument0.y) <=argument0.sprite_width {
argument1.image_xscale = distance_to_point(argument0.x,argument0.y) /argument0.sprite_width;
argument1.image_yscale = distance_to_point(argument0.x,argument0.y) /argument0.sprite_width;
}
if distance_to_point (argument0.x,argument0.y) <= 50 {
room_goto(argument2);
}
the problem is when I put this in my craft movement script it only detects the first planet I placed and all the others do not trigger.
I am calling it from a simple movement script as below:
if distance_to_object(obj_planet) <= obj_planet.sprite_width{
scr_enter_planet(obj_planet, obj_craft, room0);
}
any ideas? is it something to do with the fact I am comparing to obj_planet? should this be refering to all instances?
any help would be greatly appreciated!
I am having some issues with a script I have made, Basically I want a space ship to drive up to a planet object and when its inside the diameter of the planet object get smaller (as if to land on the planet) I have got this working correctly
if distance_to_point(argument0.x,argument0.y) <=argument0.sprite_width {
argument1.image_xscale = distance_to_point(argument0.x,argument0.y) /argument0.sprite_width;
argument1.image_yscale = distance_to_point(argument0.x,argument0.y) /argument0.sprite_width;
}
if distance_to_point (argument0.x,argument0.y) <= 50 {
room_goto(argument2);
}
the problem is when I put this in my craft movement script it only detects the first planet I placed and all the others do not trigger.
I am calling it from a simple movement script as below:
if distance_to_object(obj_planet) <= obj_planet.sprite_width{
scr_enter_planet(obj_planet, obj_craft, room0);
}
any ideas? is it something to do with the fact I am comparing to obj_planet? should this be refering to all instances?
any help would be greatly appreciated!