lionz's Recent Forum Activity

  • No problem, glad it helped!

  • ignoring the bar, you need to set a current max energy for the player. lets called this 'energyMax'.

    When you say character with 5 energy, you mean he has 5 energy to start so that is 'energyMax'.

    the current energy is 'energy', and you set this to 'energyMax' at the start of the game and I imagine you decrease 'energy' by using it.

    so you start with 5/5 energy.

    we now calculate a percentage regardless of starting energy, whether its 5 you are slotting in or 1000.

    fill = energy/energymax* 100 = 5/5*100. what you have now is a percentage of fill for the bar.

    so if your guy now dropped to 3 energy. the fill of the bar would be energy/energymax*100 = 3/5*100 = 60%

    To answer your question, using the fill bar formula, the energy that the player starts with which is what I think you are trying to slot in is energyMax.

    This also auto-resolves the bar decrease speed because it is always a percentage. if you have 5 energy it will drop 20% of the bar a time, whereas if you have 1000 energy to start with and decrease by 1 you will see almost no change because it is going to 999, 998 etc which is a small percentage of the bar.

    The next step is how you want to apply that percentage outcome (fill var) to the bar width. You can just say object.width = fill which means its width would be between 0-100 just to test it out, then multiply this later if you need it larger. You could also use the built in object progress bar to test it out and set progress=fill.

    To summarise after you've read that and understood what I mean with the values, you just need 3 variables and a formula :

    energy - the current energy,

    energymax - the max energy allowed or total given at the start,

    fill - a variable to store the percentage,

    set var fill = energy/energymax*100

  • Do you have a purchase mechanic? How does it work currently? You said you saw the wallet go into negative value so that implies there is a purchase mechanic already and you tried something. In the general sense you are looking to use conditions, which are kind of like 'if statements' for construct. When you say in a condition 'player money greater than product price', it will only run the actions, a purchase in this case, if that is true.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This just seems very easy to do but we don't know how your game works. You would just check if the player money is greater than the product price before purchasing and if not then disable purchase. For the selling I would add product amount to the array (unless product is product amount and not product name) and then say if that value is 0 then you cannot sell.

  • You will most likely have conflicting events for animations such as when you jump and move left/right it tries to play other animations together. You will need to get into the habit of trying to limit which animations are playing with conditions. If you post a screenshot of the events or share capx then I can help.

  • Hmm try 180 instead of -180, also where's the angle of motion action for the right facing bit at the bottom?

  • 'Each player has a different amount of energy' - that's the variable maxHP in my example

    calculate hp% = hp/maxHP*100

    So if hp is 5 and max is 10 then hp% = 50

    if hp is 5 and max is 100 then hp% = 5

    if hp is 10 and max is 10 then hp% = 100

    if hp is 2 and max is 2 then hp% = 100

    Set the bar width to hp% (it'll be from 0 to 100)

  • I will assume you have used simulate control for the jump also? Best way to resolve is to use 'platform on jumping' play jump animation.

  • You only update the high score text object if score is greater than high score. Maybe your score is less than high score which means the text object would not update. If your score is actually greater than high score then it's possible the game over layout isn't using the event sheet.

  • If you look in Construct you cannot set a local or global bool, there is only an instance variable bool which applies to a particular object. If you are trying to pass a general bool value through a function or return a true/false then there are other ways to do it. Using the bool in conditions or actions should be enough, if you are trying to do something specifically then post exactly what you are trying to do and I can assist.

  • Nice! Gary's got strong arms..

  • Hi, you can use another variable on the object to identify it as a player. For example, in events if object.char=1, set the rest of the variables to a,b,c etc. If object.char=2, set the rest of the variables to d,e,f etc. You can also then refer to specific character types elsewhere in conditions like this, where object.char=1 is always character type 1.

lionz's avatar

lionz

Member since 5 Aug, 2013

Twitter
lionz has 75 followers

Trophy Case

  • 11-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

24/44
How to earn trophies