1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

(Hard Level) Create Breakable Gates. But.. Is it possible?

Discussion in 'Development' started by Daniel Pereira, Mar 5, 2018.

  1. Daniel Pereira

    Daniel Pereira Silverfish

    Messages:
    22
    GitHub:
    Undentified
    Hello Fellow pocketmine coders!

    While I was structuring the game I wanted for a add-on in a plugin in the future I came across a problem.
    I'm wondering myself if any of you has any Idea how a "gate" the size of Castle Gates can be created seeing pocketmine as it is now and if it can be destroyed plus rebuilded with a special repair item.

    What do I mean? I mean this (Video):


    Description: Defending faction is holding the gates. The gates in front of them get broken and they will hold of the incomming enemies.

    See it and try to think about it in minecraft pocketmine. How would you do such gate with this properties such as "Durability/Health" "PlayerBreakingGate" "FixingGateDurability/Health and implement them?

    Since im totally not seeing a "falling gate" animation I only expect the gate to be made of a set of blocks. For example, the gate is composed of 8 wooden blocks. And this blocks somehow will act as one and making it a solid gate so the gate state is "normalGate". If the gate is destroyed, the gate will simple just be on the ground and this means that all those 8 blocks will disappear and another set of blocks will appear on the ground looking like it had been destroyed plus making the gate state as "brokenGate".

    What you guys think? How would you make this ? Thanks for any help given here! Appreciated by the max.
     
    Marabou and Muqsit like this.
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    say gate have 8 width and tall of 5
    made of wood
    for falling animation, you can rotate it horizontally, and then remove % of the block so it looked like a gate once was there but now has fallen (the direction depending on last blow)
    you could try falling sand riding moving entities to look as if is falling
    if you insist on two gates, you can /2 the width and choose to drop the left or right part randomly when hp reaches lower then 50%
    the gate have:
    position1 (gate start)
    position2 (gate end)
    facing (facing where?)
    hitpoint
    state is not necessary as if hp = 0, state = broken else holding

    an attack will reduce the hp by attacker's weapon stats
    an repair will either instantly repair it OR having repair person standing there for X time OR having to hit the gate with repair tool for X times, so long the gate wasnt hit or the counter resets
     
  3. Daniel Pereira

    Daniel Pereira Silverfish

    Messages:
    22
    GitHub:
    Undentified
    Thanks @Thunder33345 for your reply! Now I know the ideias on how to do it I will try it in the future.

    The gate will be only 1 not 2 sides so I think it will be simpler!
    I will not make animations atleast for me since I'm not seeing how I would make that in code, seems too much work but that's just me xD

    I need to create a gate and give the states "Holding" and "Broken" and the hitpoints as you said.
    If its Holding with will look with the blocks on their normal place (the gate will be up) otherwise the blocks on "Holding state" will disappear and became air. And the ground blocks will became the wooden blocks that make that gate so it looks like it felled!

    Now seeing that the gate is a set of blocks, I wonder how the player will hit it ? Maybe breaking one block of the gate and repeat for example for 50 times before it gets down?
     
  4. SteveDev386

    SteveDev386 Silverfish

    Messages:
    17
    GitHub:
    dschwartz783
    I'd suggest creating a logical link between the blocks belonging to the gate, and keeping track of the hits for all the blocks belonging to it. That way, it can be treated as one logical gate, even though it's made up of any number of blocks. You could also keep track of the overall gate durability this way.
     
  5. Daniel Pereira

    Daniel Pereira Silverfish

    Messages:
    22
    GitHub:
    Undentified
    @SteveDev386 Ah true forgot that! Thanks for the warning :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.