#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# How to move an actor by dragging it and spinning it.

Posts: 140Member

basically, I am trying to understand the idea behind touching an actor then dragging his across the screen then once in position holding on it to rotate it or... if thats not possible, what way would you suggest to rotate it clockwise maybe a logo at the end of the actor with an arrow saying rotate?

thanks

«1

• Posts: 140Member

I managed to solve this but I cant seem to stop the dam thing rotating when moving.

• London, UK.Posts: 12,822Member

@sonicm3 said:
basically, I am trying to understand the idea behind touching an actor then dragging his across the screen then once in position holding on it to rotate it

Here's the basics:

When touch is pressed
--When magnitude between actor and mouse/touch > some value
----constrain rotation to vector to angle between actor and mouse/touch
--Otherwise
----constrain x to mouse x
----constrain y to mouse y

• Posts: 140Member

Hi I can move him fine, no problems at all its just I didnt want it rotating when moving, I want to rotate the actor once it stopped moving.
Should I write another rule?

• London, UK.Posts: 12,822Member
edited April 2016

@sonicm3 said:
Hi I can move him fine, no problems at all its just I didnt want it rotating when moving, I want to rotate the actor once it stopped moving.
Should I write another rule?

• Posts: 140Member

I have another way to do this, I will make a button to rotate the image or this could become a poor playing experience.
I can make touch is outside to spin this, but.. ideally is it possible to have actorbutton when touched, rotate actor1?

• London, UK.Posts: 12,822Member

@sonicm3 said:
I have another way to do this, I will make a button to rotate the image or this could become a poor playing experience.
I can make touch is outside to spin this, but.. ideally is it possible to have actorbutton when touched, rotate actor1?

You can do it in a number of ways, you could set it up so that clicking in the middle of the actor allows you to move it, while clicking toward the edges rotates it - or you could have a switch (an attribute) that is switched off until the actor has been moved, then it is switched on and once switched on touching the actor will now rotate it . . . . and so on, there are lots of ways of doing something like this.

• Posts: 140Member

Hi thanks for the input some great ideas there.
I think I will go with IF the last actor clicked needs to be the one rotated, can it be that the actorbuttonrotate when pressed can rotate actor1 clockwise (as that was the last one clicked and if i clicked actor 2 then the actorbuttonrotate it will rotate actor 2 clockwise as it would not rotate actor1 again as I now clicked actor2 before the actorbutton.

Do you have a possible set of rules I can try?

• Posts: 9,913Member

Make sure you have fixed rotation checked or an actor can rotate on it's own. By fixing the rotation it will on rotate when your code makes it rotate.

• Posts: 140Member

Hi thanks I added that now as it was unticked, so how would I get actorrotate when pressed rotate previous clicked actor?

• Posts: 140Member

Hi, I think I am going to scrap this idea as I have googled alot for the past hour and it seems its not a great way.

I can successfully move for example actor4 but once I have moved this to the position I am happy with, I want to click to the right of the actor to rotate him right and click the left to rotate him left.

• London, UK.Posts: 12,822Member

@sonicm3 said:
Hi, I think I am going to scrap this idea . . .

Did you try my suggestion above ?

• Posts: 140Member

Hi do you mean this?

Here's the basics:

When touch is pressed
--When magnitude between actor and mouse/touch > some value
----constrain rotation to vector to angle between actor and mouse/touch
--Otherwise
----constrain x to mouse x
----constrain y to mouse y

if so would this work for if I touch the left it will rotate left and if I touch the right of the actor it will rotate right?

still trying to work out the layout ect..

• Posts: 140Member
edited April 2016

can you post exactly what is required, at the moment the actor is only programmed to move on touch to where I drag it to.
http://s14.postimg.org/xq34dvixt/moveme.jpg

• London, UK.Posts: 12,822Member
edited April 2016

@sonicm3 said:
if so would this work for if I touch the left it will rotate left and if I touch the right of the actor it will rotate right?

That would be something of a small miracle, seeing as I posted my suggestion at 1:28 and it wasn't until 1:59 that you introduced the, as yet unmentioned, idea of the actor needing to be rotated both clockwise and counterclockwise (at this stage you were suggesting this would be done through 2 buttons) . . . so it's unlikely that my suggestion accommodates the ideas you have added after I posted it !

That's not how time works

@sonicm3 said:
can you post exactly what is required

A clear explanation of what you need the actor to do would be a good start, be as precise as you can.

• Posts: 140Member
edited April 2016

Hi all I need to do is touch the right of an actor and have it rotate clockwise and tap the left of an actor to have it rotate anti clockwise.
I have already added the successful drag movement to allow the actor to be dragged across the screen to place it in position.

Just a small note, I did add key commands such as left arrow rotates anti clockwise and right arrow rotates clockwise and worked well but this will be a game that will require touch commands.

also the reason I said would this do both anti clockwise and clockwise as when I asked for help with this you replied as did you check my idea so i assumed it did as I did say I decided to scrap the idea with button
The idea you stated would be a good idea but I just want to make it more user friendly know what I mean

• Posts: 1,483Member
edited April 2016

@sonicm3 said:
Hi all I need to do is touch the right of an actor and have it rotate clockwise and tap the left of an actor to have it rotate anti clockwise.

@sonicm3
Rule- if touch is pressed and game.mouse.position.x > self.position x , rotate clockwise
Rule- if touch is pressed and game.mouse.position.x < self.position x , rotate Counter-clockwise

Is this what you want ?

• London, UK.Posts: 12,822Member
edited April 2016

@sonicm3 said:
Hi all I need to do is touch the right of an actor and have it rotate clockwise and tap the left of an actor to have it rotate anti clockwise.

Make a Boolean self.attribute, let's call it 'A'.

Rule:

When Touch is pressed [&]
When A is false
--Constrain X to mouse X
--Constrain Y to mouse Y

Rule:

When Touch is released
--Change A to true

Rule:

When Touch is pressed [&]
When A is true
--When mouse X is > self position X
----Rotate clockwise
--Otherwise
----Rotate counter-clockwise

• Posts: 140Member

May I ask if your on windows or MAC and the version your using as I can create boolean, name it A, but the making self.attribe and rules on false I just dont see any of this..
I am using a trial version 3 days left would I have full access to features? I do intend to buy it anyhow.

• Posts: 140Member

Hi icebox yes but it wont work for me, would my move commands be effecting this as I copied the exact rules you did.

• Posts: 1,483Member

@sonicm3 try it with a new actor and see if it works , or turn some rules on and off to figure out where the problem is.

• Posts: 140Member
edited April 2016

Ok will do

• London, UK.Posts: 12,822Member
edited April 2016

//

• Posts: 1,483Member

I always wonder what this means // lol

• Posts: 140Member

Hi Icebox yes works perfectly when placed on a stripped down actor, must be an issue with my current code

• Posts: 140Member

Hi, I can not locate this error why I cant move a SIMPLE square from one end of the screen to the other then once stopped, click to rotate, I will even accept just rotating clockwise only.
The best I can get is move the square while rotating.
I have searched google and I can find similar questions but none answered.
Can someone do a simple quick mock up project so I can download an look at it, this has taken like all day.

thanks I really appreciate it.

• London, UK.Posts: 12,822Member
edited April 2016

@sonicm3 said:
Hi, I can not locate this error why I cant move a SIMPLE square from one end of the screen to the other then once stopped, click to rotate

Yes, it's quite straightforward, you can set it up in 30 seconds. Have you tried either of the two suggestions I've made ?

@sonicm3 said:
Hi, I can not locate this error . . .

No one can help you with this specific issue as the only information you've given is:

"but it wont work for me"

We don't know what that actually looks like, it could mean the actor won't move, or it moves but won't stop, or it rotates the wrong way, or it won't rotate at all, or it rotates and moves at the same time (etc etc), without feedback even simple questions turn into a drawn out guessing game.

• Posts: 140Member
edited April 2016

If it takes 30 seconds would you mind uploading an example so I can physically download it and view a square on touch moving then when stopped, click again or hold to rotate it?

Socks the issue is as stated a few times, I can move the actor fine.
I do not want the actor rotating while I am moving him.
Once I am happy with the position I then can rotate him fine which I can.
Its not a guessing game buddy, I have stated If someone can be so kind to do a simple example of a sqaure moving on touch and not rotating, then once stopped allow the same actor to be rotated both ways clock and anti clock if possible, if not clockwise is fine.
I have no clue what so ever I have only been on this for 1 day and still learning but this to you should be a walk in park 30 seconds, may I see an example of this please it would really help me.
thanks

• London, UK.Posts: 12,822Member
edited April 2016

//

• Posts: 1,483Member

@sonicm3

Try this method it might work

It is not the best method it only allows you to move the actor if you drag it from the middle so until u get what you want this should work.

• Posts: 140Member

I will try this now and thanks for your time Icebox, much appreciated.