How do I end functions?

0 favourites
  • 12 posts
From the Asset Store
Safaryx
$5 USD
The game ends when the player loses all their lives
  • I use functions for my attack however I want to be able to end my functions mid function (so when the boss takes damage I want it to stop all attacks) is there a way to end all functions?

  • You should post your project, it would be easier to answer your question.

  • alright

    I want the boss to stop doing any functions when it is hit by a rocket

    ...

    How do i share my game file lmao

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • By saving and sharing your project file as a single file.

  • alright

    I want the boss to stop doing any functions when it is hit by a rocket

    ...

    How do i share my game file lmao

    Easiest way is probably getting a drop box account, save your project to your computer, transfer to drop box, enable sharing of that file in drop box, create a download link with drop box and post the link here.

  • I already use dropbox so I'll be sure to try that.

  • dropbox.com/s/cx9grhkr71c2nvm/Bullet%20Hell._autosave_.c3p

    Like this?

    Anyway I want the boss to stop doing it's attacks when it is hit by the bullet. I'm rather new to construct sorry

  • I suppose you could add a simple boolean to the boss. You would call it "PainState" and allow the boss to run its attack function only if its not in pain state, otherwise use system action "stop loop".

  • would this allow it to stop doing the attack mid attack?

  • Yes if you set up the events the right way.

    You should make the boss attack "if boolean 'pain state' is not true".

    You can put a timer to the pain state boolean so it gets reset to not true always after a while.

    If you use functions you should remember that the whole function is run immediately when called. The boss can not go in pain state mid function, the boss either is or is not in pain state the moment the function is called. You should set you events in a way that the attack functions are not executed if the boss is in pain state. Since the functions are run immediately when called it makes no sense to try to stop the function if the boss is in pain state, it's way more practical to check if the boss is in pain state before the attack function is executed.

  • Yes. The issue is I use wait actioms in the special attacks. Should I instead break the special attack into multiple functions when I need to use a wait?

  • Try not to use wait like this as you can't really cancel the wait once it is running.

    The best way is to either use a boolean with a "state" to check if an actions is currently executing.

    Or another way is to use the Timer behavior. Use the timer as the "wait". Then on timer "tag" execute the actions. Also this way you could stop a particular time with the "tag".

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