lifebar - corner of screen even if moving

Get help using Construct 2

Post » Wed Apr 30, 2014 4:03 am

@eli0s
link doesn't work? can you attach it instead?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Wed Apr 30, 2014 1:04 pm

I haven' even noticed that there was an attach option :oops:

I don't understand why my ftp seems offline to you though, I am curious, is it perhaps an antivirus blocking the address, or a Geo-locational issue? Can you send me a pm and tell me from which country are you accesing the internet? I want to consider all possibilities before I check with the ftp provider.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed Apr 30, 2014 1:14 pm

@eli0s

I'm sorry I wasn't specific enough. Is there a way to make different enemies (meaning different objects inside a family) have their own individual lifebar but automatically being created top to bottom of right side.

Like I have this setup (for example):

Family BOSSES:
object Boss1
object Boss2
object Boss3
object Boss4
object Boss5
object Boss6
object Boss7

so in Layout 1, Boss1, Boss2 and Boss3 are the boss characters.

So I checked the count of the family BOSSES object that are already existing in the layout (can't create the bosses since they are specific), then I don't know the next steps how to determine which lifebar is for which boss.

Do take note though that I added a text family variable "BossName" that I set to their individual names for each boss at start of layout. I'm sure I will use that in this problem but I don't know how.

My game is a platform scroller beat em up game. So each level has specific bosses.

I'll send you a pm about your site.

edit:
can't send you a PM because "The requested users to be added do not exist." I don't have a clue what that problem means.

Anyway, here's my intended PM to you
"I don't think I can't access your site because of my antivirus because there will be a small pop-up message from it if it is blocking any sites. None pops up when I go to your site.

I'm from the Philippines, but I'm not a Filipino by blood.

Thanks"
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Wed Apr 30, 2014 3:07 pm

The only thing I can think of is to create each enemy individually and set its family "Name" Variable to a "Name" variable on the lifebar object that you'll create right after. The problem is to find a way to align those bars dynamically. If you hard-code the creation process, then you'll have a particular order of creation to use in order to add a Y offset on each lifebar. This is the crude, brute force method of course... :shock:
I am sure that using an array system will be most effective, but I can't begin to understand how arrays work, their commands are too cluttered for me :?

Here is an updated capx, close to what I am describing above.

http://www.eli0s.com/Tests/EnemyHealthBarsUpdated.capx
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed Apr 30, 2014 5:16 pm

@eli0s

I'm sorry but I still can't access your site. I already turned off all antivirus/anti-spyware and similar programs
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Wed Apr 30, 2014 7:24 pm

Errrrrrrr, sorry, I' ve lost my mind apparently! :oops: :?
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu May 01, 2014 10:29 am

@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.
Last edited by sgn15 on Thu May 01, 2014 4:34 pm, edited 2 times in total.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu May 01, 2014 12:28 pm

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...!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu May 01, 2014 12:45 pm

@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.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu May 01, 2014 1:14 pm

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
B
8
S
1
Posts: 62
Reputation: 627

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 24 guests