lionz's Forum Posts

  • My initial approach to this wouldn't be to plan a route using pathfinding behaviour, although I understand the agent's general movement from place to place could be pathfinding. I would do it by using the floor I am on to locate an elevator that goes to the floor I want, and if one isn't found then to the closest floor I want. Using your image as an example, this is what my approach would be :

    Elevators are objects that have variable attached to determine what floors they go to, it could be a set of booleans, floor1=true, floor2=true etc or simply a variable for the highest floor it goes to i.e. floorMax=5 it goes to 5th floor. I will use the first example for now as the second could pose problems for going in reverse, or I guess you could add a floorMin var.

    Anyway, so I am on floor 1, I look for an elevator that is floor1=true as a priority (it goes to floor 1), and also goes to floor 5 destination (floor5=true). In your image that elevator does not exist, so it then looks for the next floors down. I need an elevator that is floor1=true and floor4=true, not found. Floor1=true and floor3=true. Ok i found it, it's the elevator on the left.

    Then I get to floor 3, I look for an elevator that is floor3=true and also floor5=true. Yes that exists it's the elevator on the right, I path to this elevator and take it to 5th floor.

  • It's true you will need save logic to remember after the game has closed but what you're talking about is simply remembering items unlocked on restarting the game after dying, right? I'm making a rogue at the moment and can help you, although I did use arrays oops..

    All you need is a global variable in condition to toggle whether the item can be found. So all items in the game that exist at the start are variable=1. Any legendary items not yet seen are variable=0. When you see it in the game you set this variable to 1 for that item. You will obviously need to adjust this to how you have set it up with the groups.

    Anything to do with closing the entire game and remembering is related to save slots which will save the global variable and remember what it was set to.

  • Yep that looks fine, are you saying that it's working now or do you need some help?

  • I can't see an image but I guess what you need is to check If wallet money < product value * quantity.

  • 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.

  • 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)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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..