Freezing enemies

This forum is currently in read-only mode.
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • I'm trying to add the ability to freeze enemies, deactivating all of their movements and turning them into solids, but add/remove attribute is all buggy and I'm having a hard time doing this.

    Instead of using add/remove attribute, I tried creating a solid object over the frozen enemy and changing it's size to that of the enemy's. Problem is, most of the enemies use the platform behavior and end up being 'pushed out' of the solid object even though it's platform behavior is deactivated (bug?). Setting the enemy's collision mode to 'none' will fix this, but you need to be able to attack it when it's frozen, so I can't do that.

    I thought of some other workarounds, but they don't seem like they would be very..stable.

    Any ideas?

  • Well, when you set the enemy collision mode to none, can't you have your attacks hit the solid object and sort of "transfer" the damage over to the enemy? Like if enemy has a PV called Hit when it gets attacked, give a similar PV to the solid object and set Enemy Hit to 1 when Solid Hit is 1?

    Maybe it won't work with the way you have things set up, but it's worth a shot.

  • Thought about that, but then it would also hurt any other enemies (namely ones that don't interact with solids) overlapping that solid object. I could work around that by giving the solid object a value and setting it to the frozen enemy's UID, then comparing it so it only affects that enemy. Or I could use the object pairer..maybe even containers. Still..It just seems tacky. Guess I don't have a choice o.o

    edit: Yeah that's not working out so well.

  • How have you got the enemyAi working? If you use a state based active/inactive you can switch them off whenever.

    Ok so it is the solid thing that is the problem. Can you not leave the enemies with the solid attribute on the whole time?

  • Yeah, that might be a good idea. Leave them solid and use overlap at offset, if you can.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A little more information could help a lot. Why do you want to switch them to solid when they are Inactive?

  • If you just need to walk on top of them you could use the platform attribute, and place them behind the player.

    Beyond that as Steven, and SullyTheStrange said a state could be used with bounce, set y fall etc.on the player with overlap at offset.

  • Thought about that, but then it would also hurt any other enemies (namely ones that don't interact with solids) overlapping that solid object.

    How about that: instead overlapping use x,y comparsion, e.g.

    -enemy is frozen -> create solid at enemy's XY, disable collision mask for enemy

    -solid recieves damage

    ????-enemy's XY equal solid's XY -> substract enemy's HP

  • Ok so it is the solid thing that is the problem. Can you not leave the enemies with the solid attribute on the whole time?

    The enemies and the player both use the platform behavior, so if I make them solids when they aren't frozen/deactivated, they will push the player around.

    Also, I'm making them solid when frozen so 1. They can be used as solid platforms and 2. so they don't hurt you.

    > Thought about that, but then it would also hurt any other enemies (namely ones that don't interact with solids) overlapping that solid object.

    >

    How about that: instead overlapping use x,y comparsion, e.g.

    -enemy is frozen -> create solid at enemy's XY, disable collision mask for enemy

    -solid recieves damage

    -enemy's XY equal solid's XY -> substract enemy's HP

    Worked pretty well when I tried it earlier, but it brought up another problem. My player is using a melee weapon, so if the solid is created over the enemy while the player is still attacking, it's instantly destroyed (along with the enemy). I tried implementing a sort of limit, so the solid could only be hit a short time after it was created, but it was kinda buggy.

    Thanks for the help so far. Time for more experimenting.

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