Alon's Forum Posts

  • Based on the latest file version I shared (first page) is it too complicated to limit the Max Width so it will stay in fixed width?

    1. I want to stretch the Tile-Background dynamically (WYSIWYG) on the layout, so I can always get back and tweak it later as well without messing with the code.

    2. I want to be able to change the "MAX HP" variable without changing the actual width.

    So even during the game I can add or sub from MAX HP at anytime.

    I'm guessing it's a math related (percentage / formula) and that's something I'm not good at but maybe there are other ways, I have no clue... but as always like to explore and hopefully learn something new.

    Thanks ahead!

  • See Blend Modes official template in C3.

    Thanks, I'll check it out :)

  • Thanks! that's sounds EXACTLY how I would do it as animator in my animation progress (not related to programming).

    I never used mask in C3 I'll try to found more about it in the documents.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now for something related, but I guess it should be done differently but not sure how exactly:

    -

    What if I have a fixed width for animated health probably as Sprite (animated image sequence) and not Tiled Background.

    The width should be based on the fixed size of the sprite and somehow... reduce / cut from it, basically I don't want to stretch it using the width like with the Tiled Background, so what is the solution.

    I've created a quick ugly animated example (it seems like animating sprites in C3 is not a good idea)

    My Example File

    -

    If you don't mind please have a look and share your mind, I'll be happy to learn something new! hopefully it's not confusing as the math-formulas but I'm still curious.

  • That's very cool dop2000 thanks!

    I sure like using this Tween solution with the different ease modes.

    -

    I'm looking at the code, it makes more sense to me but I notice that you're using Min and Max

    also there is "0" at the end, Can you please explain a bit how it works?

    Damage:

    max(Self.Current_HP-Global_Damage, 0)

    Heal:

    min(Self.Current_HP+Global_Heal, Self.Max_HP)

    Thanks ahead! :)

  • dop2000 so I created a simple example file (not the cleanest, but I visual it's nicer for me)

    I got pretty much most of the basics to work:

    I limit the minimum and max of the "current_HP" to not break the visual container.

    I didn't set the container to every thick, because I just want it to be steady as a HUD that won't change anyway.

    But Tween is where I got lost, since I try to get away from formulas (if possible) I tried this:

    End result to be: "Current_HP - Global_Damage"

    I also tried HP_Bar.width...

    -

    Is there a way to simplify it without the formulas? just wondering, if not.. I guess I'll have to "copy past" but I tried my simple-brain first.

    My Example File

  • You can also try Tween with different easing options.

    Every time the health changes (increases or decreases), restart the tween for healthbar width. End value: maxWidth*(currentHealth/maxHealth)

    Oh nice! that sounds interesting, I never actually used tween yet... or the timeline for animating stuff, maybe it's a good time to try them out.

    Basically anything that is more "user-friendly" less math-formulas for my simple brain will be nicer :)

  • Thanks for the explanation!

    I'll try to re-create something simple and implement it on the way I would in the game using instance variables and such just to explore it and make sure I understand how it works.

    If there are other / extra examples related to this, I'll be happy to learn from different ways of as well, the more the merrier :)

  • Thanks for the quick reply and example! :)

    TBH - I don't understand any of it even that it's only 2 events...

    Maybe I should make a simple example so I can try implement it as "damage" variable = smooth amount in X speed.

    I guess that the dt is delta? which is probably related to the speed of how fast the health will drain, but still I only guess things for now.

  • How can I make the health reduced by "Damage" (variable) smoothly instead of immediate result?

    Visual Example: (Street Fighter 2)

    If anyone don't mind sharing an example file and explain step-by-step how things are working it will be very appreciate since I didn't have a chance to do health-bar related things beside simple count without an actual health bar.

    If there is a plugin / behavior to make my life easier I'll be happy to check it out.

    Thanks ahead!

    Tagged:

  • Thanks! :)

    So... if I'm not using Families in this case and I will use "Player_1" (the container) only.

    Will I be able to change animations to ALL the sprites that are inside the container as well in the event sheet instead of doing it individual one by one? (per sprite) ?

    Because I will have to have both individual control (As I can just point specific sprite on the even sheet of course) but what about ALL ?

    For example, if I change "Player_1" animation will it also change the others?

    Same for Z-depth, who will be on top and so on...

    In general I need access to control ALL in one, and also individual of course (per sprite as I already)

    Sorry for the confusion.

  • The reason I'm using families is because the control of the position, z-depth and animation in the code later on, I must have all of the animation sprites with same names / speed to work together.

    I tried to use Containers but, I don't know how to work with it... maybe I should give it a try but from my last experience I gave up on it because I couldn't understand how to control it.

    -

    UPDATE:

    I made it work, but is it efficient enough?

    I don't want to have sync / lagging / delay later on that's why I wonder:

    UPDATE #2

    I just tried to use Container as you suggested :)

    So, I still have the Family for the reason I explained above, but not even sure if I need it ??

    Also, is it going to sync better even when I'll add few more sprites (more equipment, each animated, same idea as I explained above)

    Thanks ahead!

  • Thanks for the reply Ashley!

    I'm sorry I tried to follow but I'm still confused. based on what I explained (first thread above)

    -

    How can I create these 2 Sprites that related to the family and PIN them to the "Player_1" sprite?

    I tried to Create using the system create object, but it won't PIN them after created.

    I tried to Create by spawn them from "Player_1" as soon as it's created but I get the same result...

    Both Sprites created, but not PINNED to "Player_1"

    so am I not spawning right? or there is something I'm missing related to the PIN action?

    Thanks ahead! :)

  • Thanks for the explanation!

    I tried this:

    But now it won't pin the created sprites to "Player_1" anymore...

    How can I PIN them as soon as they created? because I will probably add more sprites to this family and ALL must be synced perfectly.

  • I have "Player_1" = invisible Sprite that holds the controls and collision.

    I've created 2 different sprites inside a Family: "Player_1_Animations" (will add more to it later)

    "Character" - include the base character animations (Idle, Walk, Jump, Fall, Hurt, etc..)

    "Character_Weapon" - include ALL the different weapons (same animations as above)

    Each of the sprites in "Player_1_Animations" family have ALL the exact same animation names, same speed, and they fit PERFECT if they are above each other (play as one)

    So far so good...

    The problem is that when I first Create "Player_1" to the scene, it will only show ONE of the Family sprites, either the Weapon or the Character but not both.

    How do I make ALL family members appears as soon as the Family created?

    I'm planning to add more sprites to this family but I want to make sure it works first.

    Thanks ahead for any help!

    Tagged: