Suppose I have 5 sprite object (A,B,C,D,E).
I want to create sprite randomly when I press left mouse button.But how can I make events to choose the objects? And I want the sprite’s name (A,B) only spawn only once. And I don’t want to create a object over another object. But I don’t know how to do that. Any help will be great.Thanks in advance.
I would use JavaScript.
I think its possible with Pick random object command…Please help me…you know I don’t know anything about coding.
May be make a variable “Random” !
On click trigger once- set value of “Random” to random in range of 1-5 ! Then if value of random =1 and no of obj 1 is <1 (if you want that object to spawn only once during the scene) → create obj 1. if 2 and no of obj2 <1 then create obj 2 …! And like this! I think this is what you wanted and hope this works!
Thanks a loooooooooooooooooooot! I have solve the random spawn system but I didn’t understand this quout…can you tell me the action and condition names?
Thanks it was helpful.
Value of scene variable =…
No of objects on scene =…
Bro sorry! I failed . Now I can create object Randomly. But Object (A & B) is not creating only once.
File link. Please help.
Send screenshot of the events
If you want something to happen only once, use trigger once
Do you want it to be created once per click (1)or once in the entire game/match(2)?
If you want to do (1) the put: Trigger once condition
If you want to do (2):
If the variable is 1 and you have to create obj 1:
Value of Scene variable is 1 &
No of *obj 1 * is <1
Trigger once---------->create obj 1
Note:This one will create no objects if you get variable 1 again and you already have obj 1 created before(you will have to put seperate events for that)
And if you dont want the objs to pile up on each other then just put a condition :The cursor or touch is on object (obj1,2…) and invert the condition
Hopefully this helped.
And I am sorry I dont have pc right now so I could not check the file you sent
Hey Thanks …And sorry for becoming so dumb. I am having this problem When value variable is 1 again no object is created.I want what action should I use when Number of obj A & B is = 1 and Value of variable is 1 & 2.
Make the variable Random in range again!! Do that cycle continues till you get 3 or 4 or…
I did that but sometime I click buttone but no object created.
Send screenshot of your event!
And do that event that i told you for every single object not just one!
You can Ignore the red area.
I have a object group named Random and a global variable named Random.
You can have the file here
I dont know what’s wrong ! Sorry but I think you should have got your result right if you did what I said! And again I am not on pc so I cant help much! Sorry
Its ok finally I tryed youre solution for last time and it worked! Thank you soo much for your help and kindness.