Timed "spellcasting" bar

Get help using Construct 2

Post » Fri Jul 27, 2012 10:41 pm

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.Padraik2012-07-28 06:59:22
B
14
Posts: 20
Reputation: 945

Post » Sat Jul 28, 2012 1:14 am

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.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

Post » Sat Jul 28, 2012 6:58 am

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 =)Padraik2012-07-28 06:59:04
B
14
Posts: 20
Reputation: 945

Post » Sat Jul 28, 2012 1:50 pm

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)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jul 28, 2012 8:05 pm

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.
B
14
Posts: 20
Reputation: 945

Post » Sat Jul 28, 2012 8:07 pm

And then I see that your file is called cast bar. Can't wait to see what you've got, thanks!
B
14
Posts: 20
Reputation: 945

Post » Sun Jul 29, 2012 12:37 am

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.Nimtrix2012-07-29 00:41:23
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jul 29, 2012 1:40 am

Rexrainbow released a cooldown behavior which, I believe, could come in handy in your request.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Mon Jul 30, 2012 3:22 pm

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.
B
14
Posts: 20
Reputation: 945


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests