A Flash Developer Resource Site

Page 1 of 4 1234 LastLast
Results 1 to 20 of 70

Thread: Deformable Terrain

  1. #1
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622

    Deformable Terrain

    Ok, I'm working on a game, and I am hoping to turn it into a multiplayer game through polling (I know PHP)

    This is the game...

    http://thewebtank.staticsanime.com/fortress.swf

    Well, I have an idea about how I would like to do it. Because making little particles make up the level would be way to processor intensive, I have decided to use a mask on the level... it is drawn through an API script and put into an mc called level. I would like to know if it is possible to put a mask over the level when a bullet shell hits and it let preceding bullets pass over that hole.
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  2. #2
    Junior Member
    Join Date
    May 2002
    Posts
    0
    i dont know how, but if you add deformable terrain this will be EXACTLY like gorrials for qbasic, which was the best game ever!

  3. #3
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    On bit 101s site, he has an example of deformable shapes with a mask, so I know its possible, but how do I go about this
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  4. #4
    Neoteric Lukstr's Avatar
    Join Date
    Apr 2002
    Location
    "The Cave"
    Posts
    695
    well, just attach a circle mc and make it mask the land mc. and if you're hitTesting the bomb against land, then this should work. I have no idea though.
    - Lukstr

  5. #5
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    Well... if you could possibly hook me up with code, that would rule... I'm a masking nub :|
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  6. #6

    another solution

    One solution (cant remember who now) came up with was to:

    Lets say you have a stage 400px wide. You create a land mc. Then inside that land mc you have 400 1px wide mcs. These are as tall as the land is (so itd be varied a bit from 1 to the other).

    But you test if the bullet hittests the land mc. you would know wich pillar mc it hit cause of the _x. Then you subtract a little _height from each one around where it hit.

    This was kind of a neat way to do this (i thought at leaste )

    Nugget

  7. #7
    Junior Member
    Join Date
    May 2002
    Posts
    0
    i bet i could make an example based on "xMCNUGGETx" idea,if its sucessful ill post it today

  8. #8
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    hmm... if that worked it would rule... but the thing is, api is simple as hell... but with ure idea it would own because u could have particle effects and stuff :O :O
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  9. #9
    Junior Member
    Join Date
    May 2002
    Posts
    0
    well i was expirementing with it (the partical thingy), and i dont think as good as a idea as i thought it would be, because i just to test it i was using 10x10 blocks, and there were about 750 - 1000 blocks each having a onClipEvent(enterFrame) AND an hitTest, which makes it horribly slow (it was probably running less than 1 fps!!), and the final result would probably use 1x1 blocks instead so the terrain looks smoother, making it run 100x slower!! i know a better way, but you would have to name each individual block like block1, block2... and there would be approx 100000 blocks which would take too long so thats out of the idea. beat way is probably use a tile based map, or line to stuff (which i tried for about 10 min then gave up, but its possible). other than that i have no idea

  10. #10
    all of the little terrain mcs should be inside 1 mc called land. you then just hittest land. you know which individual mc it hit based on the bullets _x property.

    Nugget

  11. #11
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    nugget, im gonna try this...
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  12. #12
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    jtnw, i think that would be rather processor intensive. heres how i would go about it. you decide how you are going to divide your stage up, the more points you have across the width of the stage, the more processor intensive it will be, but less good looking and working less well. you then have a 'height map' which is a normal array with the relief of the land represented by _y coordinates in the array. to draw the land you use the draw API which in essence just joins up the dots in the height map. then you introduce projectiles, when these hitTest the land, (hittest is fine as there is only one projectile going at a time) you use some simple math to find the point in the height map it is closest too and then you reduce the height at that point by eg 5, you then can (to make it look better) also reduce the points around the collision point by less amounts, to get a more crater like effect. then you draw the level again, which will adopt the new destructed terrain as it is drawing from the altered height map. maybe in a minute i will make with some code
    hth
    [m]

  13. #13
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    wow, thanks johnjohnbongo, whereever you lurk! for sending me a cool bit101 fla that does pretty much the same thing! not quite the same as what im doing but a great help! ill have something to show soon people
    [m]

  14. #14
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    arg mbenney send it to me i needed that .fla!
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  15. #15
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    Leave it with me 20 mins and I'll try to have something for you!!!

    RipX

  16. #16
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    RipX, if you could figure this out, you would be a goddess.
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  17. #17
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    that fla is useless for your application, you cant define a heightmap, im almost done, bare with me!

  18. #18
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    wait, mbeneey, r u making one that would work with my game?
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  19. #19
    j00 r teh pwnz0r3d DarkMagicHacker's Avatar
    Join Date
    Feb 2001
    Location
    Your mom's room.
    Posts
    622
    I'm almost done with one that is kindof like nuggets idea
    You pwn. I pwn. We all pwn for ice pwn.

    Chop Suey! The Greatarst Gaem EVAR!!!!!!!!

  20. #20
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    Originally posted by DarkMagicHacker
    wait, mbeneey, r u making one that would work with my game?
    yeah baby, anyone know if gradient fill is possible with API?

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