Hello Jester,
I apologize for taking Soooo long to reply.
Thank you very much for the information you provided!
When I was asking you "how you handle alpha" I meant alpha values.
Like when having a few movieclips on top of another, with _alpha = 40 or any
value<100.
Can you do that with BitmapData? (sorry if this is a very basic question, I
didn't have the chance to work with bitmaps a lot yet).
I think I'll see how performance goes and maybe I'll bother you and the list
again if I need to start digging more into your approach.
Thanks a lot.
Regards,
Dimitrios
----- Original Message -----
From: "JesterXL" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, February 16, 2006 5:11 PM
Subject: Re: [FlashCoders] scrollRect
BitmapSprites extend Bitmap. Bitmap is an internal class, and extends
DisplayObject. DisplayObjects' have a drawing index, just like MovieClips
do. So, instead of swapDepths, you'd use setChildIndex.
Now, for individual bitmaps that you are drawing, addToBitmapSprite, they
are added to the internal array, and drawn in that order. It would be
probably 10 minutes to add that method and call redraw to allow bitmaps to
change depth.
...or you could do it; I can give you Suversion access to the source if
you
wish.
Alpha is handled by your bitmap. Bitmaps support alpha channels, so
whatever bitmap you added should have the alpha. In my case, the moving
sprites example uses a circular PNG, and since PNG's have alpha channels,
Flash draws the circle correctly on top of other circles.
MovieClip's have gotten more powerful in Flash Player 8.5, yes, mainly
because of the DisplayList which seperates a MovieClip from existing from
actually being rendered/drawn each frame. It is not, however,
re-inventing
the wheel. We have not been able to blit in the Flash Player until
version
8; instead, we've had to duplicate a tile 100 times vs. drawing onto 1
bitmap.
Great example of why blitting is so powerful and scaleable:
http://www.gskinner.com/blog/archives/2005/08/flash_8_thought.html
Significantly less process, less RAM, and scales to infinite bitmaps.
I have no benchmarks nor numbers other than creating 100 MovieClips in
Flash
8 used 99%CPU, and 60 megs of RAM, and the framerate sucked. Changing
those
100 MovieClips to be 1 bitmap, and scrolled via a copyPixels from a
double-buffering used 6% CPU and full framerate. That's what made me
write
Diesel.
When you start adding BitmapSprites, you are adding overhead however
because
they themselves are DisplayObjects, like MovieClips, only they are drawn
into 1 bitmap vs. 30 of them drawn in 30 places in the DisplayList.
The hybrid approach is to use 1 Bitmap, load all of your tiles and draw to
just 1. You're actual monsters and characters that move, make Sprites (or
MovieClips), and remove them from the DisplayList if they are not
on-screen.
Use scrollRect for the area you are scrolling, and use double-buffering
(copyPixels from a rectangle from an off-screen bitmap).
This doesn't scale well because Sprites have more overhead, and moving
them
is sometimes more expensive then copyPixels, but it works well enough in
the
alpha, so I'm sure beta, and release it'll still be smokin'.
----- Original Message -----
From: "Dimitrios Bendilas" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, February 16, 2006 6:36 AM
Subject: Re: [FlashCoders] scrollRect
Hi Jester,
Thanks for the url. It seems very interesting.
There is one thing that bothers me, aside the fact that
I'would have to re-write a lot of stuff from scratch, if I
used a model like this.
How do you know in what depth to draw everything?
How do you handle _alphas?
The movieclip model provides a very easy way to stack
images one above another with no problems. It just seems
a lot of work, it's like re-inveting the wheel.
How much can performance benefit from an approach
like this? Any benchmarks, numbers?
Is there a hybrid approach maybe? One that requires
less code but increases performance?
Thanks!
Dimitrios
----- Original Message -----
From: "JesterXL" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, February 15, 2006 3:53 AM
Subject: Re: [FlashCoders] scrollRect
I oringally wrote this in Flash 8, and ported to Flash 8.5. There is no
reason it couldn't go back.
http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html
----- Original Message -----
From: "Dimitrios Bendilas" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, February 14, 2006 4:55 PM
Subject: [FlashCoders] scrollRect
Hi all,
I'm trying to make a very basic prototype to test parallax movement with
Flash 8.
Is movieclip.scrollRect what I should be using? I tried this:
var bg:MovieClip = _root.attachMovie("bg", "bg", 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
bg.scrollRect = {x:0, y:y--, width:635, height:540};
}
The movieclip "bg" contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?
I'm a bit lost! I've been searching for code samples online for the past
2
hours and
I haven't found anything useful.
Does anyone have a useful link for parallax or tile-based games using
Flash
8 features?
Performance is the key issue here, since this is going for a very big and
complex game
and I want to optimize it as much as possible.
Thanks a lot!
Dimitrios
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com