How do I select an instance of an object and rotate it

0 favourites
  • 12 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • basically what i want to do is to select an instance of and object when i touch it then when selected i want a small curved line to show up and when i drag the line the image instance rotates according to the line.

    in other words i want to rotate the object the same way i can before i run the layout.

    please i need this and fast!!

  • I'm not sure to fully understand what you mean.

    If you check out the how do I FAQ, you can probably mix some items like

    "Several RTS mechanics (camera movement, selecting units, etc...) - LINK"

    and

    "Resize handles on a sprite example - LINK"

    To make some kind of interface like your are looking for maybe ?

    As to rotate, it's based on the "Set angle" action of your objects/instances.

    Perhaps post a capx with a detailed explanation of your interface as you have it at the moment.

  • I think I understand what you mean. This "may" help or be relevant to what you want:

    Add the Touch element to your Layout then in the Event sheet:

    On Touched Sprite (Object you touched) > (Object you touched) Spawn Another Object (Line you want to use).

    On Touched Sprite (Line) > Set angle towards position (Line.X, Line.Y).

    This should set the angle of the sprite spawned towards the position of the line as you drag it.

    If you'd like to touch once and then the sprite gets attached to the touch of your finger and move around, I believe you'll need an Every Tick event and a variable.

    There is a .capx file attached for you to take a look at but uses mouse instead of Touch. I believe you'd be able to tailor it to your need.

    Hope that helps.

  • what i actually ment by a line is simply a curved line on the corner of my object that once i selected it and started dragging the exact instance of the object( since i have many instances) would rotate with the line towards the mouse.

    i mean exactly how you would re position and rotate any object in construct 2 before you run it.

  • i made allot of progress and got what i want if there was no instances of my object since now all of them rotate with the line and that is because i still didn't figure out how to pick both the line and the "instance" of the object at the same time.

  • i made allot of progress and got what i want if there was no instances of my object since now all of them rotate with the line and that is because i still didn't figure out how to pick both the line and the "instance" of the object at the same time.

  • Why not try a System > Pick instance based on UID? Or perhaps an expression?

  • i already did that. what i did is making a global variable that gets the uid of the object i click. so when i click something i pick it with this variable though my problem is picking 2 objects at once the line and the object instance

  • Why not have 2 variables (if you want to identify two objects). One variable is set with a condition that the Mouse On Object Click (sprite you want clicked) and the other would store the UID for the Mouse on Object Click (the line)?

    That way the first variable is only set with objects that are sprites and the second can only be changed by the line types. Would that work?

  • It would be simpler if you posted/attached your capx.

    From the get go we are supposed to follow your "progresses" based on your vague explanations.

    Anyway here's an example of implementation that should fit with what you need.

  • the capx wouldn't open for some reason. anyways thanks for everybody who tried to help i figured out it would be a hell allot easier if i simply made to buttons one that would rotate the selected object right and anothere that would rotate it left.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You probably couldn't open the capx because it was made in r175.

    That's what the error dialog probably told you when you tried to open it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)