I tried programming a rotate tool for my infinite building blocks but I couldn’t figure it out

questions
clones
answered
rotate

#1

I wanted to make a rotate tool for cloned building blocks in a new update of a project. How would i go about that?


#2
Welcome to the forum!

Welcome to the forum!

Just tag me if you need any help, and I know some cool fonts, too.

<a> makes aqua text </a>

Aqua!! There also used to be red, green, and blue colors, but I think it messed up the color scheme of the forum or something.

<thistextwillbeinvisibleaslongastherearejustletters>
You can just type random letters for that, too. Just keep the thingies at the end.

# type # and a space for big bold text

Big!

<big> makes big text </big>
Big!

<sub> makes low and small text </sub>
Regular text vs. sub text
There’s one to make the text high and small, too, but I forget it.

** this text will be bold **
Bold text!

*this text will be italicized*
Italics!

<s> strikethrough text </s>
Strikethrough!

<u>this text will be underlined</u>
Underlined text!
Okay, on second thought, maybe they deleted that font trick…

Here’s a link to a topic on more cool fonts, even though I probably covered a lot of them.

Oh, also don’t type @ and omtl together, unless you’re making a contest or something, you’ll tag 172 people. And members of the OMTL aren’t that happy when they get tagged for something like

Oops! Oops! Loop-de-loop!

And other pointless stuff like that. Be aware, there are guidelines on OMTL usage, and I suggest you read them. (Oh, and OMTL stands for Official Mass Tag List.)
If you want, you can join the OMTL here.
There should be a “join” button on that page somewhere, in addition to the OMTL guidelines.

And then there’s the POMTL (Project Official Mass Tag List), tagged by a person who made a project who would like constructive criticism or tips on improving on his or her coding. This one consists of 61 people.
You can join here.
Again, don’t tag it for random things and leave the OMTL and POMTL if you leave the forum.

Also, I strongly recommend going over the Community Guidelines, because if you break them, you’ll probably be suspended, and I have no idea how long that one user has gotten suspended for. Basically no bad words, be humble, try not to get in an argument or flame war, don’t give away personal information, don’t spam (post random stuff), and be positive. Oh, and put your General Topic in the #random-stuff category. (And you won’t be able to access that category until you’re of the Member trust level, which shouldn’t take to long to earn if you’re active.
Here’s a link:
Community Guidelines

So, you’re trying to make something like a slider or button that, when used, would make an object rotate?
@Petrichor, any tutorials?


#3

Hmm… you are at the right place to ask, but could you please share a link to your project or take a screenshot of your code and then upload it to here? Thanks! :slight_smile:


#4

Do i have to make a complicated ID system to only rotate 1 clone?


#5

Sorry, I’m not an advanced coder and don’t really know. :grimacing:
I hope you figure it out! :wink:


#6

Do you have a system for the spawning/placing of the blocks?


#7

Hey. Welcome to the forum.
Are you trying to make a slider that can rotate Clones of objects or what? I’m not entirely sure what you mean, so a screenshot of the project or code would be helpful, as William04GamerA said. If you provide a screenshot or explain what exactly you are trying to do,I might be able to help.

@Petrichor and @ThinBuffalo might be able to help (COAN and W04GA are already here, so theyll probably be able to help too)


#8

https://c.gethopscotch.com/p/zrqmxmcli
Instructions:
Tap a square to select it.
Press the arrows to rotate it.
Tap the square again to deselect it, or
Tap a different square to select it.

Very simple version you can copy off of. Just add the dragging program and you’ll be set.


Petrichor has done a great job of explaining, however the last two photos and captions are the ones that you will need to understand.
↓↓


#9

By cloned building blocks do you mean single clones, or stacked clones? Both are a similar process.


This is for single clones.




This screenshot is mainly to show you the code for the rotate button, but also shows you the two abilities inside the code for the blocks.



This is the clone ability. The first rule says that when any clone is tapped, it will ask if its clone index = 1. This details folder has an explanation of the clone index variable.
If it is the original, it creates a clone.
The second rule gives each clone a random color, then moves the clone to the last touch position. With this code, you’ll have to touch it again to drag it, but you probably already have that done, if you’re using something like this.



This image just shows the rules inside of the move object rule.



This is the drag rule. The first rule says that when self is tapped, set x offset to the distance between my x And the touch position x, then set y offset to the distance between my y position and the touch position y.
The last block in the first rule is used for rotation, and sets a variable of the original object to self clone index. You’ll see why later.
The second rule,a when pressed, checks if it is not the original object. If it isn’t, it sets position to last touch x minus x offset, last touch y minus y offset.
This drags it from the place you touched the object, and not the center.



This is the rotation custom rule. When the rotate button is pressed, check if the variable we set in the drag rule is still equal to my clone index, and if it is, then rotate.


https://c.gethopscotch.com/p/zrqnomepn



Hope this helps.