User Tag List

Results 1 to 9 of 9

Thread: troubles with instances

  1. #1
    No Products Registered

    Join Date
    Dec 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    troubles with instances

    I've searched the forum and can't fix the problem I'm having.

    I'm trying to make instances of 'active' move toward instances of another active, 'node'. I've tried spead value, and if active is not overlapping node and alt val A is the same, look in the direction of node. One works. The others wait until the first reached its node, then turn to face theirs.

    Any ideas on how to get multiple instances of an active to look in the direction of another active's instances without conflicting with each other?

  2. #2
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    Using fastloops along with spread values.

    +Always
    -Spread value 0 in alterable value a in active

    +Always
    -Start loop "lookat" Number of active times

    +On loop "lookat"
    +Alterable value a = loopindex of lookat
    +Other events you want to add
    -Here is where your events for looking at go

  3. #3
    No Products Registered

    Join Date
    Dec 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    Thanks for the reply. Still not working, tho - I have 3 actives, and they all aim for the same node. I need them to each go to their own spot.

  4. #4
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    Hmm, that should have worked. Maybe you can post an example of what you are working on so we can help better.

  5. #5
    No Products Registered

    Join Date
    Dec 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    I can't get the file online at the moment, but the program is really short. Sorry for the trouble.

    Frame one has:
    Active (bouncing ball movement)
    Active 2 (shrunk smaller, no movement)
    no code

    Frame 2
    No objects

    Code

    (first two events to create objects)
    1]Start of frame
    - Start loop "createobjects" 3 times

    2]On loop "createobjects"
    - create (Active) at (320, 240) layer 1 <-------from frame 1
    - create (Active 2) at (320, 240) layer 1 <-------from frame 1
    - (Active): Set x position to random (600)
    - (Active 2): Set x position to random (600)

    3] Always
    - (Active): spread value 0 in Alterable Value A
    - (Active 2): spread value 0 in Alterable Value A

    4] Always
    - Start loop "lookat" NObjects("(Active)") times

    5] On loop "lookat"
    Alterable Value A of (Active) = Loopindex("lookat")
    - (Active): Look at (0,0) from (Active 2)

    6] Every 2 seconds
    - (Active 2): Set x position to Random (600)
    - (Active 2): Set y position to Random (400)

  6. #6
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    Why are they in two separate frames? If the objects are in one frame and the code is in another how does it work at all?

  7. #7
    No Products Registered

    Join Date
    Dec 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    I've been working on this game so long, I can barely remember why, But I remember having troubles in my game with reusing objects, so I decided to put them all in an 'objects' frame and create objects from that frame whenever I switch frames.

    The code is kept in behaviors. But any code in the frame will work on newly created objects as well, and created objects show up as normal objects in the event editor, as if they were dragged into the frame from another frame, so you can code them properly.

  8. #8
    No Products Registered

    Join Date
    Dec 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    If I have the code and objects in the same frame, its:

    Frame
    Active - copied and pasted twice, total 3
    Active 2 - shrunk, copied and pasted twice, total 3

    Always
    -Active: spread val 0 in alt val A

    Always
    - Start loop "lookat" NObjects (Active) times

    On loop "lookat"
    Alterable Value A of (Active) =LoopIndev("lookat")
    - Active: Look at (0,0) from (Active 2)


    And it does the same thing. They all head for one instance of Active 2.

  9. #9
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: troubles with instances

    All your code is doing is telling each 'active' object to look at a 'active2' object. Because you have not assigned each 'active2' object a unique ID value aswell, all your 'active' object will automatically look at the first 'active2' object (the one MMF created first)

    To get around this you will need to spread value 0 in both active objects.

    Something like the following:

    Always
    -Active: Spread Value 0 in Alt Value A
    -Active2: Spread Value 0 in Alt Value A

    Always
    -Start Loop 'lookat' NObjects (Active) times

    On loop "lookat"
    Alterable Value A of (Active)=LoopIndex("lookat")
    Alterable Value A of (Active2)=LoopIndex("lookat")
    - Active: Look at (0,0) from (Active 2)

Similar Threads

  1. iOS 7 Troubles
    By Jaklar in forum iOS Export Module Version 2.0
    Replies: 9
    Last Post: 23rd November 2013, 12:47 AM
  2. Pmo troubles
    By Jibs in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 23rd December 2011, 10:37 PM
  3. Moo troubles
    By Herbert in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 9th February 2010, 08:47 PM
  4. More INI troubles...
    By dsmathewson in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th September 2008, 01:36 PM
  5. i am in big big troubles:(
    By piki in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 25th June 2008, 11:37 AM

Posting Permissions

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