Makoren's Forum Posts

  • I'm currently making a system where you walk in front of a treasure chest, and if you aren't moving or attacking, you will open it after a few seconds using a Timer behavior.

    I want to make this visible to the player through an "interaction bar" which appears under the player. It should change its width based on how long the timer has been running.

    I've tried using the Timer expressions, but for some reason these are always 0. Am I using them wrong, or is there a different approach?

    Here's my project file: ufile.io/b2vfg

    The logic I've added is in the eCharacters and eInteractions event sheets. I'm trying to change the width of the "castbar" sprite.

  • Here's my project file, health bar logic is in the "eCharacters" event sheet: ufile.io/dwc1s

    If you take damage in the Main layout, the health bar updates normally, changing size based on HP lost. But if you go to FirstTown or NextTown, the health bar doesn't update if you take damage.

    I can't think of any reason why this would happen, since all layouts share the same event sheet.

  • Fixed. All I did to fix this was add an "isPlayer" boolean flag to the Characters family that is false for all characters except the Player. Then I added another condition to check if the character is a player or not before using the appropriate action.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm adding variables to the player because of this event:

    The Player object is part of the Characters family.

    I agree that putting player data in two places is bad code. If I could change this event to get global variables if the Player is picked specifically, then that would be a better fix.

    I started this thread because I couldn't find a solution to that and tried a different approach, but if anyone knows how to pick the Player object in that event, I would love to know.

  • In GameMaker, there's an event called the "begin step" event. Any code in that event will be triggered at the start of the frame, before the regular step event and other triggers. Is there something similar in Construct 3?

    The reason I ask this is because I'm using global variables to store player data like HP, since the data needs to be persistent across layouts and the Persist behaviour doesn't seem to work for this. Then every tick, I'm giving this data to the player in the form of instance variables.

    The problem here is that if I try to update my health bar based on the player's variables, it will update the health bar after HP has been changed globally, but before it has been added to the player. A "begin step" condition would solve this immediately.

    Here's my project file if you need a closer look: ufile.io/1ol4z

    The health bar code is held in eCharacters, the global variables are held in eGlobals, and the data copying is also done in eGlobals.

    Any help is appreciated.

  • Thanks for the project. It's too late for me to fix my project tonight, but I'll study yours tomorrow.

  • I've been googling for the past 20 minutes to no avail. Here's my project file: ufile.io/21yo4

    The problem code is in the eHealthbar event sheet. The variable "prevHP" is only for the health bar system, feel free to remove it while messing around.

    Right now, each character in the Character family has a HP bar. They're pinned correctly, and they all get destroyed correctly when one character dies. I also have a working formula on how to reduce the size of the HP bar according to player HP.

    The problem I have is that every enemy takes damage at once. How do I make it so that the only HP bar that is reduced belongs to the enemy that was attacked?

  • You do not have permission to view this post

  • You do not have permission to view this post

  • That's exactly the kind of behaviour I want. Thanks.

    And yeah, I'm only controlling the enemies for testing. Once I've got more systems in place I'll start spawning the enemies and give them AI.

  • Here's my project file: ufile.io/pzdib

    Right now it's just two objects with the 8 direction behaviour, and that's it. In the future I want the enemy to chase the player and start attacking on collision.

    I've tried your example, but the objects will just push each other around. I've also tried using Set X instead of Simulate Control, which causes a lot of jittering.

  • Never mind, I only just now realised I had left the Solid behaviour on... any other input is appreciated.

  • Title, basically. I'm having issues with my collision, and I can't find anything useful on Google.

  • Fixed this by using the "On collision with another object" condition and the "Stop" action on the 8 direction behaviour.

    This didn't work with the overlap condition since the player would just gradually move through the object anyway. I don't really know why that happens, but it works now.

  • How do you use those events to simulate collision? Google hasn't found anything useful, and simply preventing movement will trap the player inside the other object.

    Don't know if this is useful information, but you can't jump in the game, it's just left to right movement with the 8 direction behaviour.