How do I prevent wall-phasing attacks/shorten my attack script?

0 favourites
  • 2 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I am making a platformer, it currently looks like this:

    The pink rabbit is the player, the cyan-outlined thing at the right is an enemy.

    The first problem is that I want to prevent the player from attacking enemies that are in unreachable places without having to delete the colision box from the slash attack objects. This doesn't represent much of a problem right now since the only attacks in the game are the normal slashes and I could just make walls wider, but later I will add attacks with a much larger area of effect that could be easily abused to attack enemies through walls.

    The second problem is more of an utility one.

    This is my current script on making the enemy suffer damage:

    The first slash deals 4 damage, the second one deals 5 damage and the third one deals 7 damage.

    When a StaticDemon collides with any of them, they release particles, change their animation to "Hurt" and their counter to 0 (The counter adds 1 every time their Idle animation finishes and it resets on 3, the moment they shoot, so hitting them re-resets their counter).

    However, this means that I wouldn't only have to "copy/paste/replace object" these attacks for every single enemy, but also for every single attack object.

    The ideal solution would be finding a way to say "Slash 1, if in contact with any enemy, decreases their HP variable by 4, spawns Particles on the scene and shakes the screen by 5 for 0.1 seconds. Slash 2, if in contact with an enemy (...)" to make every attack different from each other but affecting all enemies in the same way depending on the kind of attack.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Second problem is resolved by using Families, it is a way of saying 'any enemy'. You put all enemies into a Family and things like hp becomes a Family instance variable, so then you say Family on collision with combo, subtract 4 from Family.hp and this applies to all enemies.

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