How do I let objects communicate in a layered spawn system?

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm working on a game right now, where you dig deep down underground. And there are many different levels (as in strata underground) and "loot" you'll find.

    Now, I've already created a system where each level is divided into 4 parts.

    [Loot]                              (Like crystals or whatever)
    [The coming up Base level]          (For the Transition level Dest. out.)
    [A Transition level with Dest. out] (For transitioning to another type of base level)
    [Base level]                        (Dirt for example)[/code:2fkbxyay]
    
    Now, my problem is, since the level that has the "Health" variable is the base level, how do I let the other 3 levels know that they are supposed to be destroyed?
    
    Since the base level will not always be the same one(dirt/granite/basalt/whatever), I cannot say: "set level.Hp to dirt.Hp", and if I use the family of the base level, it sets the HP of ALL other levels currently on the screen to the HP of the base level.
    
    Containers don't work too, since then the dest. out. of the trans. level fucks everything up.
    
    I am clueless. How would go and fix this/any other ideas?
  • I don't understand your question..

    What are you trying to achieve?

    "How do objects communicate?

    How do I let the other 3 layers know that they are supposed to be destroyed?

    "set layer.Hp to dirt.Hp""

    You want to destroy something, obviously, but the whole layer?

    Why does the layer have hp (Layers don't have variables, do they?)?

    Why do other layers get the same hp?

    Couldn't you use a condition to determine what the hp should be if dirt = 50 if granite = 100, etcetera?

  • I changed language a bit to be more precise.

    By "layer" I didn't mean the layer where you place objects, but the dirt "layer" itself.

    Maybe a link to the current version of the game will help: http://www.kongregate.com/games/Lexoria ... irt-2-beta

    There are 5 Dirtlayers, or Dirtblocks.

    And in the new version, each of them will be composed of 4 parts, to make it more diverse and easier to add new content.

    Here's a screenshot of my problem: https://i.imgur.com/qG8jDQ7.png

    Now, I set the "LayerHP" var to the BaseLayers HP.

    But then, when I want to set the Basalt layers HP to "LayerHP" it sets EVERY object of the "layers" family to "LayerHP", which I don't want.

    The Basalt layer is interchangeable.

    Is it now a bit clearer?

  • Not really, Your second action of event 28 is setting HP of all familymembers of the "layer" family to LayerHP..

    If you don't want this to happen, why have that action?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How else would I set the HP of it?

    Since it's not always "basalt", there will be over 60 different Objects.

    How do I show the game which one is the correct one?

    How do I specify it?

  • if there is any logic in the way the value increases, there should be a way to tell the program that..

    You might have a variable already present in the object(s) that you can use..

    Another option might be adding a condition "is on layer" or something similar before setting the variable..

    Setting everything is not what you want, so in the worst case even using 60 conditions would get more satisfactory results..

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