Im trying to make a particle physics engine and in it i am using the built in snap library called Object Oriented Programming or OOP to store data for each particle. Ive seen people use this to make a custom data thpe with a custom way of showing it like the neural networks library and someone’s computer algebra system. I want to know if there are any easy ways to do this, maybe with a single costume to display it as or having a list of costumes to animate. Let me know if anyone finds an easy way to do this
The way to do it is to make a _morph value as a callable grey ring. I’m pretty sure it has the same scope as all other object methods. It returns the representation, either a costume, text, or list. You might also want to look into the shapes library for generating a costume based off of the particle values.
Also, you can use _type as a key to make the type work better with the existing type blocks.
Thanks both of your suggestions worked and this will make my life way easier. While your here, could you guys tell me what the clone() block does
Oh and also what do the inputs of “field [field name] of [object]” do
If the field is a ring, it will pass those inputs in to the ring for the result (the field reporter checks the type of a value; if its a normal value it returns it, else for rings it executes them.)
Okay. Now i only need to know what clone() does and Im good.
Please stay on topic.
Another question, is it possible to make _morph field an animation, kinda like how in processes, the gears spin when the process in running
The gears in the thread icon is a animated symbol. (the symbols like in the menu buttons, or in blocks). Unless jens adds some extension for making SymbolMorphs, you cant
How do i use the clone block tho
I just realized that since the objects that these blocks return are functionally just lists, i can just make a list with the same format and it morphs just like expected
You create a clone using the create a clone of [myself V].
In order to control that clone, you place the desired script underneath a When I start as a clone block.
You could also make a clone using (a new clone of [myself V]
I think that was the question
No Im talking about the clone block in OOP. This topics purpose is just for OOP.
Its fine though
I think it creates a copy of the object
I know but i dont get what its for. What it seems like is exactky like the create abject block except before all of the normal inputs, there is a list input and whatever is inputted there is put in a new field at the beginning of the object called “…”
I habe no idea what that is for. Its just a list ikoit and the same style of inputing with the object block
a clone is not a copy, but a copy-on-write object, that delegates tasks it doesn’t handle itself to another prototype object, a concept also known as “inheritance”.
Check out the delegation paper by Henry Lieberman which describes the concept.
So then what do i input where if i want to test this out