Results 1 to 7 of 7
  1. #1
    Iron Guard
    Join Date
    Nov 2011
    Location
    Somewhere on Earth.
    Posts
    659

    Default [WORKED] Bullets reducing in HUD when firing a weapon

    Hello everyone...

    I made a custom HUD that works but i dont know how to reduce the amount of bullets in my HUD when firing weapon.

    Here is the image as it appears in HUD:


    When firing my weapon i need each bullet to disappear:


    Each of those bullet is a separate image and all of 'em in one Movie Clip. And on each keyframe i modified width parameter for each bullet so that it disappears. Now my doubt is how can i bring it in my game?

  2. #2

  3. #3
    Palace Guard
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    3,945

    Default

    Sorry, would be easy in Canvas because you would simply tell it to not draw that tile if it's used up already. But I have no clue about Scaleform yet. I suggest you look over the tutorials in the Scaleform section, though, especially the official ones on Youtube.
    Our Loop, which art in source code, hallowed be thy keyword.
    Thy condition come, thy instruction be done, in RAM as it is in cache.
    Increment us this day our daily counter,
    and forgive us our typos, as we also have forgiven our compilers.
    And lead us not to the nullpointer but deliver us from bugs.
    For thine is the API, the GUI, and the CLI while(true).
    Semicolon;
    Please don't send me questions about how to do something in the UDK via PM. That is better discussed in the forums and we only have limited PM storage.

  4. #4
    Palace Guard
    Join Date
    Aug 2008
    Location
    Location,Location
    Posts
    3,762

    Default

    Doesn't the UDK Scaleform HUD already do this?

    They have each bullet in a frame and when a bullet is shot it decrements a counter which lowers to the next frame hiding the bullet.

    Another way is to use a mask which simply hides the bullets as you use up ammo.

  5. #5
    MSgt. Shooter Person
    Join Date
    Jun 2010
    Posts
    37

    Default

    What TheAgent said ^.

    There are a number of ways you can do it, but I think the simplest would be to make a movieclip where the 1st frame has 0 bullets, the 2nd frame has 1 bullet, the 3rd frame has 2 bullets, etc...

    Once you've done that you can tell the movieclip to gotoAndStop( ammoCount + 1) every time your ammoCount changes.
    So it goes to frame 1 when you have no ammo, frame 2 when you have 1, etc.

    Is your max ammo count always the same? You'll need to consider that.
    Does the weapon bar look mostly empty when you have a weapon with a max ammo count of 4? What happens if you have a weapon with a max count of 50? You don't want to tell it to go to frame 51 if it doesn't exist (I think flash gracefully handles this by going to the last frame, but it's bad practice to let this happen).

    If the bullets are just images, you can just delete the from the frame rather than shrinking them.

  6. #6
    Iron Guard
    Join Date
    Nov 2011
    Location
    Somewhere on Earth.
    Posts
    659

    Default

    Quote Originally Posted by Captain Zazz View Post
    What TheAgent said ^.

    There are a number of ways you can do it, but I think the simplest would be to make a movieclip where the 1st frame has 0 bullets, the 2nd frame has 1 bullet, the 3rd frame has 2 bullets, etc...

    Once you've done that you can tell the movieclip to gotoAndStop( ammoCount + 1) every time your ammoCount changes.
    So it goes to frame 1 when you have no ammo, frame 2 when you have 1, etc.

    Is your max ammo count always the same? You'll need to consider that.
    Does the weapon bar look mostly empty when you have a weapon with a max ammo count of 4? What happens if you have a weapon with a max count of 50? You don't want to tell it to go to frame 51 if it doesn't exist (I think flash gracefully handles this by going to the last frame, but it's bad practice to let this happen).

    If the bullets are just images, you can just delete the from the frame rather than shrinking them.
    Thank you very much for that detailed explanation Captain Zazz

    Quote Originally Posted by Captain Zazz View Post
    Is your max ammo count always the same? You'll need to consider that.
    Does the weapon bar look mostly empty when you have a weapon with a max ammo count of 4? What happens if you have a weapon with a max count of 50? You don't want to tell it to go to frame 51 if it doesn't exist (I think flash gracefully handles this by going to the last frame, but it's bad practice to let this happen).
    I never thought of it because currently i only have a single weapon. But you are right. Hmmmm....what if i want to implement another weapon?? So if i have another weapon with different ammo capacity how will i update the HUD? Can you please explain this or do you have a link for a tutorial on HUD?

  7. #7


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.