lifebar - corner of screen even if moving

0 favourites
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Errrrrrrr, sorry, I' ve lost my mind apparently!

  • eli0s

    thanks for your example. using your example file as a base, I got some aspects of my idea to work!

    The number of lifebars created are equal to number of bosses existing in layout. I detected the number of bosses using count and save it to a global variable and I have a counter for number of bosses so it makes sure the number of lifebars are equal to number of bosses.

    My problem is that it keeps on repeating on selecting the same 1st boss, so the other bosses are not selected. This is shown because the name of the boss is also the name of my portrait's animations.

    I need to be able to select all of them 1 by 1. Meaning, after selecting Boss A and entering the boss name into a var, I do the same for the other bosses until I enter all of their data.

    I cannot use your method because I am using this event sheet for many layouts/levels, so the intent is to make this possible regardless of layout or number of bosses.

    Here are my events

    http://oi62.tinypic.com/29dvfas.jpg

    Please look at the X part of my events. That's where the problem lies. My logic was something like: enter boss name into both BossName and then if not similar to value of BossNamePrevious, I go on entering it. I thought this logic would solve my problem. But it did not. Probably something wrong a bit with the logic. Can you help me?

    I can't check yet if the SourceUID are being set accordingly until after I fixed this problem.

    This is the setup of my lifebars just so you can understand.

    http://oi58.tinypic.com/xg61k.jpg

    The tutorial I used for the lifebar was this

    https://www.scirra.com/tutorials/182/ma ... cy-lifebar

    That formula works for my player lifebar (player has its own set of similar lifebar-related objects), but I have to add some conditions for boss lifebars since I am coding a universal system for any number of bosses.

  • I am afraid that my limited knowledge doesn't allow me to come up with a solution.

    Using families is something I am not familiar with, I don't even know how you manage to count the individual members (enemies) within the family. On my tests it just returned the value 1, which was referring to the family, not the objects. This is relevant to your inquiry about selecting the enemies 1 by 1.

    Again, a brute, hard-coded system (that will create the enemies 1 by 1, set their position and attach a linked life-bar), is as far as I can get. As I understand, you want a dynamic system (perhaps based on arrays), I hope that some other forum member, with greater experience/skill than me could provide you an answer...!

  • eli0s

    hmm, I stored BossBoxes.Count to NumberOfBosses global var at start of layout. In my layout for testing, I have 2 different objects that both belong to BossBoxes family, and in my file, it did create 2 LifebarHolderAreaP2 instances (the formula for y position is the "height" of each instance).

    Now that you mentioned it, I tried the layout with only 1 of the 2 bosses at a time and it worked (only 1 lifebar when 1 boss only) for both occasions. The animation of the portrait is wrong yet so till now only the "equal number of lifebars and bosses" aspect is working perfectly.

    Did you try the "System: NumberOfBossesCOUNTER < NumberOfBosses" condition? that's the condition that makes it repeat until lifebars equal bosses.

    I'll give that part where I encircled another few minutes to try and if still no progress, I might try arrays. I have never used arrays in c2, although I know what arrays are.

  • Simple:

    1 Layer: HUD (Parallex 0, 0) - Place HP Bar

    1 layer : Player (Parallex 100,100) -Place Player

    Now add a Pin behaviour to the hp bar and pin it to the enemy when you have it spawn in.

    To go to top right just use an array and calculate position.

    How to make a resizing one:

    (Every tick)

    -Set HealthBar Width to Health (Assuming health is a global variable)

    However if health is something like 10, you will only have 10 width so you can times

    So if your HP is 10

    (Every Tick)

    -Set HealthBar Width to Health*10

    This will make the HP Bar have a width of 100

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dilk

    thanks. but can you help me in my new problem?

    basically a few posts above (the very long post). It's about a system that will create number of lifebars the same as number of bosses in any layout (with corresponding functioning individual lifebars as well).

    you might be able to fix my problem. thanks

    eli0s

    If I code it in a way that the boss objects themselves spawn their own lifebars, I would need to have each of the bosses take a number from 1 to n (total number of bosses).

    Do you have idea how I would give them distinct whole numbers starting from 1?

    EDIT:

    I FIXED IT!!! without using array too!!!!

    I found a way to loop through text variables!

    thank you eli0s for all your help here. very very very much appreciated!

  • I am so glad you found a way around it! Sorry I wasn't able to provide more help, in reality I am a newbie in programming, I find it very difficult to wrap around things that involve preparation and though ahead :O

    As fro the last question before your edit, even if it's not relevant for your project now, I think a way to do it will be something like the following:

    For (round(random(n)) ----> set BossCount (//this will be a variable with initial value set to 1) + 1

    Anyway, congratulations for your success and good luck!

    Elias

  • eli0s

    All those past C Language programming classes with countless "for" loop lessons finally paid off for me

    ok thanks. i'll keep that in mind in case I need it. I'm still having problems right now regarding "connecting/relating" each lifebar to its boss.

    "Pick by comparison" only accepts number values so it prohibits me from using expressions involving text variables. This is my current problem.

    I tried using number (UID of boss stored in variables) but it doesn't work in pick by comparison so far.

    EDIT:

    problem fixed

  • I was going to suggest using a number instead of a name and convert it to a string inside the pick by comparison, but that probably wouldn't work any way.

    Glad to hear that you are pushing forward

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)