Timed "spellcasting" bar

0 favourites
  • 9 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello all!

    I just started messing with Construct 2 this week because I've got a project I can't stop thinking about.

    Things have been going well, but I've hit my first real snag and I'm hoping it's something easy to do.

    In my game, the player can click to cast a spell, when he does, I need to make a cast-time progress bar appear, and animate it to be timed with how long it takes the player to cast his spell.

    If you've ever played a game like world of warcraft, you know exactly what I'm talking about.

    I'm afraid I'm woefully ignorant when it comes to animation, so any help that you can offer would be greatly appreciated.

  • Ooh, tricky. Could be a fun one to try to pull together. I would start off by converting the bar width into a percentage local variable, and then have an every tick event setting the width to that event.

  • Thanks, AnD4D

    I thought about that, but I didn't and don't know how I'm supposed to go about making the animation time match the cast time. One spell make take 1 second, another may take 2.3 seconds.

    It's a fun challenge thus far, but I'm stumped =)

  • Games like WoW has a looping animation that runs until you cast the spell, so it's just a matter of using a boolean to say if the player is casting or not:

    SpellCastBar.capx (r99)

  • Thanks Nimtrix,

    I'm currently traveling and will have to look at that file tonight but it sounds like you're talking about the casting animation that the character plays while casting. I'm trying to get basically a progress bar that fills up smoothly over the course of n seconds.

  • And then I see that your file is called cast bar. Can't wait to see what you've got, thanks!

  • Yeah, I didn't bother explaining everything in the post, the example covers the rest. I thought you asked about the animation of the player as well as how to do the bar, but you obviously ment the animation of the bar. Sorry for the confusion.

    I don't use an animation for that though, just setting the width of a sprite similar to what AnD4D suggested. That's what they do in WoW as well, as far as I can tell. Just make sure your sprite is symmetrical over the Y axis, so you can stretch it's width without messing up the look.

    If you're not familiar with the expressions I used ('max', 'int' and 'dt'), you should have a look in the manual. Also, feel free to ask if you have any questions about the example.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Rexrainbow released a cooldown behavior which, I believe, could come in handy in your request.

  • Nimtrix, I got this working very well thanks to your help =)

    Now it's on to the cooldown behavior that Kyatric so kindly pointed me to, which, I have to admit, on first glance I don't understand at all.

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