random spawn obj scale

A

Ant

Guest
if you make a random spawn obj that spawns random sizes how do u make the obj horizontal size match vertical size wen spawning randomly different sizes?
 

Jakylgamer

Member
Welcome to the GMC :)

this creates an object with a temp variable (used as an id)
then we use that temp var (_obj) to set the x and y scale of the object
Code:
var  _obj = instance_create(x,y,obj_scaled);
_obj.image_yscale = random_range(1,2);
_obj.image_xscale = _obj.image_yscale;
 
A

Ant

Guest
Welcome to the GMC :)

this creates an object with a temp variable (used as an id)
then we use that temp var (_obj) to set the x and y scale of the object
Code:
var  _obj = instance_create(x,y,obj_scaled);
_obj.image_yscale = random_range(1,2);
_obj.image_xscale = _obj.image_yscale;
i keep getting
Object: planetspawn1 Event: Create at line 6 : unknown function or script _random_range
Object: planetspawn1 Event: Create at line 5 : unknown function or script instance_create
 
A

Ant

Guest
ah figured it out thanx for your help now i have a new problem wen the objects are on screen and the next ones spawn it re sizes my objects on screen
 

Jakylgamer

Member
you mean it affects all the objects in the room?
because if you did the code correctly from my post it should affect any object except the one being created.
 
A

Ant

Guest
I put the code in the object spawner in create
 
Last edited by a moderator:
A

Ant

Guest
you mean it affects all the objects in the room?
because if you did the code correctly from my post it should affect any object except the one being created.
it effects the objects I used ur code on wen there on screen I just want it to effect the objects if there x n y size don't match so there not squashed lol witch ur code helped me with but now wen there moving on screen there changing sizes I'm assuming it's the new spawnd copy's of that object that are changing the size of the ones on screen is there a way I can stop that ?
 
A

Ant

Guest
Ah I figured it out the code is in the object spawner to make the x n y size match and in the object it's self I put the random size 0.5
 
Top