Health Bar That Gets Smaller From 1 Side Only?

FallingBoxStudiosFallingBoxStudios Freelance Graphic DesignerMember Posts: 822
edited December 2013 in Working with GS (Mac)
Hi, I'm create a health bar, but when I try to make it smaller, it shrinks from both sides, I want it to shrink from 1 side only. Also how do I make it so that if your health grows (if you get a power) it grows from the 1 side it shrinks from. how do I do this? Thanks :)

- Hunter

Comments

  • CharlieG97CharlieG97 Member Posts: 52
    edited December 2013
    Something like this? Click the red bar and ignore the blue box.
    https://www.mediafire.com/?35d3nxgrcuhwnco

    (Sorry about the link I don't know how to post files with my comment)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    @CharlieG97 I downloaded it, but I can't open the project :-S
  • CharlieG97CharlieG97 Member Posts: 52
    @CharlieG97 I downloaded it, but I can't open the project :-S
    How come? Is there an error message?
  • -Timo--Timo- Member Posts: 2,313
    constrain self.position.X to 10(where to start)+(self.size.width/2)
    if his health gets less change width to width-20 and when he gets more health change width to width+20.
    havent tried but should work. I will make a little template ;)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited December 2013
    @CharlieG97 Yep :( image

    @Timolapre Thanks, it seems a bit complex, a template would be great :)
  • -Timo--Timo- Member Posts: 2,313
    edited December 2013
  • CharlieG97CharlieG97 Member Posts: 52
    @CharlieG97 Yep :( image

    @Timolapre Thanks, it seems a bit complex, a template would be great :)
    Ahh im running windows! I'm sure timo's works fine but just in case, what I did was:
    Had the actor for the health bar.
    Had a Rule:
    when touch is pressed (just for example)
    Do:
    Change Attribute: self.size.width -----> self.size.width-20
    Change Attribute: self.position.x -----> self.positon.x-10

    Hope this helps :)
  • -Timo--Timo- Member Posts: 2,313

    Change Attribute: self.size.width -----> self.size.width-20
    Change Attribute: self.position.x -----> self.positon.x-10

    Hope this helps :)
    thats almost the same ;) you change the position to the half of the width you change. do its easier to constrain self.position.X to (self.size.width/2)+(the Xposition you want it to start, something like 10)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    There is a video on this topic over at gshelper.
  • CharlieG97CharlieG97 Member Posts: 52

    Change Attribute: self.size.width -----> self.size.width-20
    Change Attribute: self.position.x -----> self.positon.x-10

    Hope this helps :)
    thats almost the same ;) you change the position to the half of the width you change. do its easier to constrain self.position.X to (self.size.width/2)+(the Xposition you want it to start, something like 10)
    I didn't think I'd do it the most efficient way. It's 1am here so I thought I'd just give it a go! :P Yes your way sounds simpler.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited December 2013
    @Timolapre Thanks for the template :) but the template is a little hard to optimise for what my game needs it for :(

    @SlickZero Thanks :) but for some reason it wont work :( Heres my code:image
  • -Timo--Timo- Member Posts: 2,313
    edited December 2013
    This has probably to do with your other thread where your asking for someone you can trust but maybe you can send the file so I can look at it? Or you can add me on skype for help (thats easier) PM me if interested :)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited December 2013
    @timolapre1998 Thanks :) I appreciate it :)
    Btw: this is about 8% got too do with my other post ;) the other post is kinda a template request (as in I'm looking to hire someone too create a small template in which I can get started on) let me get the file ready, then I will just PM the download link to you :) (its a mac file)

    - Hunter
  • allc1865allc1865 Member, PRO Posts: 777
    Here's a better one with one two points. If you collide with one, the bar grows, if you collide with the other, the bar shrinks.

    https://www.dropbox.com/s/5fdozcypmmf7dui/Health Bar.zip
  • joshiwujoshiwu Member Posts: 207
    Also Check Out Tshirtbooth's Replicate video.
Sign In or Register to comment.