transparent sprite with background ?

1 view
Skip to first unread message

Albrecht ANDRZEJEWSKI

unread,
Oct 12, 2009, 5:58:00 PM10/12/09
to pulp...@googlegroups.com
Hello everybody,

I'm trying to setup an animation with Pulpcore using an image properties file, as in the Image sample code. I found this feature absolutely magical!

But i have a question someone could find easy to answer :
Each frame of my animation PNG file is actually made of :
- a 100% opaque content, showing each "instant move" of my sprite character
- a 100% transparent zone, around the sprite character, so that it fits into a square shape.

My character should be animated on a background, so that it lets the impression the character is walking.
The problem i'm facing is : with no blend mode, each keyframe of the animation is actually laid on top of previous key frame.

I'm rather new to blend mode, and i didn't see any blend mode allowing that would allow to "redraw" the background where my frame is transparent between each keyframe.

I could rewrite a sprite class to move the png file by myself, but i'm sure there is a smart way to do this with PCore.

If someone could point me some help i would just greatly appreciate :)

Regards.

David Brackeen

unread,
Oct 12, 2009, 6:07:17 PM10/12/09
to pulp...@googlegroups.com
In the Images example, each frame of the player also consists or either opaque or transparent pixels. Did you add a background sprite to your scene? 

Maybe you could post your example online and someone could help.

Albrecht ANDRZEJEWSKI

unread,
Oct 19, 2009, 4:49:05 PM10/19/09
to pulp...@googlegroups.com
On Tue, Oct 13, 2009 at 12:07 AM, David Brackeen <brac...@gmail.com> wrote:
In the Images example, each frame of the player also consists or either opaque or transparent pixels. Did you add a background sprite to your scene? 

Maybe you could post your example online and someone could help.

You were right : no need to chose a blend mode. I was so focused on the ant magical sprite stuff that i forgot to add an opaque background to the sprite scene :) so that every frame repaint was done over the previous scene!

For future readers, here is the simplified relevant code. The first line was missing before i get it to work.

 public void load() {
        add(new ImageSprite("background.png", 0, 0));
        shipSprite = new ImageSprite("12frames.png", 0, 0);
        add(shipSprite);
    } 

Thanks David for this very great 2D lib and your support!

Reply all
Reply to author
Forward
0 new messages