TwinSix's Forum Posts

  • 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

  • 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!

  • Oh wow, this is perfect! I have not tried (even thought of) states, much less did I expect you to do anything.

    THANK YOU!

    I admit, I would never have thought of this, either, so thank you for letting me see this code. This alone helps me with nearly every other enemy idea I have for the game.

    Thank you again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any suggestions on how or what I might do to achieve that? I tried pathfinding (to much frustration), but that does not solve my problem of telling the bee "when you see the player: attack; when you do not see the player, or if the player leaves your line of sight, return to doing what you were doing, in the spot you were doing it".

  • I set the direction events as subevents (Pic #1), but I will go ahead and apologize - this wording is confusing me.

    However, it produces some interesting results - close to what I am looking for, but not quite. Under the event sheet picture, I will show some example pictures of what I mean.

    Pic #1 - Sub Events

    For instance, when I stay away, the enemy behavior is fine. When I approach, the enemy comes at me, but he starts to "fly" upward, for some reason.

    Pic:

    Or maybe it is how I set up his behavior, but when I leave his LoS, his normal patrol pattern is broken. Is there a better way to set up his patrol behavior?

  • 2d platformer, and I have a patrolling enemy (bee). I have has his patrol event set properly, and it works:

    (Bee Patrol Group, Line 9 - see pic below))

    bee travels to the left, collides with with invisible wall, mirrors, travels to the right, collides with wall, repeat.

    I want the bee to see the player, change animation and then move toward the player slightly faster (this is where I set the Move To event). I want the enemy facing to be toward the player, according to player.X position (lines 16 and 17 in pic below), however, I want the original behavior to be followed until the enemy sees the player, OR, when the player moves out of range, I want the enemy behavior to return to its default patrol.

    The first patrol group (Bee Patrol) works as intended - the enemy changes directions, and all is fine. However, when I activate the Bee_los group, the enemy does not change facing when hitting my invisible wall (which should trigger him to mirror and begin traveling to the right). The animation changes work fine.

    Attached is a screenshot of my event sheet, and a link to the game file. The faulty group (Bee_los) is deactivated, so you can see the game work normally before you get into the troubles.

    The player is set just to the left of the bee enemy, so upon initializing, you can sit in place and watch the bee hit the wall, and then mirror and patrol to the right. In the Enemy Behavior event sheet, activate the "Bee_los" group, initialize, and you will see the bee does not change direction.

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

  • SOLVED

    I am solving my own post, but if the mods would allow it, I would be interested in reading how other, smarter people solve my problem.

    SOLUTION:

    Use "Move forward" and set the number of pixels (in my case, I set it to 8, then 16 on the direction change)

    This solves the movement issues, and since the poor toad is just a simple enemy, there is no need for intricate pathfinding or anything.

    Pic of my event sheet for anyone's future reference:

  • FOR REFERENCE - this is related to my previous (solved) post about incremental enemy movement

    https://www.construct.net/en/forum/construct-3/how-do-i-8/enemy-move-once-go-idle-move-180665#forumPost1102917

    I have the movement set for my first enemy (toad), and he moves exactly the way I want him to move, according to his animations; his animation state determines when, where, and how he will move (in this case, a slow hop to the left, collision event with an invisible wall, then he is mirrored, and hops slowly to the right).

    My problem is that I CTRL+clicked "toad" (to copy it) and pasted another instance of the same enemy (toad) on the next platform in my level, and the movement animation timing is the same, however the cloned enemy moves much further, and in a quick way. My movement parameter is: set platform vector x to Self.X*-0.8, and I only want the toad to move along the X axis, and as you can see, I don't want it to hop very far each time.

    The cloned toad is hopping MUCH farther when his movement triggers, and I cannot figure out how or why this occurs.

    Below are screenshots of my event sheet and layout, and I have included a weTransfer link of the game file, in case anyone would like to help. Thank you!

    WeTransfer download link

    https://we.tl/t-8ZhM656WKT

  • Thank you!

    I was able to create a small workaround, however I guess I need to upgrade my license.

    Thank you again for your time and help!

  • > ...

    >

    > https://we.tl/t-PYVug00lhI

    You gave a false link, I didn't find the file there.

    odd, it works for me. Apologies. Let me see if I can do something else.

  • The player sprite is on layer "Layer 0" with 100% parallax. The bullets are spawned on layer "bg" with 0% parallax.

    Oh, wait, you meant that the bullets should be on a parallax layer?

    I placed the bullets on my HUD layer (bg), and set the parallax to 100% x 0% and that fixed the problem.

    So, firstly, THANK YOU!

    Secondly, why did this happen? Every tutorial (both on YT and even the Construct 3 tutorials) use the same procedure:

    "add sprite, set condition to spawn sprite from player, add bullet behavior", and the bullets work; so with my immediate problem solved, I am curious why the bullets behave this way? The tutorials did not require me to set a new layer for the bullets, and now I don't have a HUD layer for my player.

  • No, both the player sprite and seed_bullet are on Layer 0.

  • Yes, I am using the free version, and I had to place my HUD (hitpoints and ammo counter) on a parallax layer, which left me no choice but to place everything else on the same layer. I appreciate your offer to help.

    As I previously mentioned, when I collect the seed on the left side of the screen, the bullets fire normally, however, as I progress to the right side of the stage, the origin point of the bullet lengthens further and further along the (X axis) away from the player sprite. When you collect the first seed, fire it, and you will see it firing from the origin point. walk to the right (to the edge of the cliff) and fire some more, and you will notice the origin of the bullet has moved. I only have a single "Scroll-to" behavior set on the player sprite for the camera - no additional conditions.

    I have attached a link to the C3 file, and disabled the limited ammo count on the event sheet, that way you can simply collect the "seed" and fire it to see my problem.

    WASD - moves/jump

    SPACE - fire seed (after collecting one at beginning)

    https://we.tl/t-PYVug00lhI

  • Apologies for the long title. I saw one other thread on this problem, but cannot find the solution. I have a 2D platformer, and I want the bullet (seed_bullet) to:

    fire from my player sprite (image point 1) when I collect the item, and press [spacebar] to "fire the bullet" (spawn object on player).

    When I am on the left side of the screen (my stage layout) the bullet spawns, and travels accordingly, however, as soon as I travel to the right, the bullet spawns and fires, but it spawns further away from my player. When I reach the far right side of stage, the seed is not even spawning in my layout. I have attached pictures of my event sheet for the bullet, as well as my layout, in case I am overlooking something, but I am stuck.

    The context:

    Player picks up seed, and gets his ammunition, then he can fire the bullet. I want the bullet to spawn from his Image Point 1 (which I have set to the player sprite). I am not concerned with directional facing yet... I cannot get the bullet to spawn even correctly.

  • I DID IT!!!! I'm not sure if I did it correctly (or the exact way you instructed me), but I found a way, it's less messy than before, and ultimately, IT WORKS - the toad moves incrementally and changes directions based on contact with a sprite.

    You mentioned adding another condition, and I looked up adding additional conditions - so I added a collision event, and "set mirror", then I just added the value check "is mirrored" to the enemy animation. I am sure I have no clue what I just typed, but I included a picture.

    Thank you for all your help!