Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Frame Animation Fun

Author
Message
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Apr 2009 16:01
Hi guys, I'm playing around with a frame based animation system i've made and I need some help with something. The problem is I want the target the animation affects, like the player to flash or glow. But I can't figure out how to do this with sprites. I had an idea of making a mask of the player and alter the diffuse of that which works but making a masks of everything would be a plain so is there another way?

I've attached a demo of my frame animation system at work and made 4 animations to play with plus added some sounds. Please tell me what you think

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Attachments

Login to view attachments
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 9th Apr 2009 01:59 Edited at: 7th May 2009 01:28
I'd try this:

Make the animation in two halves. One half would be the part of the animation that appears in front of the character, and this would be on a sprite with a higher priority than the character.

The other would be the part of the animation that should appear behind the character, and that would have a lower priority than the character.

Just line them up properly and it will appear as though the animation goes around the character.



Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 9th Apr 2009 13:20
The way I've done it previously is to factor in the Y position of the sprites as part of their priority. That way you can get objects lower on the Y axis to appear in front of objects that are higher up the screen.

Saves messing about chopping images in half. It also means that if that portal image posted above was at the players feet he could still walk 'behind' another character and the portal image would still have the correct depth. Otherwise you risk the bottom half of the portal image rendering in front of the character that the player is supposedly behind.

Your second animation looks like it should surround the player. For this one, I think you'll need to edit out the 'back' of the image to give it the impression that it goes around.
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 16th Apr 2009 21:35 Edited at: 16th Apr 2009 21:38
Ok, I don't think anyone got what I was talking about, so I'll show you.

BMacZero, Forgot to set the priorities, thanks for the reminder.

Bursar, what I'm after saves me having to do any of that, but one more thing, these are just place holders to test if my sprites where working correctly, same a the player is just a place holder. When I create my own images then I'll consider doing that, so thanks for the input.

By the way, don't know if you noticed but my animations are custom made within my engine, or through scripts. Basically I build each frame using parts of an image, these parts are called 'cells'. Each cell has it's own set of params, so I can rotate, magnify, position, opacity, mirror etc... and which frame it appears in, also there are a number of frame based effect each cell can have.

Anyway, heres what I was talking about, the flashing of the player, the way I did it was make a mask image for a sprite that goes over the player sprite, but I want to produce these masks in DBP instead of external created ones, or not have to produce but still get the effect. File attached is what I'm after.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Attachments

Login to view attachments
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 16th Apr 2009 23:44
Okay, so for the flashing of the player, you have a blank image shaped like the player? And then you use the sprite alpha commands to make it flash?

Sounds like a good place for memblocks. I'll see if I can cook up and example...



Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Apr 2009 23:50 Edited at: 16th Apr 2009 23:52
i just started looking into (image) memblocks but whipped this up:



i don't know why "if thiscolor < 0" works but it does ie, i don't know how to read an image's alpha value yet (which is what i was after) but fiddled with it and the masks were working correctly.

Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 17th Apr 2009 00:14
BMacZero, cheers for the assist.

Nomad, thanks for the code, that helped. By the way, this might help you workout the alpha part:



I edited this get image function to work on the current bitmap (that has a bitmap format of 21 btw), still has a few issue with overlapping images that contain alpha, but it might help you to work out the alpha part, i'll take a look later also, cheers again

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th Apr 2009 00:15 Edited at: 17th Apr 2009 00:16
Edit; Ninja'd!

This function will simply color the sprite without the need for any kind of mask...I think it's what you're after.



@Virtual Nomad

IanM's Matrix dlls have an RGBA function to get a dword's alpha byte, or you can read the fourth byte in the dword from a memblock (see my function).



Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 17th Apr 2009 01:01
BMacZero, Thank you very much, just what the doctor or ninja ordered

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Login to post a reply

Server time is: 2024-04-25 13:03:40
Your offset time is: 2024-04-25 13:03:40