-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CATTY-552 Clone object or actor #1686
base: develop
Are you sure you want to change the base?
CATTY-552 Clone object or actor #1686
Conversation
874c252
to
734157d
Compare
9d9c4bc
to
db63258
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please compare the behavior of this simple program with Catroid: https://share.catrob.at/app/project/1271b6d4-4d3e-11ec-86de-005056a32daa
It seems like there is no clone on Catty.
db63258
to
c460c7f
Compare
c460c7f
to
eceedf7
Compare
808bd2e
to
8f713a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please don't use conditional statements without brackets when they only have one line, because errors can easily happen if in the future somebody wants to add a line.
And don't forget to update the license header year to 2022 for new files (PR for existing files will be merged soon)
|
||
for brick in oldScript.brickList { | ||
|
||
switch brick { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really make the Bricks, Scripts and Variables conform to NSCopying
and then just call .copy()
on generic objects instead of making gigantic switch cases. It's complicated to understand and this file would have to be edited for every new brick in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a "clone" function instead of using the copy functions. Because I pass the script as parameter and so I can set the member variables for the bricks. Some bricks need uservariable, userlist or other bricks and with the script I can set all these member var.
Jenkins please |
8f713a7
to
bb9ddfb
Compare
Jenkins, retest this please |
One more try, retest this please |
To introduce the "clone" metaphor as available in Catroid and Scratch, a new Brick should be developed to clone (a) the current object; or, (b) any other object except the background.
The Brick should be called "Create clone of" and it should be available at the Event category.
In the UI the Brick should contain a dropdown where the user can select between the following values:
yourself
the name of any other object, except the background
When executed, the object for which the Brick is being executed should get cloned. A clone should have the exact same position, scripts, bricks and all other effects which have already been applied to the object which is being cloned. Also, the local variables should be copied so that they (a) evaluate to the same value; but are (b) again local variables available for the clone only.
Later a new script should be triggered whenever a clone is created ("When you start as a clone"), but this is not part of that ticket. However, make sure to think about that and add the cloned object to the scheduler, so that any scripts are being executed (e.g., the "When tapped" script).