Setting width of objects while turning

Hi everyone, just this problem is going to be really hard to explain without being able to show you exactly what I mean, but I'll do my best and if I confuse you so please tell me!

I am working to set up a game at the present time that is similar in many ways to the mini-golf (or mini-golf, depending on where you come from). It shows a side view and play the user must select the ball by pressing the mouse, and then drag the mouse to indicate the direction that they want to shoot the ball in. The distance that they drag the mouse (it has a limit of course) determines the power of their shot.

I currently use a triangular object with the point placed in the center of the ball to show the user the direction they have chosen. This triangle turns to deal with the position of the mouse, and I am trying to lengthen/shorten the distance between the mouse and the balloon-based. I have the code in place (below) that works when the mouse is either left or right side of the ball, but has rather strangely when the mouse is above or below the ball. When the mouse is in one of the last locations, the triangle extends to be much greater than the maximum length allowed by the program, but a trace shows that it is still within acceptable limits! You can see what the problem is here? I almost start thinking that Flash is switching the attributes 'width' and 'length' autour when the object rotates of 90 or - 90 degrees!

The code I use is:

If (ballSelected)

{


trajectory.rotationZ = Math.atan2 ((mouseY-ball.y), (mouseX-ball.x))*180/Math.PI - 0.3;)
var tipPos:Point = new Point (trajectory.x, trajectory.y); The position of the tip of the triangle
var mousePos:Point = new Point (mouseX, mouseY); The position of the mouse
Trajectory.Width = methods Point.distance (mousePos, tipPos); Need sorting
trace ("affecting width:" + trajectory.width);
If the maximum size of //Limit (trajectory.width > 200)
{


Trajectory.Width = 200;


}

}

Here are a few screenshots of the game as it is also - please do not laugh at the art of the horrible placeholder currently: none of this is final haha (note also that I did not implement 'gravity' yet, so everything is sort of glide through the air.) The first image shows the code works as I want what it with the triangle to its maximum width, the second shows the triangle's "enormous."

GameWorking.png

GameNotWorking.png

Yes, it seems that there is something wonky with the width property. However setting the scaleX property seems to work for me. I'm not sure why you are simply by changing a single dimension of a movieclip to represent a "trajectory", but it seems to work for me:

var path: MovieClip;
var ball: MovieClip;

Trajectory.x = ball.x;
Ball.y = trajectory.y;

stage.addEventListener (Event.ENTER_FRAME, rotate);

function rotate(e:Event) {}
Trajectory.rotation = Math.atan2 (mouseY - ball.y, mouseX - ball.x) * 180 / Math.PI;
var dx:Number = mouseX - trajectory.x;
var dy:Number = mouseY - trajectory.y;
var dist:Number = Math.sqrt (dx * dx + dy * dy) / 200
Dist trajectory.scaleX =<2 dist="" :="">
}

You can use the Point class to determine the distance, but I think it could be faster.

I'd probably actually use the drawing api to draw the triangle that I wanted, but since I don't know exactly what you are trying to accomplish...

Tags: Adobe Animate

Similar Questions

  • Duplicate an object while turning

    I can duplicate an object by pressing ALT and dragging the object, but when I try to reproduce an object by pressing the ALT and turning manually, Illustrator rotates but does not duplicate the object. I use the selection tool to rotate (it does work when I use the Rotate tool to rotate)

    Someone knows a trick to reproduce everything by rotating an object using the selection tool?

    You would think alt portfolio would do that, but alas...

    I don't know if he doesn't do it with just 1 key but it's what I do.

    • Select
    • CTRL c (copy)
    • CTRL f (stick forward)
    • then rotate

    Also, I know this isn't quite an answer to your question, but if you try to create several sizes of repetition of a form like this:

    Therehere is it turn of the tilde.

    But it is not useful for anything, just fun.

    Hope that helps

  • I get this error while turning on the firewall manually ": {26EE0668-A00A-44D7-9371-BEB064C98683}\3\::{4026492F-2F69-46B8-B9BF-5654FCO7E423}" "."

    I get this error while turning on the firewall manually

    Here are a few steps to try troubleshooting:
    http://Windows.Microsoft.com/en-us/Windows7/using-the-network-troubleshooter-in-Windows-7
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-network-connection-problems

    http://Windows.Microsoft.com/en-us/Windows7/cant-connect-to-a-network

    If those who do not work, let us know exactly what is happening and when.
    B Eddie

  • Error message: "Preparation set up windows, do not turn off your computer" when to stop the system.

    Original title: closure of the problem

    Almost everytime I turn off my laptop, I get the message ' Preparation set up windows, do not turn off your computer . Then it takes forever to finally stop. Suggestions for this problem?.

    Hi ArthurCosford,

    This screen appears when you have pending Windows updates must be installed on the system or when you installed the Windows updates on the system.

    Step 1:

    You can check the windows updates history to discover updates recently and failed to install.

    For more information, you can consult the following article:

    See the Windows updates are installed

    Step 2:

    If there are updates failed, then try to download and install the stand-alone package with updates from the Microsoft Download Center.

    a. to download updates from the Microsoft Download Center

    b. Enter the item number in the field search and download the same.

    c. double-click on the downloaded file.

    d. click on run and follow the wizard to install it.

    Hope this information is useful.

  • My computer is stuck on the preparation set up windows do not turn off the computer__

    I bought a new Toshiba Harvey Normans form - everything was going well until I turned the thing on and comes from this sign prepare to set up windows do not turn off the computer - 30 hours so far... everybody is why if there is a problem is - it may not be fixed. I cannot F8 or do something because when you stop and restart the computer, what happens with the same... also say how I get to the menu restore when I can't cross the saying prepares to set up etc etc, I'm typing this from my old computer and I get very very stressed to this topic

    Take it back to Harvey Normans. ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Is it possible to set up a computer to turn on and turn off itself every day or on any selected date?

    Is it possible to set up a computer to turn on and turn off itself every day or on any selected date?

    Mine is a HP G72-b27CL running Windows 7 64 bit laptop.

    Yes can schedule a task to start the system using the option shown in the screenshot below:

    You can schedule a task to turn the system off by as shown in the link below:

    http://www.thespinningdonut.com/how-to-automatically-shut-down-your-Windows-7-computer/

  • While turning on the laptop its gives me a message "your pc will restart in two days for the installation of updates.

    About a week ago I just bought windows mobile 8 is installed. Now for the last two days while turning on the laptop its gives me a message "your pc will restart in two days for the installation of updates.

    To stop, I get three option 1) sleep 2) arrested update 3) and close

    What should I do?

    Original title: windows update issue 8.

    Hi Parichay,

    The updates that are being invited to install are automatic updates.

    The message you get is offered by Windows 8 after that updates are downloaded and installed.

    If you do not restart your computer soon, Windows will force a restart of your computer two days after that it has installed new updates to complete their installation.

    You must restart your computer at a convenient time for you, rather than wait two days and have it suddenly reboot maybe at an inopportune time.

    Hope that solves your problem.

  • How to disable the Message box 'the current compatibility setting is not supported. Turn off compatibility view before you run this web page.

    Hi all

    Since a few days, we are on 11.1.2.3.500 and using IE 11. In IE 11, we can use Oracle EPM Suite only in Enterprise Mode, otherwise only "Bindows" appears. Now, my question is how can I disable (or remove) the Popup Message "the current compatibility setting is not supported. Turn off compatibility view before you run this web page. "because it's really embarrassing that this message whenever I start a planning application, Manager of calc or what ever.

    Thanks a lot for your help.

    Kind regards

    André

    You can go to tools > compatibility view settings and you should be able to remove the Web site / uncheck compatibility view so that you won't get this message

    HTH

    Amarnath

    ORACLE | Essbase

  • How can I set width or height of an object?

    Hi guys,.

    y at - it a simple method to define a width/height of an object in absolute terms without messing with .geometricBounds?

    Something like this:

    app.activeDocument.selection [0] .width = "150 mm;

    or

    app.activeDocument.selection [0] .width ("150 mm", ConstrainProportion.Yes, AnchorPoint.bottomLeftAnchor);

    The object is in my case, usually a vector image copied from Illustrator.

    PanDulka

    > Don't have you by any chance version of CS3?

    In this case to use the PageItem.transform () method in an same special way.

    Try this:

    function setWidthHeightCS3(/*PageItem*/o, /*str*/w, /*str*/h, /*bool=false*/useVisibleBounds)
    {
        if( !o.transform) return;
    
        var CS_INNER = CoordinateSpaces.INNER_COORDINATES,
            BB = BoundingBoxLimits[(useVisibleBounds?'OUTER_STROKE':'GEOMETRIC_PATH') + '_BOUNDS'];
    
        var wPt = UnitValue(w).as('pt'),
            hPt = UnitValue(h).as('pt');
    
        if( 0 >= wPt || 0 >= hPt ) return;
    
        var wsBkp = app.transformPreferences.whenScaling,
            a = o.resolve([[1,1], BB], CS_INNER)[0].
                concat(o.resolve([[0,0], BB], CS_INNER)[0]),
            sx = wPt / (a[2]-a[0]),
            sy = hPt / (a[3]-a[1]);
    
        app.transformPreferences.whenScaling = WhenScalingOptions.APPLY_TO_CONTENT;
    
        o.transform(
            CS_INNER,
            AnchorPoint.CENTER_ANCHOR,
            [sx,0,0,sy,0,0],
            MatrixContent.SCALE_VALUES
            );
    
        app.transformPreferences.whenScaling = wsBkp;
    }
    
    // Sample code
    // ---
    setWidthHeightCS3(app.selection[0], "5cm", "100pt");
    

    @+

    Marc

  • Spinning object around while turning around another object?

    How can these movements at the same time ? (THE ARROWS ARE JUST TO EXPLAIN WHAT IS THE MOVEMENT, THE ONLY OBJECTS ON THE SCREEN ARE THE STARS) The blue arrows represent the movement of all the stars around the center of the circle, and the Red arrows represent the movement of each star around its own Center?

    star.PNG

    Make the star.  Make a layer; its default anchor point position the exact Center of the model.  Place the star too far from the null value as you like it and that parent to null.  Animate the rotation of the null value.  Animate the rotation of the star.  Fact.

  • Select several files and store in table: folder object type turns into a string?

    Hello

    I'm trying to implement the following:

    The user selects a folder (which contains subfolders) in a dialog box:

    Set Dateiauswahl = CreateObject. BrowseForFolder (0, "Verzeichnis Park", 512, mess_path)

    Folder value = CreateObject ("Scripting.FileSystemObject"). GetFolder (Dateiauswahl.Self.Path)

    All subfolders of the selected folders are listed in two variables with the overall picture:

    Call GlobalDim ("FolderList (" & Ordner.SubFolders.Count - 1 & "" ")" ")

    Call GlobalDim ("FolderPaths (" & Ordner.SubFolders.Count - 1 & "" ")" ")

    f = 0
    for each Unterordner in Ordner.SubFolders
    FolderList (f) = Unterordner.Name
    FolderPaths (f) = Unterordner
    f = f + 1

    next

    Only later the files of some of the subfolders should be stored in another file list table:

    f = 0
    for q = 0 to UBound (selection)
    Unterordner = FolderPaths (selection (q))
    Call MsgBox (Unterordner)
    For each file in Unterordner.Files
    If instr (1, File.Name, "Speed") = 0 then
    FileList (f) = File.Path
    f = f + 1
    end if
    Next

    next

    Now I seem to have a problem with the type data stored in the FolderPaths table. While Unterordner is a Folder object and must be a Folder object for each file in Unterordner.Files to work, store in the array it transformed into a string variable.

    I don't really understand why and am looking for a solution so that I can extract single table FolderPaths subfolders and then extract the files.

    Hi maliya,.

    To assign an object to an array element (or any other variable), you must use the Set syntax, like this:

    Set FolderPaths (f) = Unterordner

    Then later you can retrieve it with the same syntax:

    Set Unterordner = FolderPaths (selection (q))

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • BlackBerry Smartphones set to screen on while charging?

    I have a Storm 9530.

    Is there a setting somewhere that will make the screen lit while charging?  For example, when the phone is plugged into a charger and listen to MP3 files or lazy, I don't want the display turns off.

    You may need an application separate from third parties such as the ' let it we ' pretty sure its available in App World

  • 100% width for objects

    I was not able to find answers in the forum or the FAQ at the following. I have a Web site up, which is under construction. As seen on the http://idlefreevt.org/idlefreecalifornia/homepage, not to mention the image background and text, there is a white, created banner as a rectangle on the master page, as well as a photograph placed on the home page. I wish I had these extend into the full width of the browser window (100%). I use version 2014.3 of CC (I have an older computer/OS) and the 100% width button is enabled for both of these objects. Is there a way to show their scope?

    I found the answer in this discussion: css - Adobe Muse: how body to 100% width style?-stack overflow

    In particular this comment:

    There is a way to make something 100% the width of a browser. It is not so obvious and it is hidden:

    1. draw a rectangular area and fill the box with photo (suitable size), color set to None.

    2 size the rectangular box to the same width of the canvas (page size).

    The combination of the above active 100% width on the object.

    I would add that just put up a picture does not activate the button of width 100% - it remains greyed out. The key is to draw the rectangle and add the image in the filling. This activates the button, and viola, it works.

    It's disappointing, there was no help with this... Fortunately I found the answers myself.

  • 100% width image/object re - adjusting evil

    I work on this site since Photobird air Vision and that you ran into a challenge.

    When I go to the online site to full screen on your desktop or laptop, it looks great. But if the Web browser is adjusted to fill... say 2/3 of the screen, the site adapts to the funky smaller size. My images should align to Center and fill 100% of the size of the browser width. I lined up, dragged the edges over the entire width and clicked the button for objects to be "100% width." Instead to the small size of the screen, however, a white column appears right on the page and shows some parts of the site work bad... images with scroll effects are stretching the width full page but are not the objects set to width full page. I've included a screenshot.

    Can someone help me understand how to solve this problem?

    PS - This is the desktop version of the site I'm talking about so you wont see what I mean on a phone.

    Thank you in advance for your help!

    Lisa

    Screen Shot 2015-10-06 at 12.11.18 PM.png

    Have you set your image of "scale to fill? (under the "editing:" menu item)

  • Movement of an object that turns off the Tracking screen?

    Thoght I saw someone in a tutorial, adjust the location of marker of track with a modifier key.  Then I found this: effects http://vfxhaiku.com/2011/12/how-to-track-an-object-that-goes-off-screen-with-adobe-after-e /

    And the bottom of the comments, someone said this:

    "D.S. Says:

    There's a thing in AE, so you don't have to guess after follow-up.
    Hold down the alt/option key while dragging to the new trackmark. AE automatically knows that you choose a new and done a track without sewing. »

    I can't get this to work. Anyone know the correct way to do this?

    Thank you!

    Personally, I would use mocha. It will do a much better job in less time, and past outside of objects are not problems.

    If you use AE tracker then you want to move the area of follow-up in the Alt/Option key while doing drag the cross at the center of the area of follow-up after the cursor change but not while on the anchor.

    If you need to adjust the anchor and then not hold down a modifier key, place the cursor just until the cursor turns into a smaller cross with the kind of white outline. Big cross moving surface, small removals cross anchor.

Maybe you are looking for