Set to "harmless" on spawn

Get help using Construct 2

Post » Fri Dec 14, 2012 5:44 pm


So, basically I got a caged survival game where enemies spawn every set seconds and the player's task is to just dodge them.

Enemies are homing to player's direction and set into bullet. Spawn are set into random to the coordinates of the playing field/layout.

Now I want to make the enemies "harmless" on spawn where it:
1. Set a flash effect/animation to indicate that it is spawning
2. Stop moving on spawn for the whole duration of the animation (around a sec or so)
3. Set into "harmful" after the animations and start chasing the player to death again

This serves as a warning system so that the player doesn't die from frustration due to the occasional "enemy spawn on player". Tried a whole lot of things and it just didn't work, so any kind of help is highly appreciated.

Thanks before.
moondane2012-12-14 17:46:22
B
5
Posts: 3
Reputation: 781

Post » Fri Dec 14, 2012 5:58 pm

Add the flash behaviour to the enemies, then in the events - on flash finished set harmful to TRUE and only chase player when it's TRUE of course.

An easier option might be to place a few spawn points around the level, and maybe pick the furthest one away from the player and spawn there.

Another method would be to check the coords of the spawn, if it's less than a certain distance from the player, then try different coords until they're far enough from the player, then spawn.

Sorry, slight hangover so not really sure if that makes sense, although it does to me ;p
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Dec 14, 2012 6:36 pm

Did your advice and it went great. Thanks a lot. Now enemies spawned motionless and move only after the flash ended.

Now the only thing I still need to solve is that I want the player to be able to "pass through" (no collision) the enemies when it still do that flashing animation.

Any recommendation on how to solve this problem?

Again, thanks before :D
B
5
Posts: 3
Reputation: 781

Post » Fri Dec 14, 2012 6:56 pm

I thought I might not have explained things properly, but great to hear it worked!

Just add these new sub events to your collision code..
+ On collision / overlap whatever
+ Pick closest enemy to player << may not be needed, depends on your checking
+ If harmful is TRUE << new sub event
- Do collision stuff

This way, it'll only execute the collision events if harmful is TRUE, otherwise it'll just skip it.
Make sense?
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Dec 14, 2012 7:07 pm

wow, can't believe it's that simple. It works perfectly now, just like how I wanted it. Thanks a lot!
B
5
Posts: 3
Reputation: 781

Post » Fri Dec 14, 2012 7:16 pm

Yes, it's always the obvious things you don't think about. I get that a lot believe it or not ;p

Glad I could help. Just shout if you have any more problems.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650


Return to How do I....?

Who is online

Users browsing this forum: gregorysforster and 22 guests