How do I change animation frames under certian conditions?

0 favourites
  • 5 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • I'm working on my Dragon game and I was wondering if anyone knew how I could change animation frames only under certain conditions.

    Mainly, when a fireball hits a target it briefly turns into a flame before being destroyed and when the baby dragon takes damage he changes color 3 lives=Green, 2 lives=Yellow, 1 life= Red.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Let's assume your baby dragon is an animation composed of 3 different frames of 3 different colors (one for each number of lives). Set the speed of this animation to 0 (so frames don't go by and a single frame is displayed).

    In the condition "Fireball on collision with baby dragon" (however you made it in your project) make sure to remove one HP from your dragon (probably in its instance variable HP) and then add subevents checking out what is the current value of this variable.

    According to the value, set the appropriate frame.

    You're likely to have a more precise answer if you post/attach your current project to the post asking for help, since it's not easy to guess out what you've made so far.

  • Let's assume your baby dragon is an animation composed of 3 different frames of 3 different colors (one for each number of lives). Set the speed of this animation to 0 (so frames don't go by and a single frame is displayed).

    In the condition "Fireball on collision with baby dragon" (however you made it in your project) make sure to remove one HP from your dragon (probably in its instance variable HP) and then add subevents checking out what is the current value of this variable.

    According to the value, set the appropriate frame.

    You're likely to have a more precise answer if you post/attach your current project to the post asking for help, since it's not easy to guess out what you've made so far.

    Okay, I've included my file. It's kind of like an arcade game where you drag and drop the baby dragon to release fireballs at soldiers who are intruding in your cave but letting the prince and princess come to you as they will restore your ammo. And unfortunately I can't include the file to their post due to size so here's a dropbox link: https://www.dropbox.com/s/kn4ap8xz1sl2a ... Beta4.capx

  • So as I was saying, you first need to set the animation speed to 0 for all your images "MeanKinght", "ReflectKnight", "CrossbowKnight", "BabyDragon", "Princess" and "Prince" as well as "Arrow".

    Go into the image editor, click the "Default" name of each animation and modify the "Speed" property.

    Sounds like you already made the rest.

  • Okay it's working, and would I do something similar when I want the sprites to turn into flames (which is sprite 1) when the fireball collides with them?

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