A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: [Flash8]scrollrect Scroller

  1. #1
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666

    [Flash8]scrollrect Scroller

    Here is my example of scrolling tiles:
    http://img387.imageshack.us/my.php?image=tiles7zh.swf
    well, the imageshack scales the swf so you better download it and run it at 100% on your computer to see real speed

    Fla is attached.

    The way it works:
    *there is tileset image in the library (1 gif with all tiles on it)
    *random tiles are then chosen from there and drawn on myBmp bitmapData
    *myBmp is 640x640 px
    *tiles mc is created and 400x300 px scrollRect applied to it
    *bitmap is drawn into tiles.bmp mc
    *tiles.bmp mc is scrolled

    fps is set to 32 in Flash

    This uses same engine, but has 3 layers and dropshadow applied to 2 top layers:
    http://img396.imageshack.us/my.php?image=tiles17uo.swf
    /*originally posted by tonypa,moved to its own thread by tomsamson*/
    Last edited by tomsamson; 09-15-2005 at 07:04 AM.

  2. #2
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    very nice tony, running silky smooth and hey hey, that shadows give it a sweet depth feel =)
    would be cool if you post the code and explanation so we can develop a best of scroller here =)

  3. #3
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    The fla.
    Attached Files Attached Files

  4. #4
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    [tomsamson]reply by pentru:[/tomsamson]
    I know what you mean, but the reason I was gonna keep the single tiles/frame in MCs is so that they can still have/inherit prototype tile propreties that might be passed on from an XML map file or a 2d array......things like whether a tile is walkable or not, or whatever else other costum propreties a particular tile template might have......not sure yet if that data can be attached straight to a bmp tile itself.....that's why I thought it would be still worth keeping bmps in MCs.....

    just thinking out loud....maybe I'm wrong
    [tomsamson](i post it here as there´s no way to move single posts..[/tomsamson]

  5. #5
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    [tomsamson]reply by tonypa:[/tomsamson]
    I noticed the flickering in scroll too, but I havent found a way to avoid it yet. Looks like Flash cant draw whole bitmap in 1 go. If anyone knows good way, please tell
    [tomsamson](i post it here as there´s no way to move single posts..[/tomsamson]

  6. #6
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    [tomsamson]reply by pentru:[/tomsamson]
    Quote Originally Posted by tonypa
    It might be faster now to draw all tiles on screen once at the start, then apply scrollRect and never worry about changing/adding/removing tiles again.
    hmm...yeah I was thinking about that.....I want to keep your herarchy/organization as much as possible since I like the way you set it up....with the images/frames in single MCs define by prototype templates inside a main container....yet using some of the new methods to speed it up....

    so I was thinking when the building level routine runs, use the bmpAttach method to attach the bmp straight from the lib to the tile MC, set that tile MC to bmp cache true (each one of the tiles in game) and then use the scrollRect to scroll the entire level container MC w/ all the tiles in it.....all at once w/out tile moving.....
    and by doing that...still maintaining separate tile MCs there wouldn't be the limit in running in the size image limit for the bmpData...which I think they say it's 2880 pix.....

    anyway just some thoughts I'm throwing out there.....I still need to test it...please correct me if you see something wrong or a better/more efficient way of doing it :-)
    paul
    [tomsamson](i post it here as there´s no way to move single posts..[/tomsamson]

  7. #7
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    [tomsamson]reply by Dancing Octopus:[/tomsamson]
    Quote Originally Posted by tonypa
    It might be faster now to draw all tiles on screen once at the start, then apply scrollRect and never worry about changing/adding/removing tiles again.
    Indeed. Although it doesn't leave much room for interactive environments.

    Even before seeing the code for this, I'm formulating an idea to combine this technique with something similar to strilles obj scroller to create some sort of super engine ;D I've already combined the obj scroller with a tile engine to create pretty swifty engines with lots of interactive objects in a large screen size, I can only imagine this would speed it up considerably.

    I'm curious how it would work with alpha channels in the bitmaps so it would be possible to create a few levels of paralax using this.
    [tomsamson](i post it here as there´s no way to move single posts..[/tomsamson]

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    226
    Parallax, alpha, 256x256 tiles, no huge memory usage only related to screen size and tileset, scroll optimized...

    http://www.onemotion.com/flash8/f8_tiles.html
    Last edited by erixon; 09-15-2005 at 12:08 PM.

  9. #9
    Senior Member sand858's Avatar
    Join Date
    Aug 2001
    Posts
    327
    erixon.. That seems to be way faster than the last time I looked at that demo. Either I'm stupid, or it's crazy fast now. Great job, sir!
    gamedozer games
    Free multiplayer and singleplayer games

  10. #10
    Senior Member
    Join Date
    Aug 2004
    Location
    San Diego, California
    Posts
    421
    Quote Originally Posted by tomsamson
    [tomsamson]reply by Dancing Octopus:[/tomsamson]


    Indeed. Although it doesn't leave much room for interactive environments.

    Even before seeing the code for this, I'm formulating an idea to combine this technique with something similar to strilles obj scroller to create some sort of super engine ;D I've already combined the obj scroller with a tile engine to create pretty swifty engines with lots of interactive objects in a large screen size, I can only imagine this would speed it up considerably.

    I'm curious how it would work with alpha channels in the bitmaps so it would be possible to create a few levels of paralax using this.
    [tomsamson](i post it here as there´s no way to move single posts..[/tomsamson]
    Wow!! This Flash 8 is really getting popular around here. I wonder what new games we migh start seeing on the web? The possibilities are endless. I have all sorts of ideas for original games, but can't get to them all. Good luck on the Super Engine, tomsamson. Thanks to flash developers like yourself, we might just see huge games around here.

    I wonder how fast my engine would run on that thing. Is there anyway to convert the flash 7 swf to flash 8 without having to get the program.

    http://e.1asphost.com/andross88/MainGame.html

    The game runs smoothly, but when I have 3 layers, its starts to slow down. So there would probably be no way for me to add enemies without the cpu going above 100, darn!. I want to test this with bitMapConverter in Flash 8 and see how much cpu resources it uses. my thanks for any help you can give.

  11. #11
    Senior Member
    Join Date
    Jun 2001
    Posts
    290
    Quote Originally Posted by sand858
    erixon.. That seems to be way faster than the last time I looked at that demo. Either I'm stupid, or it's crazy fast now. Great job, sir!
    nope, you're right!!...it is MUCH faster then when I looked at it a while back!!....also far faster/less staggering......very nice, Erixon.

    can you tell us your method?..did you just use scrollRect?...also your engine doesn't seem to have flickering as some other ones seem to have.....was curious on how you got it so fast/smooth.....
    nice work..


    paul.

  12. #12
    Senior Member
    Join Date
    Apr 2002
    Posts
    226
    What can be tricky about test is that its best performance if CPU is at zero when starting, otherwise the FPS can decrease or CPU showing much more. So there is no big optimize since last time.

    Its no secrets there really. Its 3 bitmapdata layers of 640x480 and when scrolling top layer I first scroll the whole area in one go and then fill out with tiles only where its needed at the sides. Middle layer is just wrapped around with a 640x480-image.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center