Professional Web Applications Themes

Using 2 Joysticks - Macromedia Director 3D

Hi all, I've got the joystick xtra all working fine, I know that it supports 2 joysticks, but question is.. how to use 2 at once. I want the one joystick to detect the up and down movements, and the other for left and right. I've tried the following: joystick = xtra("joystick").new() joystick.useJoy(1) -- use the first joystick for the demo joystick2 = xtra("joystick").new() joystick2.useJoy(2) -- use the first joystick for the demo But it seems to still use joystick2's movements even when I only ask for joystick (joystick 1). Anyone had any luck using 2? And any tips? Cheers!...

  1. #1

    Default Using 2 Joysticks

    Hi all,
    I've got the joystick xtra all working fine, I know that it supports 2
    joysticks, but question is.. how to use 2 at once. I want the one joystick to
    detect the up and down movements, and the other for left and right. I've tried
    the following:

    joystick = xtra("joystick").new()
    joystick.useJoy(1) -- use the first joystick for the demo

    joystick2 = xtra("joystick").new()
    joystick2.useJoy(2) -- use the first joystick for the demo

    But it seems to still use joystick2's movements even when I only ask for
    joystick (joystick 1). Anyone had any luck using 2? And any tips?
    Cheers!

    AndrewNock Guest

  2. #2

    Default Re: Using 2 Joysticks

    From memory, shouldn't you create just one instance of the Xtra, then use
    joystick.useJoy() to choose which joystick you are currently reading from ?

    Cheers

    Richard Smith


    Richard Guest

  3. #3

    Default Re: Using 2 Joysticks

    HI,
    Realised I was creating another instance of the Xtra...

    but, how do I use the Xtra, then have 2 instances of joystick?
    I've tried using

    joystick1 = xtra("joystick").new()

    joystick1.useJoy(1)
    joystick2.useJoy(2)

    But throws up an error saying 'object expected' on joystick2.useJoy(2)

    AndrewNock Guest

  4. #4

    Default Re: Using 2 Joysticks

    Still from memory, but I think you just...

    movie script....
    -----------------------
    global g_joystick

    on startMovie
    g_joystick = xtra("joystick").new()
    end startMovie
    ------------------------

    on a behavior...
    -------------------------
    global g_joystick

    on exitFrame
    g_joystick.useJoy(1)
    --read your first joystick values here
    g_joystick.useJoy(2)
    --read your second joystick values here

    end exitFrame
    --------------------------

    I think that's right...

    Cheers

    Richard Smith


    Richard Guest

  5. #5

    Default Re: Using 2 Joysticks

    Superb! Thanks for that.

    Tried loads of variations of that, but somehow didn't see that one.. Hey, its monday after all ;0)


    AndrewNock Guest

  6. #6

    Default Re: Using 2 Joysticks

    Hi, that?s great you getting on right!!! I just recommends the Enhancer Xtra, is awesome for game development, easy to use, stable, excellent performance and Shockwave Safe.
    DAVID Guest

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139