Professional Web Applications Themes

Using Collisions to Change Frame - Help Please - Macromedia Director 3D

Hello, I always come to this forum when I need help - its a great source of information. Was hoping someone knew what to do about my latest problem. I have a scene with several objects - a character you can move around and several token he picks up. Collision detection is achieved with Collision Modifiers. Upon the character touching one of these tokens I call a global variable called frame jump which is initially set to false. When I pick up a token it becomes true and it goes to the framejump handler which then tells the movie to ...

  1. #1

    Default Using Collisions to Change Frame - Help Please

    Hello, I always come to this forum when I need help - its a great source of
    information. Was hoping someone knew what to do about my latest problem. I have
    a scene with several objects - a character you can move around and several
    token he picks up. Collision detection is achieved with Collision Modifiers.
    Upon the character touching one of these tokens I call a global variable called
    frame jump which is initially set to false. When I pick up a token it becomes
    true and it goes to the framejump handler which then tells the movie to switch
    frames.

    My problem is that I cant seem to set up the modifiers properly so that more
    the one frame can be viewed. Currently no matter what token I go to in the
    scene - the same frame of the movie comes up. I dont know what is causing it.

    My Code (apologies for what might be horrible code)



    global frameJump, frameJump2, frameJump3, frameJump4, frameJump5, frameJump6,
    frameJump7, frameJump8, frameJump9, frameJump10

    property pMouseInitPos, myModel, pCamera


    on beginSprite me
    sprite(me.spriteNum).member.resetWorld()


    -- lock camera to character
    sprite(1).member.model("Character").addChild(sprit e(1).member.camera[1])
    -- get a reference to the camera
    pCamera = sprite(me.spriteNum).camera
    -- turn fog on
    pCamera.fog.enabled = FALSE

    -- recognize but near and faron new me
    pCamera.fog.decayMode = #linear

    pCamera.fog.near = 5000
    pCamera.fog.far = 8000
    myPoint = sprite(me.spriteNum).member.model("info (1)")
    myPoint2 = sprite(me.spriteNum).member.model("info (2)")
    myPoint3 = sprite(me.spriteNum).member.model("info (3)")
    myPoint4 = sprite(me.spriteNum).member.model("info (4)")
    myPoint5 = sprite(me.spriteNum).member.model("info (5)")
    myPoint6 = sprite(me.spriteNum).member.model("info (6)")
    myPoint7 = sprite(me.spriteNum).member.model("info (7)")
    myPoint8 = sprite(me.spriteNum).member.model("info (8)")
    myPoint9 = sprite(me.spriteNum).member.model("info (9)")
    myPoint10 = sprite(me.spriteNum).member.model("transparent")
    myModel = sprite(me.spriteNum).member.model("Character")

    myModel.addModifier(#collision)
    sprite(me.spriteNum).member.model("Character").add Modifier(#collision)
    sprite(me.spriteNum).member.model("thesky").addMod ifier(#collision)
    sprite(me.spriteNum).member.model("theskyrotated") .addModifier(#collision)
    sprite(me.spriteNum).member.model("Horton").addMod ifier(#collision)
    sprite(me.spriteNum).member.model("School of
    Informatics").addModifier(#collision)
    sprite(me.spriteNum).member.model("TopSky").addMod ifier(#collision)
    sprite(me.spriteNum).member.model("info (1)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (2)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (3)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (4)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (5)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (6)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (7)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (8)").addModifier(#collision)
    sprite(me.spriteNum).member.model("info (9)").addModifier(#collision)
    sprite(me.spriteNum).member.model("transparent").a ddModifier(#collision)
    -- set all collision detection to #mesh
    myModel.collision.mode = #mesh
    sprite(me.spriteNum).member.model("Character").col lision.mode = #mesh
    sprite(me.spriteNum).member.model("thesky").collis ion.mode = #mesh
    sprite(me.spriteNum).member.model("theskyrotated") .collision.mode = #mesh
    sprite(me.spriteNum).member.model("Horton").collis ion.mode = #mesh
    sprite(me.spriteNum).member.model("School of Informatics").collision.mode =
    #mesh
    sprite(me.spriteNum).member.model("TopSky").collis ion.mode = #mesh
    sprite(me.spriteNum).member.model("info (1)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (2)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (3)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (4)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (5)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (6)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (7)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (8)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("info (9)").collision.mode = #mesh
    sprite(me.spriteNum).member.model("transparent").c ollision.mode = #mesh

    -- set callback for collisions

    myPoint.addModifier(#collision)
    myPoint2.addModifier(#collision)
    myPoint3.addModifier(#collision)
    myPoint4.addModifier(#collision)
    myPoint5.addModifier(#collision)
    myPoint6.addModifier(#collision)
    myPoint7.addModifier(#collision)
    myPoint8.addModifier(#collision)
    myPoint9.addModifier(#collision)
    myPoint10.addModifier(#collision)


    myPoint.collision.mode = #mesh
    myPoint2.collision.mode = #mesh
    myPoint3.collision.mode = #mesh
    myPoint4.collision.mode = #mesh
    myPoint5.collision.mode = #mesh
    myPoint6.collision.mode = #mesh
    myPoint7.collision.mode = #mesh
    myPoint8.collision.mode = #mesh
    myPoint9.collision.mode = #mesh
    myPoint10.collision.mode = #mesh


    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle,me,myPoint)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle2,me,myPoint2)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle3,me,myPoint3)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle4,me,myPoint4)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle5,me,myPoint5)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle6,me,myPoint6)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle7,me,myPoint7)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle8,me,myPoint8)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle9,me,myPoint9)

    sprite(me.spriteNum).member.registerForEvent(#coll ideWith,#handle10,me,myPoint10
    )

    end


    on exitFrame me
    if frameJump then

    go to frame 4 + sprite(me.spriteNum).member.resetWorld() + frameJump =
    false
    _global.clearGlobals()
    end if
    if frameJump2 then

    go to frame 5 + sprite(me.spriteNum).member.resetWorld() + frameJump2 =
    false
    _global.clearGlobals()
    end if
    if frameJump3 then

    go to frame 6 + sprite(me.spriteNum).member.resetWorld() + frameJump3 =
    false
    _global.clearGlobals()
    end if
    if frameJump4 then

    go to frame 7 + sprite(me.spriteNum).member.resetWorld() + frameJump4 =
    false
    _global.clearGlobals()
    end if
    if frameJump5 then

    go to frame 8 + sprite(me.spriteNum).member.resetWorld() + frameJump5 =
    false
    _global.clearGlobals()
    end if
    if frameJump6 then

    go to frame 9 + sprite(me.spriteNum).member.resetWorld() + frameJump6 =
    false
    clearGlobals
    end if
    if frameJump7 then

    go to frame 10 + sprite(me.spriteNum).member.resetWorld() + frameJump7 =
    false
    _global.clearGlobals()
    end if
    if frameJump8 then

    go to frame 11 + sprite(me.spriteNum).member.resetWorld() + frameJump8 =
    false
    _global.clearGlobals()
    end if
    if frameJump9 then

    go to frame 12 + sprite(me.spriteNum).member.resetWorld() + frameJump9 =
    false
    _global.clearGlobals()
    end if

    if frameJump10 then

    go to frame 13 + sprite(me.spriteNum).member.resetWorld() + frameJump10 =
    false
    _global.clearGlobals()
    end if

    if keyPressed(123) then -- left arrow
    sprite(me.spriteNum).member.model("Character").rot ate(0,10,0)
    else if keyPressed(124) then -- right arrow
    sprite(me.spriteNum).member.model("Character").rot ate(0,-10,0)
    else if keyPressed(125) then -- down arrow
    sprite(me.spriteNum).member.model("Character").tra nslate(0,0,200)
    else if keyPressed(126) then -- up arrow
    sprite(me.spriteNum).member.model("Character").tra nslate(0,0,-200)
    end if

    end exitFrame



    on handle me, collisionData
    frameJump = true
    end

    on handle2 me, collisionData
    frameJump2 = true
    end

    on handle3 me, collisionData
    frameJump3 = true
    end

    on handle4 me, collisionData
    frameJump4 = true
    end

    on handle5 me, collisionData
    frameJump5 = true
    end

    on handle6 me, collisionData
    frameJump6 = true
    end

    on handle7 me, collisionData
    frameJump7 = true
    end

    on handle8 me, collisionData
    frameJump8 = true
    end

    on handle9 me, collisionData
    frameJump9 = true
    end

    on handle10 me, collisionData
    frameJump10 = true
    end

    mbrown174 Guest

  2. #2

    Default Re: Using Collisions to Change Frame - Help Please

    I'm afraid I don't understand what it is you're trying to achieve.

    The line (s)
    go to frame 4 + sprite(me.spriteNum).member.resetWorld() + frameJump =
    false
    doesn't make any sense at all
    I presume you want Lingo to do each of those things?
    Therefore they should be all on seperate lines:
    go to frame 4
    sprite(me.spriteNum).member.resetWorld()
    frameJump = false

    I'm not sure why you would want to resetWorld. When you go to frame 4, does
    this contain a different 3D object?

    The Guest

  3. #3

    Default Re: Using Collisions to Change Frame - Help Please

    Here's what I think you are trying to do:
    When the user's character collides with one of the token objects, you want to
    unlock a scene at a given frame. If the user has collected a number of tokens,
    all the associated scenes should be unlocked.

    It seems to me that the same 3D sprite containing the same 3D member appears
    at all the target frames. This leads me to guess that the "scenes" you wish to
    jump to are in fact inside the same 3D world.

    It might be helpful if you could create a storyboard of how your movie is to
    work, and post it somewhere on-line so that we can take a look at it .

    openspark Guest

Similar Threads

  1. How can I change client frame when video stopspublishing?
    By dan99216 in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: April 8th, 07:01 AM
  2. collisions
    By :. Buzzalino \(Foros Macromedia\) .: in forum Macromedia Director 3D
    Replies: 7
    Last Post: March 8th, 09:36 PM
  3. How to scale a text frame and change the font size in once?
    By mikmik@adobeforums.com in forum Adobe Indesign Windows
    Replies: 2
    Last Post: April 23rd, 04:17 PM
  4. Text staying after frame change problem
    By Akeopter webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: January 27th, 06:18 AM
  5. Frame change self and another frame
    By WebParty webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 2
    Last Post: July 26th, 05:37 AM

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