How do loop uid object 10 degrees on left button mouse press

Get help using Construct 2

Post » Wed Apr 15, 2015 11:20 pm

Hi,

How it´s possible every time left button is pressed and rotate X degrees a objet uid (it´s the same sprite that repeat 3/4/5/6 twices?)

thanks
B
5
Posts: 33
Reputation: 299

Post » Wed Apr 15, 2015 11:27 pm

Code: Select all
On mouse left click
Pick object with UID = <Something>
--> Set Object.angle = Object.angle + 10
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Thu Apr 16, 2015 7:07 am

Image

Ok. i do like that but want repeat for every click. I´m confuse... for create loop

I try for each or while but i did it wrong always time have a bug. Thanks
B
5
Posts: 33
Reputation: 299

Post » Thu Apr 16, 2015 9:03 am

You should try to explain better what you are trying to do.

Point is, in the event itself you only reference the girar-object, but in the actions you have the Hbar-object, the IdHbar-object and the UIDToProperties object.
If any of the objects in the actions have more than one instance on the layout, there is no way for the program to know which one you mean.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 10:27 am

sorry. I try explain better .
1) I want the player can rotate a sprite each time is click with left button mouse... a few degrees every time for rotate 360º the object/sprite if he want.

2)The rotate object is a same simple sprite. Is for that, I must detect the UIDobject for informate the system wich object must be rotate. I detect the UIDobject whith the variable UidBar. This part is working.

En resume, i want a loop in left mouse button that can rotate each click the sprite/object select for UID.

Thanks.


Thanks.
B
5
Posts: 33
Reputation: 299

Post » Thu Apr 16, 2015 10:36 am

Ok so you just want to know how to add 10 degrees every time you click..

the action should be
object set angle - angle= object.angle+10

every time the button is clicked 10 degrees is added to the current angle of the object.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 1:14 pm

Image

I did like you said. But i lost UID unique and the all sprite rotate. if i did with my metod, Detect UID unique but only work one time (see the disable action in image)Hope you can mix the two for loop rotate and detect UID for a same sprite.
B
5
Posts: 33
Reputation: 299

Post » Thu Apr 16, 2015 1:34 pm

I think you are overcomplicating things.

I'm not sure why you'd remove the other actions and not just change the set angle.

Why are you not picking the right instance inside the event?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 4:23 pm

OK. I see it again de 0. For i can learn how you´ll make for you, can you put a file example how you ll do it with a same sprite (multiplicate this object x4 with create object ) and rotate 360º the object you select it.
B
5
Posts: 33
Reputation: 299

Post » Thu Apr 16, 2015 4:30 pm

I'd rather you upload your capx and explain what you are trying to do..

You have to tell the computer which sprite you want to rotate.
I don't see anything in your events telling the computer that.

The biggest issue is how you would like to select the right sprite.
There are many options for that.

- clicking on them and setting a variable
- adding them to a container, so the rotate button is always associated with that sprites
- other events concerning that sprite
- pick nearest
- pick by comparison.

If you know which sprite should be affected, there must be a way you can let the computer know.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher and 11 guests