Making a circular radar

For questions about using Classic.

Post » Sat Oct 04, 2008 10:31 pm

[quote="work3":38pftsnf]i'm trying to make a circular energy bar right now in a similar vein and need to erase the bar in a circular manner, it overlays on top of the game on the HUD, I was wondering if any of these functions mentioned would be applicable?[/quote:38pftsnf]


You could make a half-circle with the erase effect, then place it's hotspot in the center of the flat side, like so:



Then when health is depleted, rotate the half-circle.

To make a full circle, create the second half of the health bar and the second half of the eraser on a separate layer.

I can't think of any efficient way to keep the circle in one piece and still use the erase method. But you could do it without the erase method by animating a bunch of separate sprite frames for the circle itself, even though that might be a bit tedious. Though in the long run it might actually be the best way. You could have the same number of frames as you do units of health, so it would just be a matter of setting the animation to frame (value.health) or whatever. Longer to set up, but way easier to code for.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Oct 05, 2008 12:36 am

The Mask and Erase effects are definitely the way to go for this. You don't need the canvas object - it would actually be slower. Mask and Erase are very simple effects and don't require pixel shaders - they should still be very efficient. All you need to do is draw a circle on a sprite and give it one of the effects (one erases the transparent areas, one erases the solid areas). It even works with alpha blended sprites to erase smooth edges!

A drop of 50fps is not always bad news - the difference between 1050fps and 1000fps is pretty much negligable, whereas 100fps to 50fps is significant. In other words, a difference of a fixed number of FPS is a fairly meaningless statement. 1 divided by the framerate is the time in seconds it takes to render each frame - you can use this to work out exactly how much extra time it takes to process an effect, per frame.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sun Oct 05, 2008 7:04 am

thanks deadeye, you are truly the man...

I often wonder what the best approach is witb some of these things, I think just building a depleting animation works best in this case.
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Sun Oct 05, 2008 10:12 am

When i have a problem, i'm like, 'what would deadeye do?'
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sun Oct 05, 2008 10:30 am

Ahg, stop it you guys :oops:. I'm not really all that good. I'm wrong half the time (at least), and I suck at math. This forum is full of way more impressive people, I'm just some dude who posts a lot because I have no social life :oops:.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Oct 05, 2008 10:50 am

[quote="deadeye":318y3m6q]Ahg, stop it you guys :oops:. I'm not really all that good. I'm wrong half the time (at least), and I suck at math. This forum is full of way more impressive people, I'm just some dude who posts a lot because I have no social life :oops:.[/quote:318y3m6q]

No man, you're awesome.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Sun Oct 05, 2008 10:53 am

No... you're awesome :D
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Oct 05, 2008 11:16 am

NO U!

seriously, you're one of the guys that always helps out, and i'm very grateful for it.
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Sun Oct 05, 2008 11:37 am

[quote="Ashley":1i3ds5e6]The Mask and Erase effects are definitely the way to go for this. You don't need the canvas object - it would actually be slower. Mask and Erase are very simple effects and don't require pixel shaders - they should still be very efficient. All you need to do is draw a circle on a sprite and give it one of the effects (one erases the transparent areas, one erases the solid areas). It even works with alpha blended sprites to erase smooth edges!

A drop of 50fps is not always bad news - the difference between 1050fps and 1000fps is pretty much negligable, whereas 100fps to 50fps is significant. In other words, a difference of a fixed number of FPS is a fairly meaningless statement. 1 divided by the framerate is the time in seconds it takes to render each frame - you can use this to work out exactly how much extra time it takes to process an effect, per frame.[/quote:1i3ds5e6]


It was a change of 150FPS to 100... So its quite alot, but I'll roll with it and see how it goes! Thanks Ash thats exactly the reply i was looking for.

finally, before i start making it. Do i need to make a seperate layer? I probably do right? Because the mask needs to be quite large to make sure objects don't appear again when they are no longer covered by the mask? And if this was on the same layer as other stuff wouldn't it mess the other objects up?
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Sun Oct 05, 2008 1:54 pm

Don't be so hard on yourself lol
You've helped heaps of people out on thier games, that my friend, makes you the man
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests