Freezing enemies

For questions about using Classic.

Post » Sat Apr 09, 2011 6:57 am

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?
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Apr 09, 2011 7:08 am

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. :)
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Apr 09, 2011 7:46 am

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.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Apr 09, 2011 8:06 am

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?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sat Apr 09, 2011 8:10 am

Yeah, that might be a good idea. Leave them solid and use overlap at offset, if you can.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Apr 09, 2011 8:19 am

A little more information could help a lot. Why do you want to switch them to solid when they are Inactive?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sat Apr 09, 2011 8:44 am

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.
Image Image
B
161
S
48
G
91
Posts: 7,357
Reputation: 67,269

Post » Sat Apr 09, 2011 9:10 am

[quote="Tokinsom":1102jmij]Thought about that, but then it would also hurt any other enemies (namely ones that don't interact with solids) overlapping that solid object. [/quote:1102jmij]
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
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Sat Apr 09, 2011 4:49 pm

[quote="Steven":3n4dsa84]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?[/quote:3n4dsa84]

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.

[quote="DtrQ":3n4dsa84][quote="Tokinsom":3n4dsa84]Thought about that, but then it would also hurt any other enemies (namely ones that don't interact with solids) overlapping that solid object. [/quote:3n4dsa84]
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[/quote:3n4dsa84]


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.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests