lukezero's Forum Posts

  • Actually a variable given to a family becomes an individual variable for all the object it contains, you can select an object with that variable inside the family, but also outside it, if you check the object variables in an event you'll see that it shares the variables of the family, it's better than creating a variable for each individual object;

    I didn't know that! He thought that a family variable would determine the same state for everyone, excluding individuality.

    Back to your mockup, do your NPCs have a variable that define if the player is talking to them? Like a boolean that would be on if talked to, and off if not

    Yeah! I created a Instance Variable now to this action. :)

  • You mean the instance variable is defined on each object, not on the family? You need to move it the family. See this tutorial on how to simplify this task:

    https://www.construct.net/en/tutorials/upgrade-object-family-319

    If a use a Family Instance Variable, it won't work as an individual state.

    Each NPC has its emotional state. It isn't a collective behavior.

  • So what exactly is the problem? All NPC are in the family, and these instance variables are defined on the family, right?

    When you create the HUD sprite, set its animation to NPC.Variable

    No. Although all NPCs are in the same family, each has its own instance variable (which has the same name and function).

    I will try this alternative! :D

  • Hi , below is the mockup you requested:

  • Hi, can you make a mockup of the result you want to achieve? That could help us to figure the best solution for you

    Hi!

    All NPCs have the same HUD that appears on his left side when the player presses "up" and shows his emotional state. This emotional state is determined by an instance variable (which each has, with identical names) and expressed by an animation (three in total, associated with each instance variable).

    Thanks! :D

  • If you have lots of NPCs but only one HUD can be on the screen at a time, then it's probably better to use one instance of HUD - spawn and destroy, or to keep it off-screen and re-show when needed.

    With not so many NPCs you can do what's easier for you, for example you may create a HUD for each instance, pin it and keep it invisible.

    Okay, man.

    What I'm trying to say here is that I'm sharing the same HUD object for all NPCs, for facilitating programming when I think it's the easiest method. Each NPC has its own instance variable that determines a specific animation of the same HUD object independently from the other NPCs.

    The most laborious (and conscious) way would be to create X identical HUD objects and program them individually, creating dozens of event lines. I'm trying to optimize this, I just don't know how. :(

  • Hi everyone!

    In my game, a general HUD object is the same for all NPCs. However, this object has 3 different animations/frames and each NPC has its own instance variable (with the same function) to be associated with these animations. This variable and object expresses the NPC's relationship with the player and, as a state, will vary throughout the game.

    To be practical, it is currently programmed as follows:

    - All NPCs are in the same family

    - There is a single HUD object for all NPCs, which only appears when the player presses UP on the NPC

    - Each NPC has its own variable associated with the 3 animations of the HUD object

    Do you think that each NPC should have its own HUD object or is there a way to keep one for everyone, discriminating in the programming in some way?

    Follow the images of the events below for you to understand better:

    Thanks! :D

  • You do not have permission to view this post

  • You do not have permission to view this post

  • http://www.blackhornettechnologies.com/Construct2Stuff/Samples/LockTimer_lukezero.zip

    See if this helps. I can explain details, but see if this what you want first.

    Thank you very much, dude!

    I'll test it right now! :D

  • If you can isolate out just the door mechanism, I can help sort it out. Timer is much more versatile than the system events.

    This door routine is programmed to count 18 seconds after the player leaves the room and prevents him from entering again only during that time.

    I did a test here using a global variable instead of the function, but the lockpad object continued to be created indefinitely during the 18 seconds of locking the door. :(

  • You can't/shouldn't use Every X seconds, or Wait in a function. Use the Timer behavior.

    Thanks for the tip! However, I can never make this behavior work well. :(

    Do you have another suggestion?

  • Hi everyone!

    Since I'm a designer and not a programmer, I'm often lost in programming logic (even in Construct!).

    With the help of some users here, I was able to implement a Timer through Canvas, but I'm having difficulty placing the image of a Padlock on it, so that it changes animation and increases in size after the canvas object is destroyed (a juice to create some Game Feel).

    The animation of the Canvas Timer is working well and ending on time, but the current schedule creates hundreds of lock objects.

    Does anyone know how I should proceed for the function to create a single Padlock object and make it change animation, increase in size and be destroyed after 1 second?

    Thank you all in advance!

  • I have also seen people make circular health bars / timers using masking, but that usually makes my head hurt, so here is a way using semi-circles and having the parts arranged so that it gives the effect you are looking for...

    one of the "elapsed" semi-circles is rotated, but since it starts at a lower z-order than the other side, it appears to grow from the top. When it gets half way, the "elapsed" pieces move up in z-order to continue the effect.

    You can set the global variable CountDuration to anything you want (in seconds), but I zeropad it to 2 digits so if you want more than 60 seconds you would have to fix that.

    https://www.rieperts.com/games/forum/CircularTimer.capx

    Thank you very much!

    It works well! :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dropbox.com/s/s5tfzeha77c8m93/CanvasClock.capx

    You'll need Canvas plugin:

    https://www.construct.net/en/forum/extending-construct-2/addons-29/plugin-canvas-41782

    Thanks! :D