How to calculate if an object is between two points

Okay so I'm an RTS game, and ive got my participants

displacement = false;

CheckIt = false;

startPt = {};

Start = {};

var i = 0;

Fill._alpha = 0.1;

onMouseDown = function() {}

move = true;

startPt.x = _xmouse;

startPt.y = _ymouse;

}

onMouseUp = function() {}

displacement = false;

CheckIt = true;

endPt.x = _xmouse;

endPt.y = _ymouse;

square_mc var = this.createEmptyMovieClip ("" + i, i ++);

square_mc.beginFill (Fill);

square_mc. MoveTo (startPt.x, startPt.y);

square_mc. LineStyle (4, 00000000, 50);

square_mc. LineTo (_root._xmouse, startPt.y);

square_mc. LineTo (_root._xmouse, _root._ymouse);

square_mc. LineTo (startPt.x, _root._ymouse);

square_mc. LineTo (startPt.x, startPt.y);

square_mc.endFill ();

square_mc = null;

}

onEnterFrame = function() {}

If (! dragging and checkit) {}

scroll through the objects and see if they are with startPt, endPt

CheckIt = false;

}

}

And I want to check if my workers are between the two points (well 4) of:

startPt.x

startPt.y

endPt.x

endPt.y

Ive tried this

If (_root.workers [i] ._x > startPt.x & & _root.workers [i] ._y > startPt.y & & _root.workers [i] ._x > endPt.x & & _root.workers [i] ._y > endPt.y | _root.workers [i] ._x < startPt.x & & _root.workers [i] ._y < startPt.y & & _root.workers [i] ._x > endPt.x & & _root.workers [i] ._y > endPt.y) {}

workers [i]. Selected = true;

Workers [i] .gotoFunction ();

}

But I don't think that it's actually calculate if the worker [i] is between these points.

so could someone please tell me how to calculate if my work is between these points, so I could do then selectable

Thanks in advance

I don't think you have this conditional is to check what you're saying, you want to check... try...

If (_root.workers [i] ._x > startPt.x & _root.workers [i] ._y > startPt.y & _root.workers [i] ._x)< endpt.x="" &&="" _root.workers[i]._y=""><>

Tags: Adobe Animate

Similar Questions

  • How to calculate the periods that overlap between two or more given the date range?

    Hi all

    If there are several durations then how we can calculate the period of time that overlap between these times.

    For example: for 3 time periods. 03/12/2015-16/08/2015, 05/01/2015 to 31/07/2015 and the 06/09/2015 to 30/11/2015, how the overlap period can be calculated?

    There are many potential unknowns in your question.  For example, you want to count any overlap at all?  If two dates overlap, what matters?  Overlap - each of them?

    In any case, here is a solution that counts how many periods are overlapping in any point in time...  She, of course, using temporal logic.  You can then use ValueAt(), WhenLast(), WhenNext(), etc. as appropriate.

    Assume that your model has a child entity called 'the period' with name 'all time periods' relationship and basic attributes 'start date of the period of time' and 'date of end of period of time'.

    In your example:

    an entity should have the time period start date = 03/12/2015 and the date of end of period of time = 16/08/2015

    another entity might have the time period start date = 01/05/2015 and the date of end of period of time = 31/07/2015

    another entity might have the time period start date = 06/09/2015 and the date of end of period of time = 30/11/2015

    To find the number of overlapping over time, we want to count or entities that have an active period, so the rule is perhaps the sum:

    the number of overlapping = the number of all the periods for which it is true that the time period is active

    How do we know a time is active?  This is the time logic comes in.  He is active on or after the start date or no later than the end date:

    the time period is active if

    TemporalOnOrAfter (the date of beginning of period of time) and

    TemporalOnOrBefore (date of end of period of time)

    That's all.  Now, you can perform a temporal visualization of the 'number of overlapping' and you'll see it rise and fall over time.  As a reference, he said that the number of overlapping = 3.0 from 06/09/2015 across 31/07/2015.

    I hope this helps.  You can use the same model to count periods of time functions, but you end up having to use the most logical date.  You of course can count the total number of entities and compare this number of overlap over time to see if they overlap, but I digress...

  • Calculate the difference in days between two Dates

    Hello

    I'm trying to understand how to calculate the difference in days between two dates using JavaScript in LiveCycle. (Minimum = JavaScript knowledge)

    Where 'Start_Date' and 'Current_Date' are the names of the two dates in the palette of the hierarchy. (the two Date/time field)

    * Current date is using the object > value > execution property > current Date/time

    I need a text or number field showing the difference in days. (Difference_in_Days)

    I noticed the following code is pretty standard among other responses:

    var

    Start_date = new Date (Start_Date);

    var

    Current_Date = new Date (Current_Date);

    var

    nAgeMilliseconds = Current_Date.getTime) - Start_date.getTime ();

    var

    nMilliSecondsPerYear = 365 * 24 * 60 * 60 * 1000 ;

    I know there is lack of code and code above are may not be not correct.

    Please notify.

    OK, that's because of the way that javascript and works of the calculate event.  The field will be filled with whatever the script resolves at the end of execution. Technically, your script does not have a value because the last thing you do is an assignment to a variable.  Change the last line as follows:

    Math.ABS ((firstDate.getTime)

    ((- secondDate.getTime (()) / (oneDay));

    (eliminate the variable assignment) and get rid of the app.alert.  Your script will "return" (have) regardless of the value of calculation from the East and which will be stored in the field.

  • Illustrator CS3: How to calculate the exact distance between two points?

    It comes to my line.

    Immagine 1.jpeg

    I have to measure its exact length. How can I do?
    If I use the measure tool, the cursor does not select the snap points, so I have only an approximate measure.
    Is there a quick way to calculate the exact distance between two points?

    Flying document Info Palette menu: turn on the SelectionOnly and objects. The palette will show you the length.

    JET

  • How to make the difference in percentage between two matrices?

    Hello everyone, I just want to ask how to make the difference in percentage between two binary matrices. This is to compare two images converted to matrices in LabView. Thank you.

    Well, in the current image interesting pixels are zero in the reference image. Here is a small example that would take all the zero 100% pixel, then look at the pixels of same in the other image to see how are always 0.

    Modify if needed.

  • It is possible to select a segment of a path between two points outside their clipping mask?

    I have a way with 3D rotation effect tends in a clipping mask. In the Preview mode (Ctrl + Y), most of the road is not the clipping mask, but most of the visible inside the mask in normal view because of the 3D effect turns. I want to select and remove a segment of the path between two points outside the clipping path, but Illustrator does not select the components of access outside their clipping mask path.

    Anyway is to do without for as much free mask?

    ALWAYS indicate the version you are using. Regulars here using one of the six different versions of Illustrator. Assuming that the current version:

    White pointer: marquee select around a portion of the original route which is located in the clipping mask.

    OR

    Black hand: select the object. Make a right click the object. Select isolate selected in the popup clipping mask.

    JET

  • Google maps 'directions' between two points stopped working in firefox

    When using google maps to find the route between two points "Get Directions", he will just stand here loading... never finish and showing the routes between locations.
    It used to work fine a month ago. I didn't expect the update to Firefox.

    I opened the Camino to test on this browser google maps and since I did open Camino in a month or so he asked upgraded but also verified 'Flash' and asked at this level because it was outdated. I have tried re google maps "get directions" between two points on Firefox after the Flash update and it worked!
    It is a pity that so much of the web is based on Flash. Yes its cool but its also a huge pain. I wanted to just quickly answer my own post in case others are having similar problems and simply update Flash.
    See you soon

  • How to calculate the 2 objects QTime?

    Hello

    I have 2 QTime object.

    QTime q1 = new QTime (3,0; 0)

    QTime q1 = new QTime (2,30,0);

    How can I calculate 2 object? I mean q1 - q2.

    I thank in advance

    mSecsTo gives you the difference in milliseconds during which between two objects of QTime

  • How do you find the average value of all the data between two points on a single channel

    I'm tring to calculate the average value of all data points in a single field between two distinct points

    I rasthaus an illustration.

    Hi smoothdurban,

    I thought you wanted to specify the area of interest with the sliders of the band.  If you rather automatically define the area of interest based on thresholds, etc., we cannot see the interactive nature of the example I sent.

    What are the criteria used to determine the start and end of the region of interest lines?

    I would be able to type this out for you if you sent a representative data set ([email protected])

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • How to send and receive text messages between two simulators?

    I launched the first Simulator by inputing D:\Program Files\Eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.16 «»
    ents\simulator > 8300.bat/sms-source-port = 5000/sms-destination-port = 5001 "cmd

    tnen second Simulator by inputing E:\simulator>8300.bat/sms-source-port = 5001/sms-destination-port = 5000 in cmd

    but I can't not Simulator send and receive sms

    I assume that you have followed all of these steps?

    How - send SMS text messages between two BlackBerry Smartphone simulators

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800792/801083/How_To _...

    Can you elaborate on what does not work?  You see errors?  When missing to?

  • How to avoid synchronization of the settings between two computers

    I have two computers (a desktop computer all-in-one DELL and HP laptop).  Log-in at once is my Microsoft account.

    PROBLEM: When I 'customize' screen on one, the same changes are made on the other.   It is not desirable.  How to avoid that, far from making a second Microsoft account?

    To clarify - the ICONS are not duplicated, just any changes made to the themes of office such as colors or backgrounds.

    Thanks in advance!

    Hello Beckinista,

    Thanks for posting your question on the Microsoft community.

    Thank you for your query details.

    I also like the fact you want to avoid synchronization of the settings between two computers.

    I suggest you stop the synchronization of all of the settings between two computers and check if it helps.

    Please see this link:
    Sync between multiple PCs with OneDrive settings
    http://Windows.Microsoft.com/en-us/Windows-8/sync-settings-PCs

    Note: Please see section "to stop all sync settings" in the article above.

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • How the control number of the minorticks between two tick marks of the axis?

    Hi guys,.

    I want to draw a number of minor ticks between two graduations of the vertical axis of the column chart based on user input.

    ex: If user provides 2 there are two minor ticks between two tick marks on the axis.

    Thanks in advance.

    From what I can tell with sleeping with her, minorInterval value divides the vertical County to get the appropriate number of ticks between each interval.

    
    
    

    In the example above, I have the interval to 10 and when I put the minorInterval at 2, then I get 5 ticks.  The first tick is the interval and then followed by 4 more ticks.

    In your example, in order for me to see 2 ticks between intervals, then, I must assign the minorInterval 3.5 .

    10 / 3.5 = 3 (2 ticks)

    The forumla should be something like:

    ViewableTicks = interval / (selected ticks + 1);

    So, if I created a drop down list with 1-9 ticks (because 0 does not work if you are showing minor ticks), then when the option is changed, I calculate the value for minor ticks and set the component LinearAxis (countAxis) this new value.

    protected function tickViewList_changeHandler(event:IndexChangeEvent):void
    {
     var tickCount:int = tickViewList.selectedItem;
     var tickView:Number = countAxis.interval / (tickCount + 1);
     countAxis.minorInterval = tickView;
    }
    

    I created a blog post showing my example.

    Post edited by: DeanLoganBH - add link post blog with photos of example

  • Calculate the number of days between two dates

    Hello

    Can someone help please change my formcalc script to calculate the number of working days between two date fields.  My script currently calculates the total number of days between two dates, including the weekends which must be excluded from the total.

    If

    (HasValue (Start_Date1) & HasValue (End_Date1)) then

    $

    = Date2Num (End_Date1, "YYYY-MM-DD" "en_IE") - Date2Num (Start_Date1, "YYYY-MM-DD" "en_IE") + 1

    on the other

    ""

    endif

    Any help will be most appreciated.

    Thank you.

    Check...

    (1) you said that you put the script on the event «days1» calculate My sample imitates the variable names used in the original message, "Start_Date1" and "End_Date1". If the names of variables for the start and end dates are different, you will need to modify the script to account for these names.

    (2) the Date2Num functions in the calculation of the "totalDays" use the date format "YYYY-MM-DD". If your date habits differ from "YYYY-MM-DD" FormCalc will complain.

    Steve

  • How can I set sharing of files between two iMacs?

    I want to set up the sharing of files between two iMacs in my office. Both work on iOS 10.11.3 and both are on the same WiFi network. I'll Finder, select the name of the other computer under 'sharing', then ' connect under... ". ", and then enter the name and password of the other computer. On a computer, I am told that it is connected with each other. However, the second computer always shows "the connection failed". I tried the 'Registered user' choice of "Guest" and "using Apple ID", but none will establish the connection. There must be something obvious that I'm missing, but I wasn't able to find out. I also tried to see if they would communicate with Bluetooth. Bluetooth screens on each computer show the the other is detectable by the proper name, but is never establish a connection.

    Connect to the same network.

    Enable sharing of files on both machines.

    Select the items to share on each machine and check the box in the dialog box information.

  • Hub and spoke VPN network traffic between two points talked

    Hi, I have a star VPN network topology, and all traffic is remote office to the data center,

    I have a request to build a tunnel between two remote sites to access some servers between two remote sites,

    Can I just change the ACL of valuable traffic to to include say a Cabinet to Office B in rule Cabinet a Datacenter and Office B tunnel to tunnel data center.

    In doing so, I can avoide the tunnel between two offices (and B)

    See you soon

    Hello

    You can make the traffic between the two rays go through the hub or build a new tunnel between the rays.

    If the hub is an ASA you must authorize same-security-traffic intra-interface permits

    If the hub and the spokes are routers, you can also use DMVPN to dynamically create a tunnel between the spokes when necessary.

    Federico.

Maybe you are looking for

  • How can I remove Inbox

    When I used to open Firefox I got the search engine Google, now I am faced with the Inbox. How can I delete my computer Inbox

  • Sync that went wrong

    I have synced my firefox desktop to my laptop. I have not updated the synchronization to the laptop in a while. Synchronization has put all my old favorites on my desk instead of the new ones on my laptop is there anyway I can cancel this?

  • HP Update popup

    I see a pop-up stating "HP Update" on a blue background at the bottom right of my computer screen. I want to get rid of it, but it would be unresponsive to single or double or right click. Part of the text on the right is hidden so I wonder if fo of

  • Model only ON R7300DST is power, but internet and network work?

    The device is filled for a century link C1000A. The only LED that is on is power - all others dark. However, the device seems to work. I have internet, I have access to USB flash and network drives. I haven't has extinguished/turned on the deivce no

  • that windows has a scan to check the drivers that need to update

    My d AND E DRIVES do NOT WORK AND I thought THAT perhaps IT IS THE DRIVERS of DISC WHO need update. SO IF WINDOWS CAN SCAN MY COMPUTER FOR ME I UPDATE DRIVERS DRIVE MT? CAN HELP YOU.