How do I Make Incremental Enemy Spawn (like the birds in Castlevania NES) for 2D platformer?

0 favourites
  • 3 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hello, thanks in advance. Not sure (again) how to properly phrase this question for later reference, but I would like a similar functionality with the birds in Castlevania NES, Stage 11.

    Youtube link for reference -

    https://youtu.be/mOTUVXrAOE8?si=pRDrHPKVWSGydxJB&t=814

    I have a bird enemy that patrols the air:

    - fly from right to left, hit wall, fly to right.

    And when he has line of sight to the player:

    - drops a rock, and then flies away and up (out of layout, whereupon it is destroyed).

    When the bird leaves the layout, and is destroyed, I would like another bird to spawn in after approx. 2 seconds, from the right side of the screen, and perform the same actions:

    - fly from right to left, if LoS with player, drop rock, fly off screen (and repeat until the player gets beyond a certain point (I have a tall invisible collision wall boundary set).

    I have the functionality of the first bird working, and everything is fine, but I cannot figure out how to get another bird to spawn in at a further point to the right of the layout.

    As in the reference video above, notice how the birds spawn in, drop the "flea man" enemy, and then leave the screen, and a moment later, another enemy comes in and repeats.

    Here are some screen shots:

    Basic look of screen

    Layout - I set two invisible collision walls to act as a patrol barrier for the bird

    My event sheet for the bird

    Here is the Capx file:

    https://drive.google.com/file/d/1ipmMMb-Pu6uckvWgsj9nb6XORwq7TwuF/view?usp=sharing

    Thank you for your help!

  • How about this:

    1. The bird does it's thing and flies off screen

    2. Instead of destroying it, just suspend it (disable it's behavior, there are various ways to do this: e.g. disable a group, set a boolean to false or a state machine) use the timer behavior to start a two second timer on the bird

    3. On timer, reset & enable the behavior of the bird again (as in give it back the rock) and set its position to Y = whatever height you want it to patrol and X = player.X + screen width/2 + some offset so it starts off-screen

    4. This would also be the place were you can test if the bird spawns outside of its patrol area (if player.X + screen width/2 + some offset > rightWall.X) If that's the case, you can instead just start the timer again, which would mean every 2 seconds the bird will check if the player is in the right position for the bird to spawn inside the patrol area.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How about this:

    1. The bird does it's thing and flies off screen

    2. Instead of destroying it, just suspend it (disable it's behavior, there are various ways to do this: e.g. disable a group, set a boolean to false or a state machine) use the timer behavior to start a two second timer on the bird

    3. On timer, reset & enable the behavior of the bird again (as in give it back the rock) and set its position to Y = whatever height you want it to patrol and X = player.X + screen width/2 + some offset so it starts off-screen

    4. This would also be the place were you can test if the bird spawns outside of its patrol area (if player.X + screen width/2 + some offset > rightWall.X) If that's the case, you can instead just start the timer again, which would mean every 2 seconds the bird will check if the player is in the right position for the bird to spawn inside the patrol area.

    Ok, I tried to follow what you said, and I'm sure it is nothing like you intended, but I got the bird's functionality to work.

    HOWEVER, when the bird repositions (restarts its patrol behavior), the bird drops low, to the player's Y level (even though I do not have that specified), and tehn sometimes even lower. Why is this?

    Here are screenshots of my events, and a new link to the capx, if you want to take a look.

    My initial "patrol" group - this works

    My other functions and behaviors (it's sloppy, I know)

    link to the project file

    https://drive.google.com/file/d/1ipmMMb-Pu6uckvWgsj9nb6XORwq7TwuF/view?usp=drive_link

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