How do I acces an instance variable from family

Just started using Construct 2? Post your questions here

Post » Wed Oct 08, 2014 8:35 pm

j0schi wrote:it took me a while to exactly understand what you wrote... and on second thought i have to go with my aproach. i want to use the instance variables, as i need more values than just the description. and it seems to be "cleaner" for me if i dont define all that over the actions but in the instance variable for the objet itself :)

let me know if i am wrong here...

regards
patrick

Think my last post answered it :D
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Oct 08, 2014 10:19 pm

ive already read this article 2 times, maybe i have to read it again hahah
ive got your point, but i have to set the instance variables to the ojects or not?

maybe the next screenshot makes it clearer what i want to archive:
problem3.PNG

on the other hand i ran into the same problem with the enemy health... each enemy has a certain amount of helth when he spans. all enemys are in the family pirates
now if the enemy gets a hit i have to subtract one of the health of this enemy... man that really gets complicated, i will look at your example again and hope i get it.
if or if not i will report back tomorrow... normaly i cant sleep when i have something like this in my mind haha
You do not have the required permissions to view the files attached to this post.
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Wed Oct 08, 2014 10:32 pm

hah, i think i got it know! maybe i am an idiot, but here is the point where ive got confused:

If you add an instance variable to a family, all the object types in the family inherit the instance variable. For example, adding the instance variable health to the family Enemies in the above example will mean BladeEnemy, BugEnemy, CrescentEnemy, FighterEnemy, SaucerEnemy, ScytheEnemy and SlicerEnemy all gain a health instance variable. It will also appear in the editor alongside each object's own instance variables.


As you can see the object astroid_iron is in the family RadarObjects. But in the editor it has neither of the instance variables from RadarObjects.
problem4.PNG

so i assumed that the instancevariable from the family doest count for every single object, but just one time for the whole family. and if i set it to another value all values get changed for every object. if it count for each object in a single way and is editable for each single object seperatly it does exactly what i want it to do :D
Is this an roor in the discription, a bug or am i still missing something?

found it: on the propertys on the left site of construct it shows up... man thank you so much again ;)
You do not have the required permissions to view the files attached to this post.
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: Obi554 and 1 guest