Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: pipeline

  1. #1

    pipeline

    http://www.flash-game.net/game/2267/balloon-parky.html
    i am trying to develop this type of game so i dont want

    to write hitTest on every clips , is ther any other logic which can help to connect the pipes and change their color when they are connected with each other , pipes can be randomly placed within tiles..any help

  2. #2
    i'd say use an array

    for eg;
    Code:
    var pipes:Array = [
    [0, 0, 0, 1, 0, 0, 1, 0, 1],
    [0, 0, 0, 1, 1, 1, 1, 0, 1],
    [0, 0, 0, 0, 0, 1, 0, 0, 1],
    [1, 1, 1, 1, 1, 1, 1, 1, 1],
    [0, 0, 0, 0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 0, 0, 0, 0, 1]
    ];
    Where the value 1 will represent a block of pipe; then check if there's a value of 1 before or after, or in the corresponding items in the previous or following arrays.

  3. #3
    207
    posts
    Registered User
    Hittest? I wouldn't have even thought of using hittest for this, so I really don't grok how you're approaching this.

    I would have a square array of pipes, but not just numbers like nathan did. I would make a pipe class, with a rotate method, and four methods that return values for top, bottom, right, left. And also a change colour method, which is passed a direction and a colour value. If it is open in that direction and it is not already that colour, it changes colour and calls the change colour method on all tiles it is connected to.

  4. #4
    O I didn't look at the link - so it's different to what I originally thought - If I get time I'll make a demo

  5. #5
    Quote Originally Posted by rrh View Post
    Hittest? I wouldn't have even thought of using hittest for this, so I really don't grok how you're approaching this.

    I would have a square array of pipes, but not just numbers like nathan did. I would make a pipe class, with a rotate method, and four methods that return values for top, bottom, right, left. And also a change colour method, which is passed a direction and a colour value. If it is open in that direction and it is not already that colour, it changes colour and calls the change colour method on all tiles it is connected to.
    can you show me the demo .....

  6. #6
    Quote Originally Posted by nathan99 View Post
    i'd say use an array

    for eg;
    ActionScript Code:
    var pipes:Array = [
    [0, 0, 0, 1, 0, 0, 1, 0, 1],
    [0, 0, 0, 1, 1, 1, 1, 0, 1],
    [0, 0, 0, 0, 0, 1, 0, 0, 1],
    [1, 1, 1, 1, 1, 1, 1, 1, 1],
    [0, 0, 0, 0, 0, 0, 0, 0, 1],
    [0, 0, 0, 0, 0, 0, 0, 0, 1]
    ];





    Where the value 1 will represent a block of pipe; then check if there's a value of 1 before or after, or in the corresponding items in the previous or following arrays.
    but i want to rotate the pipe when user click on that, 1 shows the existence of pipe now how to rotate with diff shapes.....

  7. #7
    Quote Originally Posted by rahul_7star View Post
    but i want to rotate the pipe when user click on that, 1 shows the existence of pipe now how to rotate with diff shapes.....
    here is my fla
    Attached Files Attached Files

  8. #8
    Quote Originally Posted by rahul_7star View Post
    here is my fla

    i got the solutions .

  9. Quote Originally Posted by rahul_7star View Post
    i got the solutions .
    That's a pretty cool monologue you have there.

    I think you should post the "solutions" you have for people that might find this topic in a search, looking for the same problem.

  10. #10
    rahul_7star is there any chance you could post your file in flash 8

    thanks

    neil

  11. #11
    Quote Originally Posted by rahul_7star View Post
    but i want to rotate the pipe when user click on that, 1 shows the existence of pipe now how to rotate with diff shapes.....
    That's if you are only talking about binary array... You can use rest of whatever is flash's integer values.

    Considering the pipes rotate in one direction, this is very easy.

    You can say,

    0 = empty space
    1 = horizontal pipe
    10 = elbow pipe
    20 = cross pipe

    then,

    2 = horizontal pipe in vertical position
    11 = elbow pipe from top to left
    12 = elbow pipe from left to down
    13 = elbow pipe from down to right
    14 = elbow pipe from right to top

    and you can even make use of other numbers...

    111 = elbow pipe from top to left in blue color
    211 = elbow pipe from top to left in yellow colour.

    ... so in the end, it's all how you set the convention.

    When you are checking if a path exist, you just have to check if one of the gas outlet is linked with, say, any pipe line with values greater than 100 or 200...etc.

    So to use the array example above, following will be a winning combo
    Code:
    pipes:Array = [
    [101,    0,     0,     1,    0,    0,     1,     0, 201],
    [    0,    0,     0,     1,    1,    1,     1,     0, 201],
    [    0,    0, 113, 101, 101, 101, 101, 101, 201],
    [101, 101, 111,    1,     1,    1,     1,     1, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201]
    ];
    Last edited by misterooga; May 28th, 2008 at 05:12 PM.

  12. #12
    Quote Originally Posted by misterooga View Post
    That's if you are only talking about binary array... You can use rest of whatever is flash's integer values.

    Considering the pipes rotate in one direction, this is very easy.

    You can say,

    0 = empty space
    1 = horizontal pipe
    10 = elbow pipe
    20 = cross pipe

    then,

    2 = horizontal pipe in vertical position
    11 = elbow pipe from top to left
    12 = elbow pipe from left to down
    13 = elbow pipe from down to right
    14 = elbow pipe from right to top

    and you can even make use of other numbers...

    111 = elbow pipe from top to left in blue color
    211 = elbow pipe from top to left in yellow colour.

    ... so in the end, it's all how you set the convention.

    When you are checking if a path exist, you just have to check if one of the gas outlet is linked with, say, any pipe line with values greater than 100 or 200...etc.

    So to use the array example above, following will be a winning combo
    Code:
    pipes:Array = [
    [101,    0,     0,     1,    0,    0,     1,     0, 201],
    [    0,    0,     0,     1,    1,    1,     1,     0, 201],
    [    0,    0, 113, 101, 101, 101, 101, 101, 201],
    [101, 101, 111,    1,     1,    1,     1,     1, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201]
    ];

    Thanks for this reply , but its ok that you can place pipe of any size either "L" shape or "U"shape , but the problem is that whenevr you click on 'U" shape U should move and should not call "L" shape, here is my fla ..chk it.


    whenver you click on "I" shape "I" should move in corresponding direction and it should not call U shape ..
    Attached Files Attached Files
    Last edited by rahul_7star; May 29th, 2008 at 06:44 AM.

  13. #13
    a
    Last edited by rahul_7star; May 29th, 2008 at 06:44 AM.

  14. #14
    Quote Originally Posted by neilmmm View Post
    rahul_7star is there any chance you could post your file in flash 8

    thanks

    neil
    HI here is flash 8 fla
    Attached Files Attached Files

  15. #15
    Quote Originally Posted by misterooga View Post
    That's if you are only talking about binary array... You can use rest of whatever is flash's integer values.

    Considering the pipes rotate in one direction, this is very easy.

    You can say,

    0 = empty space
    1 = horizontal pipe
    10 = elbow pipe
    20 = cross pipe

    then,

    2 = horizontal pipe in vertical position
    11 = elbow pipe from top to left
    12 = elbow pipe from left to down
    13 = elbow pipe from down to right
    14 = elbow pipe from right to top

    and you can even make use of other numbers...

    111 = elbow pipe from top to left in blue color
    211 = elbow pipe from top to left in yellow colour.

    ... so in the end, it's all how you set the convention.

    When you are checking if a path exist, you just have to check if one of the gas outlet is linked with, say, any pipe line with values greater than 100 or 200...etc.

    So to use the array example above, following will be a winning combo
    Code:
    pipes:Array = [
    [101,    0,     0,     1,    0,    0,     1,     0, 201],
    [    0,    0,     0,     1,    1,    1,     1,     0, 201],
    [    0,    0, 113, 101, 101, 101, 101, 101, 201],
    [101, 101, 111,    1,     1,    1,     1,     1, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201],
    [    0,    0,     0,    0,     0,    0,     0,     0, 201]
    ];

    2 = horizontal pipe in vertical position
    11 = elbow pipe from top to left
    12 = elbow pipe from left to down
    13 = elbow pipe from down to right
    14 = elbow pipe from right to top




    these are just frame number i thnk........is it..!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012