Floating countdown

0 favourites
  • Hello, how do I make each enemies have their own floating countdown that follows them everywhere?

    The enemies stay in the pool for 15 seconds after which they dissipate and die. Normally the player can't see the countdown, but after receiving a certain item, they will be able to see if an enemy is about to die 5 seconds before they do. But I just can't seem to make the countdown sprite spawn exactly where I want them to and also make them follow the enemies that spawn them.

    drive.google.com/drive/folders/1sJccsvmnA0O4rx2rBkTU1ixWrvh1-JU7

    Inside the link are 2 screenshots, one which details my event sheet regarding enemy behavior and one which is what I want to make it look like. Thanks in advance.

    Tagged:

  • Hey, you are still working on that disgusting game :)

    Add the SpermCD and the enemy sprite into a container. SpermCD will be created automatically for each enemy and they will be logically linked. In "Enemy on created" event you can re-position the countdown above the enemy and pin it to the enemy. You can make it invisible by default and show only when needed.

  • Hey, you are still working on that disgusting game :)

    Add the SpermCD and the enemy sprite into a container. SpermCD will be created automatically for each enemy and they will be logically linked. In "Enemy on created" event you can re-position the countdown above the enemy and pin it to the enemy. You can make it invisible by default and show only when needed.

    Hey, nice to see you again! And yes, this game is now officially my end of term project for my game making class :D

    I tried doing what you said. The SpermCD spawns with the enemies now, but even though I had tried establishing an image point on top of the enemy and tried to Set SpermCD position to object > Imagepoint 2 (which is supposed to be on top of the enemy), the SpermCD still appears in the middle of the enemy? I mean it looks good already :/

    Additional screenshot is inside the drive.

  • Do you have this image point in all frames in all animations?

    Actually, it only needs to be in the default frame/animation, but to be sure add it to all.

    You can also simply position the CD object to (Enemy.x+100, Enemy.y), and then pin.

  • Do you have this image point in all frames in all animations?

    Actually, it only needs to be in the default frame/animation, but to be sure add it to all.

    You can also simply position the CD object to (Enemy.x+100, Enemy.y), and then pin.

    Thanks a lot! Your method is working flawlessly.

    Also this might be OOT and I probably should make another thread for it (?), but for the sake of practicality I am going to ask here first.

    I am in the process of adding another feature to the game, called "Waterproof Mode". It is essentially Mario's Star which we know gives invulnerability to the player for a short amount of time.

    To activate the mode, the player will need to collect Experience Points that will be converted to Waterproof Points (which fills up the bar and changing the animation frame. 3 WP = 1st strip, 6 WP = 2nd strip). Gaining 10 points, and then clicking Ctrl will give the player invulnerability and a speed boost for 7 seconds. After which the WP will be resetted to 0.

    So far the only problem that have risen is this : the animation of the WP Bar, or Waterproof Points Bar, keeps playing even though I have made events that should've disabled the animation. As you can see on the screenshot, even though I have 0 Experience Points the WP Bar has already reached its usable stage. (only sprite form though, since technically there is no WP gathered yet).

    Additional screenshots have been uploaded inside the drive.

  • One clear mistake is event 91. It's executed on every tick, 60 times per second, creating hundreds of wait-threads. You should avoid using "wait" in events that are running on every tick.

    Also, are you sure that animation speed in this WP bar is set to 0?

    If all this doesn't help, try running the game in debug mode, pause it and check all variables etc.

  • One clear mistake is event 91. It's executed on every tick, 60 times per second, creating hundreds of wait-threads. You should avoid using "wait" in events that are running on every tick.

    Also, are you sure that animation speed in this WP bar is set to 0?

    If all this doesn't help, try running the game in debug mode, pause it and check all variables etc.

    Actually event 91 works fine, but yeah the animation speed for the WP Bar was set to 1 which makes sense that it causes the animation to keep playing early, thanks!

    I'm thinking of adding a boss fight next. It's gonna be a real pain in the arse to code, I'm gonna look forward to your masterful insights :))

  • I suggest fixing event 91 too. Mistakes like this can cause bugs that are really hard to find. So you have this event:

    If WP_mode=1 : Wait 7 seconds, Set WP_mode to 0

    What will happen - it will reset WP_mode to 0 after 7 seconds. And then all the delayed "waits" will continue resetting it for another 7 seconds. Even if on second 10 you set WP_mode to 1, it will immediately become 0.

  • Good point. I think I have a lot of similar events like that one which I guess is a ticking time bomb.. I still haven't found any issues regarding the activation and deactivation of WP mode but I really appreciate your input.

    So far the only issues are:

    1. The pauses have become really confusing now. Because the item "cutscene" needed everything to stay paused for the duration of the "cutscene", I think I have made some events clash against each other and I don't really know how to reverse the damage and also simultaneously have both pauses (the normal gameplay pause using shift, and the item cutscene pause) work as they should've been. As of now both pauses work, but it results in the game over screen pause not working (only the enemies get paused while the player does not).

    2. Regarding the WP Bar, animations and codes that are supposed to activate it do work. But after WP mode ends, the accumulated WP needs to be resetted to 0

    and I have tried doing that, using the substract event when WP mode begins. Unfortunately the animation gets stuck on "ready to use" mode again but I am not sure about the WP value.

    The capx is inside the drive. If you are willing, please do kindly check it out as my brain is slowly dissolving because of this X_X

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To put the game on pause, set the time scale to 0, either global, or the time scale of all moving objects (player, enemies).

    Also, try not to use "Wait" in game mechanics for things like waterproof mode, because you have no control over it. Use Timer behavior instead, which you can pause/resume/cancel etc.

  • To put the game on pause, set the time scale to 0, either global, or the time scale of all moving objects (player, enemies).

    Also, try not to use "Wait" in game mechanics for things like waterproof mode, because you have no control over it. Use Timer behavior instead, which you can pause/resume/cancel etc.

    Ok, I have organized the pause events so that when it's necessary to trigger a pause, I just have to set PauseActive = 1. But there's another error regarding the death screen. When I tried to set PauseActive = 1 when death screen appears, I assume there was a repeating error that occurred. Any alternative for wait commands for the System object?

    Screenshot inside the drive. The commands for event 59 do not work as expected and give the same error.

  • Also I have posted the events for WP Mode inside the drive just now. I have absolutely no idea how timer works.

  • I don't understand the issue. When you use "Set time scale 0", everyhting is paused, including all Wait actions.

  • I don't understand the issue. When you use "Set time scale 0", everyhting is paused, including all Wait actions.

    Exactly, which is why I am very, very much baffled by this program.

    Pause events' screenshot is inside the drive.

  • Okay, after 2 hours of coding experimentation, everything kinda works as it should be now. Except for the WP bar, I still can't figure out why the animation gets stuck even after its supposed to be resetted after it has been used.

    Event positions (whether inside or outside a folder, above or below a certain event) definitely matters in C2 and that makes everything a 100x harder for a nitwit like me. I'll update you when it comes to the boss fight coding, thanks for everything!

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