dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: synchronisation with animated tiles

  1. #1
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601

    synchronisation with animated tiles

    i was just wondering, because i'm trying to port my shinobi-like into tile based method, what is the best way to synchronise animated tiles?

    because if i'm using the attach/remove or gotoAndPlay method to create tiles during the scrolling, of course it will not working, new tiles will begin naturally their animation at frame 1.

    There's a possibility of using a _visible method, why not, but in that case there will be way too much tiles that are animated (using a gotoAndStop("loop") at the same time).
    i also have the possibility to create custom tiles (254x32 for example to limit the simultaneous gotoAndPlay factor), but tiles will show properly only when you scroll from right to left... it's logical

    here's the example:
    http://www.marmotte.levillage.org/_e..._progress.html
    it's a mix between tile based and art based for the moment, look at the animated water (to the right) and tell me, if you know what i mean, what's the best way to translate it into synchronised tiles.

    thanks!

  2. #2
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802
    Everyone, PRESS CTRL! LOL

    Look at the shadow fading and coming back! w00t! Marmotte, your a G!

  3. #3
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    wow ^^

    naruraly it has to become smaller too... but since it's a pixel art method, i have to animate it frame after frame...

  4. #4
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802
    marmotte,

    i've been playing your demo for soo long, trying to feind any bugs!

    FOUND ONE (not that it's a big thing, but i've been checking it for soo long!)

    If you press, Left, Right and CTRL at the same time repeatedly, when you are in the middle of the map, the character kind of reappears on the far left...

    If you don't know what i mean, ill do screen shots and keyboard presses............

    lol, im a bug sniffer! (no, NOT BUTT...sick people)

  5. #5
    foul-mouthed chucklehead
    Join Date
    Feb 2003
    Location
    inches away from you, in the 4th dimension....
    Posts
    198
    not that i know much about animated tiles and such (which maybe gives me the best vantage point...that of the ignorant gamer!) but the water tiles look fine to me...I'm not sure what your suggesting the problem is.

    the_xell:

    As far as that bug...LOL, of course if you smash all the gameplay buttons repeatedly something buggy will happen!! duh! LOL...but i did see your "bug" the player like vanishes and reappears a few pixels to the left.

  6. #6
    Senior Member Kirill M.'s Avatar
    Join Date
    May 2002
    Location
    Toronto, Canada
    Posts
    712
    About synchronizing tiles. When building a new column of tiles if you can access the tiles of the column right before it you could check their _currentframe and have the tiles in your new column start there or 1 frame behind or ahead depending on how you want to synchronize them.

  7. #7
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    The_Xell
    wow, i didn't that my small demo impressed you that much! ^^
    in fact i had that problem a lot of times, sometimes only by walking left then right.
    i think i did a little mistake with the _x pos of the character, but it will be fixed once the engine will be more advanced... thanks for "playing" it so far. i guess i'll have to continue that project a little bit, huh? creating sprites takes so much time...

    chuckles
    ah, the problem is not in that file; i tried to adapt the posted example into tiles, which gave me that synchro problem

    Kirill M.
    i was thinking about something like that, hoping all that actions each time will not slow down too much the smoothness of the game... and also the fact to track the _currentframe of a tile "xy" near left or right (depending of the scrolling direction) is not that easy to code...
    of course, i can do a background more art based (loaded like a tile method on load) and keep the tile-like hitTest...

    thanks for your help anyway, guys ^^

  8. #8
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,992
    Hey marmotte,

    Something you might try is to use a global variable. Have it synced up to 1, 2, 3 depending upon on the number of frames in your animated tile clip.

    When an animated tile is generated on load, have some extra code to sync the animated tiles up with the universal variable.

    I've never done it myself, but it sounds like it might work >_<

    Just a thought...

    -pXw

    Play - Live - Work - Enjoy

  9. #9
    Senior Member Kirill M.'s Avatar
    Join Date
    May 2002
    Location
    Toronto, Canada
    Posts
    712
    I probably worded my answer in a bad way. You wouldn't have to check every tile in an adjacent column when making the new column, just those tiles that are animated. You could give animated tiles a property like "anim" which would tell if it's animated or not and if it is and the tile you'll place right next to it is, you check it's _currentframe for synchronization. If you don't have a lot of animated tiles this probably won't slow down your engine too much.

    "and also the fact to track the _currentframe of a tile "xy" near left or right (depending of the scrolling direction) is not that easy to code..."

    The scrolling is only done in one direction at a time, you could make a function to do the scrolling which would take a direction as the argument and scroll in that direction. Then you'd always know which column of tiles to check for the animated tiles and their _currentframe. So as you're scrolling left and building a column say at j index 5 you know you have to check the tiles at j index 4. Then as you move down the column at j index 5 you do an additional check of the tile at the same i index but at j index 4 for the anim attribute and then _currentframe if both of the tiles (at j index 5 and j index 4)are animated.

    To make the tast of referencing the tile at xy easier on yourself you could make an object for a tile would store all the info about it and then store that object in your map array.

    Say there is this object called tile and it contains members bool anim and MovieClip tileMC, and you have these objects stored in your map array.

    PHP Code:
    //This would be used when scrolling left
    //The code for scrolling right could be easily obtained from this.
    for(var i=0;i<columnSize;i++)
    {
     if(
    map[i][leftJ].anim && map[i][leftJ+1].anim)
     {
      
    map[i][leftJ].tileMC.gotoAndPlay(map[i][leftJ+1].tileMC._currentframe);
     }

    This just takes care of the part where it would do animated tile synchronization you'd have to do all the other stuff where you attach the new tile and assign it to map[i][leftJ].tileMC and so on. LeftJ in this case is the j index of the next left column; you'd also have to keep rightJ, j index of the next right column for scrolling right and update both of them appropriately after you scroll.

    Hope this helps.
    Last edited by Kirill M.; 02-27-2003 at 06:11 PM.

  10. #10
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    thanks for your time, guys...

    i'll see what i can do, your two examples are good.
    i'm still not too familiar with tile games; i understand how it works but not fully yet...
    maybe the WilloughbyJackson's idea will be faster though... with a gotoAndPlay(frameVar) at the begining of each animated tile, although the counter has to be claculated each frame. And with Kirill M. example, it's calculated only when you moved 32 pixels (this is the size of my tiles, 32x32)

    thanks again

  11. #11
    w00t PrED32's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    529
    The simplest way to fix this is using a _visible engine, but we all know there are better ways..

    So I would stick with the global variable.. all u have to do is increment it every frame and when you add a new tile do:

    temp = attach....

    temp.gotoAndStop(map[y][x])
    temp.gfx.gotoAndStop(globalcounter%temp.gfx._total frames + 1);

    and that should work. where the tiles clip has each tile with the animation named 'gfx'.

    Edit: The problem with Kiril's idea is if a column has NO animated tiles it wont work, and it wont work if the number of animated frames is different on differnet tiles.
    Last edited by PrED32; 02-27-2003 at 07:48 PM.

  12. #12
    Member
    Join Date
    Aug 2002
    Location
    Ottawa, Canada
    Posts
    83

    Love the pixel art

    Wow Marmotte that is some damn good pixel art. I was thinking about having a go art some pixel art, could fit it in with drawing iso tiles and anime. What program do you use, Paint Shop or Photoshop?

    Morb.
    - In the darkness lies your fears -
    Http://www.gawentertainment.com

  13. #13
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    Hey marmotte great game cant wait to see the finished version

    Found a lil prob with the jumping though. When u hold down jump and right and move across the level at a certian stage in the level his jumping stuffs up[ and he flips around. Just thought you should know.

    But other then that awsome graphics and great game Kepp up the awsome work.

  14. #14
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    thanks for all your ideas, guys

    Morbieus
    i use photoshop (i still never used paint shop)

    hooligan2001
    yes, it's a known bug, described several posts above ^^
    it's not necessarly a jump bug.

  15. #15
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802
    Any where you can fix this?
    Attached Images Attached Images

  16. #16
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    ^^ ^^ ^^
    haha! what a real fan you are!

    don't worry the_xell, the graphics you have here are in no way finished!
    i'll add stones, flowers, mountains etc etc...

    once i'll have the engine done, i'll do better graphics! tadaaa!

    (are you in love with that more than little demo?)

  17. #17
    booooosted! DJ-Anakin's Avatar
    Join Date
    Oct 2000
    Location
    ridgecrest, ca [pm me if in cali desert]
    Posts
    149
    hey marmotte. i have a problem for my game at: http://flashkit.com/board/showthread...hreadid=427685 see how when the map reaches the edge, the ufo doesnt have freeplay to go where he wants? i noticed in your game, when the character reaches the edge, he can still run, until he returns to the point you specified. how did you do that? or do you have a better way that maybe you could share with me? cause im stumped. thanks..

    -frank

    btw.. your game looks awesome.. ill be keeping track of this one for sure!

  18. #18
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802
    Originally posted by marmotte
    ^^ ^^ ^^
    haha! what a real fan you are!

    don't worry the_xell, the graphics you have here are in no way finished!
    i'll add stones, flowers, mountains etc etc...

    once i'll have the engine done, i'll do better graphics! tadaaa!

    (are you in love with that more than little demo?)
    LOL, i am marmotte!

    Seriosly, your previous games are so well put together, it's difficult to find any bugs or graphical errors (i'm not lookin for them but its the fact that its such a well put together game)

    And as for this demo, its amazing.... seriously, i'm dying here waiting for the final game!

    Happy Action Scripting!

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