I made a sphere revolving around the center, in a timer. I multiplied a sphere with a center (3) All three spheres are attached to one center. Although they have other centers. I have already done using object groups. Nothing helps.
It’s impossible to make this moment more operational. You just want to propagate the objects and that they would carry out the same logic but with those objects that were copied. It will greatly simplify life.
I think each object should be assigned an ID number-automatically.
In the program code, when the condition is met, execute the object ID in turn for each new group - the same action. That is, to distinguish between objects for events.
Could you help clarify what you’re trying to do?
So you have a sphere that’s attached to a point, and it moves? And now you want to copy the object and have them all move?
Yes. movement follows the formula, the action around the object. Depends on the variable to be changed using a timer. (on the screenshot how to do it). But I can’t make sure that the spheres (copied) are not attached to one center, but to those that are copied with them. How to do it. I thought it was a bug. The developer said to write on the forum.
this is the third time I come across copying objects. The first time everything was solved by adding objects to groups and working with groups. Here I can’t solve it in any way. It turns out that it is necessary to write separate code for each sphere and its center.
It’s hard to say for sure without having the game files to play with (and I don’t understand Russian so it’s hard to read the event action properly), but this is what I’m thinking:
If I want multiple objects following the same formula but around different points, I would add an object variable “center” to the object. Then when I create the copies, I’d store into the variable the center that the object is supposed to rotate around into “center”.
That way, each copy has its own definition of what “center” is.
Does this make sense?
I’m not quite sure I understood your issue, but when you want to differentiate instances, or apply an event to several instances of the same object, you have several options:
- assign an ID variable like you said in your first message.
- use object groups.
- use the “For each” event.
Sometimes, you will have to combine them.
I point out that this is a gigantic problem if we cannot safely copy objects. And you need to fence a forest of conditions.
In the construct2-3, I simply copied the objects and they work according to the same logic. We don’t specify anything. Also ClickTimeF2.5
in order to rotate an object around another I will have to collect an almost gigantic condition, and all for the sake of copying two objects, and if there are 100 of them.
For myself, I solved the problem with the rotation of the sphere. just placed its point / but copying objects with conditions is of course a problem. Or re-draw each object, and write conditions for each. Or get out with variables.
Here is an example of a clear problem copying objects. I make two identical spheres. Each has a set of points for collision. So the collision itself for some reason stupidly does not work. This is not the first time with a collision. I will fix it with a collision with a dot inside. I made the point rotate inside with animation, so that the player would probably be hurt. And what we see is triggered by only one sphere. The second does not touch us.
It’s normal, because you have several instances of the same object and the game doesn’t know which instance you are targeting. If you want to target all instances, use a for each event.
back to the problem of copying objects. My player takes one tank and drags it to the goal. If I copy the tank. The player drags two tanks. at the same time. And I need him to raise only one. How to do it???
This problem simply cuts off further attempts to make games. I can not solve the problem with this copying of objects. Creates an incredible hemorrhoids.
here is an example of working with construct2 - the copied objects contain a UID and this allows you to determine with a code what the player touches and what takes. That is, you can create a million copies and there will be no problems.
how to do it in Gdevelop5 & ??? objects do not contain a UID
There is no UID or unique identifer on instance.
For do that you can add a instance variable on left panel.
You can add your own variable called UID and give a number for the instance.
You need do same thing for each instances you want.
And in eventsheet you read the UID variable object.
I don’t know if it is exposed to the event sheet, but objects instances actually have a UID (runtimeObject.id/runtimeScene.getUniqueID())
It would be nice to have access to that
ooooh, but if the order depend of the order in object list or the first object loaded it’s not right to use this id, because the order can change.
If an event use a id who was changed, another object will be affected.
We need to be sure before add this id for public.
In the debugger, there are instance numbers, in order of creation. I assumed he was talking about these.
These could be useful, if only to avoid creating ID variables whenever we need them.
Number in profiler is indeed the unique id.
Try do modify one id of one object by changing parameters on object / instance on scene.
If number change we can’t trust this unique id for a instance given.