Make the health bar down (AS2)

Well, after some work and a lot of mistakes, so I made a health bar for my game. (It is the Actionscript 2)

Basically, the code is the file .as my main character, there is
var maxHealth: number = 100;
health of the var: number = 100;

and further down the line...
_root.healthBar._width = (health/maxHealth) * 200;

~~~~~~~~

So, when I change the number of health lower var, the health bar drops lower. Sweet! It works!

Now, just wondering if any of you guys could help me code so an enemy can inflict damage on the main character.
I have tried several codes, but they all failed.

If (this.hitTest (_root. Monster))
{

}

That would put the parentheses?

Thank you

:

If (this.hitTest (_root. Monster))
{
This.Health-= 10;  for 10 damage

and always make sure that health does not go below 0 and when it reaches 0, you take action
}

Tags: Adobe Animate

Similar Questions

  • Try to make the health bar

    I'm doing a health bar. I'm trying to make sure when your health goes down, the bar moves.


    Health = 100;

    HealthBar.TheBar._xscale = the health;

    function updateHealthBar() {}
    HealthBar.TheBar._xscale = the health;
    }

    So far, this is what he does. I made a button, and when you press it it takes your health 5.

    How can I do one side move to the left instead of them, both moving to the Middle?

    Position the wicker and its alignment is along its left edge.

  • I need to make the bookmarks bar visible when I start firefox

    I use the mozilla.cfg file

    defaultPref ("dom.disable_window_open_feature.directories", true);
    defaultPref ("dom.disable_window_open_feature.personalbar", true);

    I need something like this to use to make the bookmarks bar when I run firefox

    It is one of the persistent settings that are stored in the file localstore.rdf.

  • How to make the progress bar display in the icon in the taskbar for WIN 7?

    How to make the progress bar display in the icon in the taskbar for WIN 7? I see Eclipse Helios can show the loading progress bar in the icon in the taskbar of WINDOWS 7 at startup.

    Is not the feature that provides JavaFX, you must write a native connection called technology such as JNI to make specific Windows API call for updating the icon in the taskbar for the application.

    Maybe you could go through the Eclipse source code to see how Eclipse and see if you can make use of the same mechanism in your application.

    More tips on how you can implement this are outside my area of expertise.

  • How to make the address bar behaving like search bar? I mean SMART search, as it implemented in Chrome (very comfortable for users).

    For example when I type a word in the search bar, it begins to give search engine suggestions, so don't HAVE TO TYPE THE ENTIRE SEARCH PHRASE!
    The same behavior is in the address bar of Google Chrome. So in Chrome address bar and search bar are combined into one that is very comfortable for users.
    In Firefox, you have here two different bars, which makes no sense. I used Chrome before and usually by type of force of habit in the address bar to search for something and have to type the whole expression there to begin the search. It is very stupid and using the address bar to the fruitless search.
    Screenshots attached.
    So, do we not have any add-on or option to merge or combine the bars or to implement smart search in the address bar?
    Thank you.

    You can look at extensions such as these:

  • How can I make the task bar and the opaque address bar?

    The address bar and the taskbar are translucent IE I can see the wallpaper through them, while the rest of the window is opaque.

    I would like to contribute to make the entire opaque window.  Windows 7 Home Premium
    Thank you
    Robert

    Hi Robert,.

    Thanks for posting your query in the Microsoft community!

    I understand that you do not want taskbar and the translucent address bar. I will try to help you with this question.

    Disabling the translucent effect in Windows 7 is very simple:

    a. right click on the desktop

    b. click on customize

    c. under ' Basic and high contrast themes, click on "Windows 7 Basic.

    Please report if you are still having the problem. I will be happy to provide you with the additional options that you can use to get the problem resolved.

    We can't wait to hear back on your part.

  • How do you start the scroll bar down on the loading of the page?

    I have a div that extracts data from a database.

    A person types a message, he published on the SQL database and the div pulls the message from the database. When the page reloads the new message is at the bottom of the div box and refill the scroll bars starts up on the page, and you need to scroll down to see the new message.

    It is a real pain and not very friendly. I'm either looking for a way to start the scroll bar to the position of on loading the page, or a much better way to do it. Maybe like an auto-scroll, or something.

    I'll go ahead and you give correct answer about this. These things can work very well, but I found a way to put the last message at the top instead of bottom.

    SELECT the column OF database ORDER BY id DESC LIMIT 20

    Thank you for your time if

  • How to make the search bar of the report interactive, aligned to the right?

    Hi all
    I need to make the search report interactive to be on the right side bar. How can I do this? any idea?
    Please note that I use the Oracle XE11.2 database

    Best regards...
    Hussam.

    Hossam,
    If you use apex 4.2... change your page in the css section, place the code in the Inline text box.

  • The address bar disappears when the cursor is in the middle or the bottom of the page. How can I make the address bar to stay constantly?

    When you open mozilla, when the cursor is not at the top of the page, I do not see:
    (1) the address bar
    (2) front and rear buttons
    (3) office toolbar

    So, in short i can only see the adress bar when i move the cursor to the top of the page. Desktop toolbar doesn't seem at all when the mozilla internet page is open. How can i solve this?
    

    See also:

    When you are in full screen view, move the mouse to the top of the screen to facilitate the bar bar appear Navigation and tab.

    You can use one of them to exit full screen:

    • Click the expand (in the top right Navigation bar) button to exit full screen
    • Right click on an empty space on a toolbar and select "exit full screen".
    • Press the F11 key
  • How to make the search bar works like this.

    The search bar, just to the right of the address bar, does not start a search when I enter a search term and press the magnifying glass symbol or press ENTER. I am able to select a search engine.

    I have seen the other question that has been locked and pointed to this topic. Firefox reset should solve this problem. It takes about 10 seconds and will remove the modules and customizations that could cause problems. It will save all of your personal information. You can learn more about here - Refresh Firefox – reset settings and Add-ons.

  • Y at - it an addon that will make the tab bar to disappear?

    I have multiple windows and tabs not. Does anyone have an addon that hides the tab bar? I am not upgrading my version of Firefox if I can not hide the tabs as well as block the automatic Checker addon that is sent on my system if I try to go above version 20.0.1 is there a way to disable or remove that as well?

    try to remove the user.js file - normally should not be in your profile folder at all if you did not create yourself.

  • How to make the scroll bar on the sides of the screens?

    System to win 8 op.

    on pages how the wider scroll bar.  I know I could use a lot of things but I would use it on occasion.  default value is way too small as 'micro' - app does all the rest.

    Hello

    Thanks for posting the question in the Microsoft Community!

    You want to be wider, the scroll bar.

    Unfortunately, the scroll bar may not be wider.

    If you need any help or if you encounter problems with Windows in the future, let us know and we would be happy to help you.

  • I want to make the history drop-down list smaller or narrower

    The history list has grown grew so great that it occupies more than half of my screen. How can make the list view more narrow and smaller. Ten points should not have to take half a 19 inch screen.

    Note that you can also place such a CSS code in the file userChrome.css in chrome file in the Firefox profile folder.

    I use code like this:

    /* urlbar - separator */
    #urlbar .dropmarker-icon, #urlbar toolbarbutton {border-left:1px solid ThreeDShadow !important}
    #urlbar-icons image {border-left:1px solid ThreeDShadow !important}
    
    /* urlbar - border */
    .autocomplete-richlistitem {padding-top:2px!important; padding-bottom:2px!important}
    .autocomplete-richlistitem:not(:first-child) {border-top:1px solid #ddd!important}
    .autocomplete-richlistitem[selected="true"] {border-top-color:transparent!important}
    
    • create the chrome (lowercase) folder in the .default profile folder if the folder does not exist
    • Use a text editor like Notepad to create a userChrome.css (new) file in the folder chrome (file name is case sensitive)
    • Paste the code in the userChrome.css file in the Editor window
    • Make sure the userChrome.css file begins with the default line @namespace
    • Make sure that you select "All files" and not "text files" when you save the file via "save file as" in the text editor as userChrome.css.
      Otherwise, Windows can add a hidden file .txt extension and you end up with one does not not userChrome.css.txt file

    You can use this button to go to the current Firefox profile folder:

  • How to make the menu drop-down list with a scroll bar

    Hello

    I have a drop-down list that is filled with different table sizes.

    I have a size of 30-element array.  Some of the last items just go off the screen at the bottom of the Simulator PB.

    Is it possible for me to add a drop-down scroll bar?

    DP = new DropDown();
    dp.rowHeight = 24;
    DP.prompt = "stuff";
    DP. Height = 34;
    DP.width = 230;
    DP.x = TitleTB.x + 170;
    DP.y = Title.y-3;
    addChild (dp);

    Some of the tables look like this-

    case 'List 1':
    dp.rowCount = 2;
    for (var i: int = 0; i<2;>
    {
    if(i==0)
    {
    DPP.splice (0);
    DPP.unshift({label:"blahblah"});)
    }
    else if (i == 1) {}
    DPP.unshift({label:"foofoo"});)
    }
    }
    dp.dataProvider = new DataProvider (dpp);
    addChild (dp);
    break;

    case "List2":
    dp.rowCount = 30;
    for (var n: int = 0; n<30;>
    {
    if(n==0)
    {
    DPP.splice (0);
    DPP.unshift({label:"lalalala"});)
    }
    Else if (n == 1) {}

    **********

    Delete the existing table using splice (0);

    then I add the new array of labels.

    Before, when I didn't have the splice (0), I only had the .unshift () and sometimes got bays combined together and a scroll bar appears automatically in the Simulator.  But then the berries were mixed.

    Thanks for the help!

    Hey mlin13,

    from the looks of it, your property rowCount is set too high. the rowCount property represents the number of lines displayed on the screen when the drop down menu is open. so if the number of rows is less than the amount of items on the list, it will create a scroll bar with a drop-down list for you. try to set the number of lines to a default value of 10 and and keep it manipulate your list from there. and see if you get the desired results. Good luck!

  • How to make the side bar of the finder 'Today' and 'This week' options given (they disappeared when I loaded El Capitan)?

    These options from the sidebar formularies very conveniently in any program that has been done to this day or week and now in el capitan, I can't find any way to get them there! Help...? THX

    Create them.

    Cmd - F in the Finder to open a search window.

    Define criteria to display files with is today: yesterday | this week |... If you don't see the type of date you want, select another, and then search Date. In this menu, you can check the box to keep in the list of issues, if you like.

    Once finished setting up, click on the "Save" button, give it a name and make sure that adding it to the sidebar is enabled.

    When you start a search, you may need to set the folder. Default values have set "search this Mac". When you run a search, it will default to this option and allow you to select the currently selected folder. Or, you can change the Finder preferences to use the current folder to start the search. Whatever it is, place it in your home folder just pick up your items.

Maybe you are looking for